546
社区成员
选用go或rust编写menu项目,创建一个版本库(gitee或github),采用VS Code作为编译调试环境。撰写一个帖子,从创建版本库、配置VS Code编译调试环境、编写menu第一版简单程序,以及最终调试运行,完整记录下来,目标是为go或rust的开发者提供一个开发环境配置和工作流程的参考。
go官网下载地址:https://golang.google.cn/dl/
选择最新的Windows版本进行下载。直接解压缩到相应的文件夹即可。
配置GOROOT系统变量:也就是解压缩到的文件夹。
配置GOPATH系统变量:
最后配置bin环境变量:在系统变量Path中新建
检查是否成功安装Go环境:显示版本信息即配置成功。
配置Go代理的环境变量
使用下面的命令:
go env -w GO111MODULE=on Golang1.16默认开启,1.16一下需要执行这条命令
go env -w GOPROXY=https://goproxy.cn,direct
安装Go语言插件
package main
import "fmt"
func main() {
for {
var commands string
var tip1 string = "Say Hello"
var tip2 string = "You quitted this program"
var tip3 string = "The command list is as follows:"
var cmd1 string = "cmd:HELPME"
var cmd2 string = "cmd:HELLO"
var cmd3 string = "cmd:QUIT"
fmt.Printf("input:")
fmt.Scanln(&commands)
if commands == "HELPME" {
fmt.Printf("命令列表:%s\n", tip3)
fmt.Printf("命令1%s\n", cmd1)
fmt.Printf("命令2%s\n", cmd2)
fmt.Printf("命令3%s\n", cmd3)
} else if commands == "HELLO" {
fmt.Printf("提示:%s\n", tip1)
} else if commands == "QUIT" {
fmt.Printf("提示:%s\n", tip2)
break
} else {
fmt.Println("Please try \"HELPME\" command to find the solution!")
}
}
}
调试运行结果如下:
初始化本地仓库:直接点,或者在终端输入git init
接下来就是添加到暂存区以及提交到本地仓库:
git add .
git commit -m "The first version of Menu"
关联远程仓库
git remote add origin https://gitee.com/mzlxplus/menu.git
(使用git remote查看关联远程仓库情况)
如果初始化了Redame文件,则要处理冲突:
一是直接强制推送:
git push -f -u origin master
二是使用
git pull origin master --allow-unrelated-histories
先拉取,然后再push
这里采用第二种方式,然后再看就会发现多了两个README文件
推送到远程仓库:
git push -u origin master
查看Gitee上的远程仓库:
学号后三位:229