571
社区成员
发帖
与我相关
我的任务
分享目录
1.1 官网下载对应版本安装:https://code.visualstudio.com/Download

1.2 下载中文插件(可选)

2.1 官网下载相应版本安装:https://golang.google.cn/dl/

2.2 配置环境变量
//用户变量:
GOPATH:%USERPROFILE%\go
Path:%USERPROFILE%\go\bin
系统变量:
GOROOT:D:\Go
Path:D:\Go\bin
在cmd中运行go version查看安装是否成功

2.3 在vscode中下载go插件

3.1 新建menu仓库

3.2 克隆到本地
git clone https://gitee.com/leikun/menu.git

4.1 编写代码
package main
import (
"fmt"
)
func main() {
var cmd string
fmt.Print("Menu by lk\n")
for {
fmt.Print("******************************\n>")
fmt.Scanln(&cmd)
if cmd == "quit" {
break
}
switch cmd {
case "h":
fmt.Println("This is helloworld!!!")
case "help":
fmt.Println("This is help cmd!")
case "quit":
break
default:
fmt.Println(cmd + " isn't exist!")
}
}
}
4.2 运行调试
PS D:\Go\project\menu> go run .\main.go
4.3 推送到gitee仓库
PS D:\Go\project\menu> git status
On branch master
Your branch is up to date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
main.go
nothing added to commit but untracked files present (use "git add" to track)
PS D:\Go\project\menu> git add .
PS D:\Go\project\menu> git commit -m "menu"
[master e5eefd5] menu
1 file changed, 27 insertions(+)
create mode 100644 main.go
PS D:\Go\project\menu> git push
info: detecting host provider for 'https://gitee.com/'...
fatal: Custom certificate bundle not found at path: E:/鏉烆垯娆?/Git/mingw64/ssl/certs/ca-bundle.crt
info: detecting host provider for 'https://gitee.com/'...
fatal: Custom certificate bundle not found at path: E:/鏉烆垯娆?/Git/mingw64/ssl/certs/ca-bundle.crt
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 4 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 509 bytes | 509.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.3]
To https://gitee.com/leikun/menu.git
468c982..e5eefd5 master -> master
4.3 查看仓库推送是否成功
