termux下go交叉编译和依赖包引用

文章介绍了如何在Windows环境下进行Go语言的交叉编译,生成exe文件。当遇到从官方Go模块代理下载包的问题时,推荐使用goproxy.cn作为替代代理,通过设置GOPROXY环境变量来加速下载过程。同时,文章还讲解了如何修改go.mod文件,使用已下载的包,特别是对github.com/xuri/excelizev1.4.1的处理,通过`replace`指令指明本地路径。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

交叉编译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, .zs

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值