高软lab2 Go语言实现Menu

雨境迷踪 2023-03-20 11:33:08

下载Go

官网下载Go语言

 

 

cmd中运行以下命令,设置代理,相当于更改镜像源 

go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,https://goproxy.io,direct

 

 

 

 

 

 

 

 

 

 

 

 

配置VsCode

在VsCode中安装Go插件

安装相关工具

 

 

 

 

 

 

 

 

编写Menu程序

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("Quit.")
			return
		default:
			fmt.Println("Wrong command!")
		}
	}
}

 

 

 

 

 

推送到远程仓库

查看

 作者:学号后三位-335

 

...全文
36 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

571

社区成员

发帖
与我相关
我的任务
社区描述
软件工程教学新范式,强化专项技能训练+基于项目的学习PBL。Git仓库:https://gitee.com/mengning997/se
软件工程 高校
社区管理员
  • 码农孟宁
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧