安装两种方式 从最新源代码发布版安装 git设置代理
[user] email = hi@wubigo.com name = bigo [http] proxy = http://127.0.0.1:49210 sslverify = false 系统代理
set HTTP_PROXY=http://127.0.0.1:49210/ set HTTPS_PROXY=http://127.0.0.1:49210/ 安装
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 go install -v 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.
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 version go version go version go1.13.5 windows/amd64 vs proxy 根据code提示自动安装插件
手工安装插件 go代理配置 set http_proxy=http://127.0.0.1:4910 git代理配置 git config --global http.proxy https://127.0.0.1:4910 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.
模块 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.
虚拟包版本 Untagged revisions can be referred to using a “pseudo-version” like v0.0.0-yyyymmddhhmmss-abcdefabcdef, where the time is the commit time in UTC and the final suffix is the prefix of the commit has
go get github.com/vladimirvivien/go4vl@40b41ba go get: upgraded github.com/vladimirvivien/go4vl v0.0.1 => v0.0.2-0.20211216162907-40b41ba86c5c 类型转换操作 For every type T, there is a corresponding conversion operation T(x) that converts the value x to >type T. A conversion from one type to another is allowed if both have the same underlying type, or >if both are unnamed pointer types that point to variables of the same underlying type; these >conversions change the type but not the representation of the value.