交叉编译windows的exe
export GOPROXY=https://proxy.golang.com.cn,direct
go mod tidy
必须写在一行
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build hello3.go
If you are experiencing issues with downloading packages from the official Go module proxy, you can try using an alternative proxy like goproxy.cn
. This is a popular Go module proxy server in China, which provides a mirror of the official Go module proxy server and can help to speed up the download process for Chinese developers.
To use goproxy.cn
, you can set the GOPROXY
environment variable to https://goproxy.cn
:
export GOPROXY=https://goproxy.cn
This will instruct the Go tool to use goproxy.cn
as the primary module proxy server for downloading packages.
You can also set this environment variable permanently in your shell profile file (e.g. .bashrc
, .zshrc
, etc.) if you want it to be set every time you start a new terminal session.
After setting the GOPROXY
environment variable, you can try running the go get
command again to download the required package. The Go tool will now use goproxy.cn
as the module proxy server, which may help to resolve any network issues that you were experiencing with the official proxy server.
I have downloaded the package and placing it in the correct directory in …/go/pkg/mod/github.com/xuri/excelize@v1.4.1/
How should I modify go.mod to make it work?
go.mod修改运行已经下载的包
https://golang.google.cn/doc/tutorial/call-module-code
$ go mod edit -replace example.com/greetings=…/greetings
module
replace github.com/xuri/excelize => /path/to/excelize文章来源:https://www.toymoban.com/news/detail-435460.html
require (
github.com/xuri/excelize v1.4.1
)文章来源地址https://www.toymoban.com/news/detail-435460.html
到了这里,关于termux下go交叉编译和依赖包引用的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!