go常用命令

命令解释中文
go helphelp帮助
bugstart a bug report开始错误报告
buildcompile packages and dependencies编译包和依赖项
cleanremove object files and cached files删除对象文件和缓存文件
docshow documentation for package or symbol显示包或符号的文档
envprint Go environment information打印Go环境信息
fixupdate packages to use new APIs更新包以使用新的API
fmtgofmt (reformat) package sourcesgofmt(重新格式化)包源
generategenerate Go files by processing source按处理源生成Go文件
getadd dependencies to current module and install them将依赖项添加到当前模块并安装它们
installcompile and install packages and dependencies编译和安装软件包和依赖项
listlist packages or modules列出包或模块
modmodule maintenance模块维护
workworkspace maintenance工作区维护
runcompile and run Go program编译并运行Go程序
testtest packages测试包
toolrun specified go tool运行指定的go工具
versionprint Go version打印Go版本
vetreport likely mistakes in packages报告包中可能的错误
buildconstraintsbuild constraints生成约束
buildmodebuild modes构建模式
ccalling between Go and C在Go和C之间调用
cachebuild and test caching生成和测试缓存
environmentenvironment variables环境变量
filetypefile types文件类型
go.modthe go.mod filego.mod文件
gopathGOPATH environment variableGOPATH环境变量
gopath-getlegacy GOPATH go get传统GOPATH go get
goproxymodule proxy protocol模块代理协议
importpathimport path syntax导入路径语法
modulesmodules, module versions, and more模块、模块版本等
module-getmodule-aware go get模块感知go get
module-authmodule authentication using go.sum使用go进行模块身份验证go.sum
packagespackage lists and patterns包列表和模式
privateconfiguration for downloading non-public code下载非公开代码的配置
testflagtesting flags测试标志
testfunctesting functions测试功能
vcscontrolling version control with GOVCS使用GOVCS控制版本控制
vim ~/.bash_profile
配置以下环境变量到文件中
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
配置完输入:wq

输入以下命令使环境变量生效

source ~/.bash_profile

测试版本

go version

出现以下信息

go version go1.18.3 darwin/amd64

写一个hello world

vim test.go
package main
import "fmt"
func main(){
    fmt.Println("hello world")
}

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值