GO

Minio源代码安装

安装两种方式 从最新源代码发布版安装 git设置代理 [user] email = [email protected] 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 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穿越Firewall

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代理

Minio开发笔记

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

Go语言第一个基于模块应用

模块初始化 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=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.

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.

GO NOTES

How to check if a map contains a key func TestMap(t *testing.T){ attended := map[string]string{ "Ann": "t", "Joe": "r", } val, ok := attended["mm"] fmt.Print(val, ok) } if statements in Go can include both a condition and an initialization statement. The example above uses both: initializes two variables - val will receive either the value of “foo” from the map or a “zero value” (in this case the empty string) and ok will receive a bool that will be set to true if “foo” was actually present in the map