go的源码文件
分为三类:命令源码文件,库源码文件,测试源码文件
- 命令源码文件:后缀.go的文件,一个目录下,只能有一个main的入口,否则build或install会报错。
- 库源码文件:普通的源码文件,库源码文件被安装后,相应的归档为.a文件存放在pkg相关目录下
- 测试源码文件:名称以_test.go为后缀的源码文件,并且必须包含Test或者Benchmark名称前缀的函数
func TestXXX(t *testing.T)
{
}
func BenchmarkXXX(b *testing.B)
{
}
注意测试函数的参数是固定的。
Go的命令
bug start a bug report
build compile packages and dependencies
clean remove object files and cached files
doc show documentation for package or symbol
env print Go environment information
fix update packages to use new APIs
fmt gofmt (reformat) package sources
generate generate Go files by processing source
get download and install packages and dependencies
install compile and install packages and dependencies
list list packages or modules
mod module maintenance
work workspace maintenance
run compile and run Go program
test test packages
tool run specified go tool
version print Go version
vet report likely mistakes in packages
get 命令拉取源码
go get -x github.com/go-errors/errors
标签:03,文件,go,源码,install,常用命令,Go,packages
From: https://www.cnblogs.com/huacha/p/16804697.html