552
社区成员
一、配置Go语言环境
1.下载Go(All releases - The Go Programming Language)并安装
2. 配置GOPROXY变量
go env -m GOPROXY=https://goproxy.cn,direct
3.在VS Code中安装Go插件
二、编写版本库并编写Go程序
将项目克隆到本地
git clone https://gitee.com/meng-yinlei/go-menu.git
新建menu.go文件
package main
import "fmt"
func main() {
var cmd string
for {
fmt.Print("Please input a command: ")
fmt.Scanln(&cmd)
switch cmd {
case "help":
fmt.Println("This is help command.")
case "quit":
fmt.Println("Bye.")
return
default:
fmt.Println("Wrong command!")
}
}
}
在命令行中输入go run main.go命令即可运行程序,运行结果如下:
三、推送到远程仓库
git add .
git commit -m "first commit"
git push -u origin "master"
作者:467