https://qiita.com/necomeshi/items/676ccb669d6e6102117b
安装
https://golang.org/dl/
# 下载&解压
axel -n 10 https://dl.google.com/go/go1.14.linux-amd64.tar.gz
tar xvfz go1.10.3.linux-amd64.tar.gz
mkdir $HOME/gopath
# 系统环境变量
export GOROOT="$HOME/go"
export GOPATH="$HOME/gopath"
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
# go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ken/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/ken/gopath"
GORACE=""
GOROOT="/home/ken/go"
GOTMPDIR=""
GOTOOLDIR="/home/ken/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build282538111=/tmp/go-build -gno-record-gcc-switches"
#手动安装工具包
go env -w GO111MODULE=on
go env -w GOPROXY="https://goproxy.io,direct"
go env -w GOSUMDB=off
cd $GOPATH/src
gocode
gopkgs
go-outline
go-symbols
guru
gorename
gotests
gomodifytags
impl
fillstruct
goplay
godoctor
gocode-gomod
godef
goimports
golint
go get -u -v github.com/mdempsky/gocode
go get -u -v github.com/uudashr/gopkgs/v2/cmd/gopkgs
go get -u -v github.com/ramya-rao-a/go-outline
go get -u -v github.com/acroca/go-symbols
go get -u -v golang.org/x/tools/cmd/guru
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v golang.org/x/tools/gopls
go get -u -v github.com/cweill/gotests/...
go get -u -v github.com/fatih/gomodifytags
go get -u -v github.com/josharian/impl
go get -u -v github.com/davidrjenni/reftools/cmd/fillstruct
go get -u -v github.com/haya14busa/goplay/cmd/goplay
go get -u -v github.com/godoctor/godoctor
go get -u -v github.com/stamblerre/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v golang.org/x/tools/cmd/goimports
go get -u -v golang.org/x/lint/golint
配置visual studio code
https://jeasonstudio.git
books.io/vscode-cn-doc/content/
参考 https://code.visualstudio.com/docs/languages/go
# 安装扩展 Go
略
# 配置settings
"go.gopath": "/home/ken/gopath",
"go.goroot": "/home/ken/go",
"go.inferGopath": true,
"go.gocodePackageLookupMode": "go",
"go.gotoSymbol.includeImports": true,
"go.useCodeSnippetsOnFunctionSuggestWithoutType": true,
"go.useCodeSnippetsOnFunctionSuggest": true,
"go.autocompleteUnimportedPackages": true,
#包管理工具( dep不好用 )
go get -u -v github.com/golang/dep/cmd/dep
mkdir $GOPATH/src/project_01
dep init
dep ensure
dep ensure -update
dep ensure -add github.com/pkg/errors
dep status
dep version
dep check
go get -u -v github.com/kardianos/govendor
govendor init
govendor fetch github.com/ethereum/go-ethereum
govendor list
govendor update