记录下不同平台的发包操作和期间遇到的问题
1.命令:
$env:GOOS=linux
$env:GOARCH=amd64
go build -o release/HTTPServices-linux
第一行,配置平台,linux、windows
第二行,配置部署服务器的处理器架构
第三行,输出目标文件,这里添加了一层release文件夹目录
go build -o release/HTTPServices-linux
go build -o release/HTTPServices-win.exe
2.期间遇到的问题:
我是在Windows电脑上开发,需要注意一点,如果切换了Linux平台,会直接导致在vscode中,go run . 程序启动命令失效,会弹出类似下方的提示。
exec: "C:\\Users\\AppData\\Local\\go-build\\f6\\f637cb59d3bdd4d321f8814f0bd1a75e3d0441888bd20406ba9852044938afb3-d\\HTTPServices": executable file not found in %PATH%