golang打包windows很简单直接go bulid xx.go 会有一个.exe文件 直接运行这个文件就行

golang打包linux服务器

SET CGO_ENABLED=0

SET GOOS=linux

SET GOARCH=amd64

go build xx.go

有时会出现

github.com\mattn\go-isatty\isatty_tcgets.go:7:8: cannot find package "golang.org
/x/sys/unix" in any of:

GOPATH下的src中和github.com同级建立golang.org 进去再创建x文件夹进入执行git clone https://github.com/golang/sys.git

成功后会有sys文件夹

然后在执行上面的命令,会有一个二进制文件,放在linux服务器上

接着chmod 773 【二进制文件】

然后./二进制文件 

然后就ok了

相关文章:

  • 2022-02-19
  • 2022-12-23
  • 2023-03-31
  • 2021-08-08
  • 2021-09-04
  • 2021-09-27
  • 2021-05-19
猜你喜欢
  • 2021-11-02
  • 2022-12-23
  • 2021-09-11
  • 2018-07-27
  • 2021-10-09
  • 2022-12-23
相关资源
相似解决方案