\bin\go.exe get -u -v github.com/sqs/goreturns
github.com/sqs/goreturns (download)
Fetching https://golang.org/x/tools/imports?go-get=1
https fetch failed: Get https://golang.org/x/tools/imports?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
package golang.org/x/tools/imports: unrecognized import path "golang.org/x/tools/imports" (https fetch: Get https://golang.org/x/tools/imports?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)

其实 golang 在 github 上建立了一个镜像库,如 https://github.com/golang/net 即是 https://golang.org/x/net 的镜像库

获取 golang.org/x/net 包,其实只需要以下步骤:
mkdir -p $GOPATH/src/golang.org/x
cd $GOPATH/src/golang.org/x

git clone https://github.com/golang/net.git
git clone https://github.com/golang/tools.git
git clone https://github.com/golang/lint.git

其它 golang.org/x 下的包获取皆可使用该方法

开始安装:
切换到GOPATH目录下,执行相关的go install 命令

go install github.com/ramya-rao-a/go-outline

go install github.com/acroca/go-symbols

go install golang.org/x/tools/cmd/guru

go install golang.org/x/tools/cmd/gorename

go install github.com/josharian/impl

go install github.com/rogpeppe/godef

go install github.com/sqs/goreturns

go install github.com/golang/lint/golint

go install github.com/cweill/gotests/gotests

这样vscode下go开发需要安装的插件都已经安装成功

rsrc.exe -ico resources/icon.ico -o main-app.syso -arch amd64
rice.exe embed-go
go build -o main.exe -ldflags="-s -w -H windowsgui"

-s去掉符号表,panic时候的stack trace就没有任何文件名/行号信息了,
这个等价于普通C/C++程序被strip的效果,
-w去掉DWARF调试信息,得到的程序就不能用gdb调试了。 -s和-w也可以分开使用.

交叉编译

SET CGO_ENABLED=0 SET GOOS=linux SET GOARCH=amd64 go build main.go

taskkill /F /IM go.exe
taskkill /F /IM gocode.exe
taskkill /F /IM compile.exe
taskkill /F /IM conhost.exe
taskkill /F /IM asm.exe
taskkill /F /IM cgo.exe
taskkill /F /IM vet.exe
taskkill /F /IM link.exe
rsrc.exe -manifest main.manifest -ico main.ico -o rsrc.syso
rice append --exec main.exe
go build -o main.exe && main.exe

$env:http_proxy = $env:https_proxy = "socks5://127.0.0.1:1080"
set https_proxy=socks5://127.0.0.1:1080

go get github.com/labstack/echo@v3.3.8
go mod vendor