安装两种方式 从最新源代码发布版安装 git设置代理 [user] email = [email protected] name = bigo [http] proxy = sslverify = false 系统代理 set HTTP_PROXY= set HTTPS_PROXY= 安装 go get github.com/minio/minio MAKE mkdir -p $GOPATH/src/github.com/minio cd $GOPATH/src/github.com/minio git clone https://github.com/minio/minio.git cd minio/ git checkout RELEASE.2020-01-03T19-12-21Z make -n test mkdir -p /home/bigo/go/bin which golint 1>/dev/null || (echo "Installing golint" && GO111MODULE=off go get -u golang.org/x/lint/golint) which staticcheck 1>/dev/null || (echo "Installing staticcheck" && wget --quiet https://github.

Lang Go Dep Manage

glide To upgrade dependencies, please make the necessary modifications in glide.yaml and run glide update.


go模块代理 https://github.com/goproxy/goproxy.cn $go version go version go1.13.12 linux/amd64 go env -w GO111MODULE=on go env -w GOPROXY=https://goproxy.cn,direct 重置goproxy go env -w GOPROXY go doc https://golang.google.cn proxy 从 Github 的代码库 clone go get -u github.com/golang/text mv $GOPATH/src/github.com/golang/text $GOPATH/src/golang.org/x/text go get -u github.com/golang/crypto mv $GOPATH/src/github.com/golang/crypto $GOPATH/src/golang.org/x/crypto 设置 GOPROXY 环境变量配置代理 例如:GOPROXY=https://goproxy.io https://github.com/northbright/Notes/blob/master/Golang/china/get-golang-packages-on-golang-org-in-china.md https://gocn.vip/article/1678 配置代理 系统代理 GIT代理


依赖 go list -m all go list -m -versions github.com/minio/cli


模块初始化 mkdir -p $GOPATH/src/github.com cd $GOPATH/src/github.com mkdir -p wubigo/API/go/hello cd wubigo/API/go/hello go mod init github.com/wubigo/API/go/hello 检查go.mod ll go.mod cat go.mod module github.com/wubigo/API/go/hello go 1.13 创建程序 hello.go package main import ( "fmt" "github.com/google/go-cmp/cmp" ) func main() { fmt.Println(cmp.Diff("Hello World", "Hello Go")) } package main声明该模块是一个可执行程序而不是共享库 编译测试 go install github.com/wubigo/API/go/hello 或者 go install . 或者 go install -n 检查go.mod go.mod module github.com/wubigo/API/go/hello go 1.

Go Vscode环境配置

go version go version go version go1.13.5 windows/amd64 vs proxy 根据code提示自动安装插件 手工安装插件 go代理配置 set http_proxy= git代理配置 git config --global http.proxy git config --global http.sslverify "false" 手工安装插件 go get -u -v github.com/go-delve/delve/cmd/dlv go get -u -v github.com/ramya-rao-a/go-outline go get -u -v github.com/ramya-rao-a/go-outline go get -u -v github.com/acroca/go-symbols go get -u -v github.com/mdempsky/gocode go get -u -v github.com/rogpeppe/godef go get -u -v golang.org/x/tools/cmd/godoc go get -u -v github.

Go Module

模块 A module is a collection of related Go packages that are versioned together as a single unit. Modules record precise dependency requirements and create reproducible builds. go.mod A module is defined by a tree of Go source files with a go.mod file in the tree’s root directory. Module source code may be located outside of GOPATH. There are four directives: module, require, replace, exclude. 显示当前的模块和依赖 go list -m all 显示特定模块的所有版本标签 go list -m -versions github.


blank identifier To ignore one of the values, assign it to the blank identifier : links, _ := findLinks(url) // errors ignored for _, url := range os.Args[1:] { import ImportDeclaration = "import" ImportSpec ImportSpec = [ "." | "_" | Identifier ] ImportPath According to language spec it depends on the implementation how import path (string) is interpreted but in real life it’s path relative package’s vendor directory or go env GOPATH/src