My issue:
I need to compile a Go application from Windows (current workspace) to Linux (deployment environment), I've try several times using few techniques described in this platform and many more and nothing help, everything looks fine but isn't work.
I'm compiling for linux using this script in windows
$ set GOARCH=amd64
$ set GOOS=linux
$ go build app_name.go
in the cmd
folder I can find a file named app_name
with no extension, which should be fine.
Then, I receive an error when trying to execute the binary in Linux, using few ways
$ ./app_name
-bash: ./app_name: Permission denied
$ source app_name
-bash: source: app_name: cannot execute binary file
this is the file that I received after the compilation:
-rw-r--r-- 1 xxx xxx 7313830 Jan 26 16:59 app_name
If I run the application in windows with go run -arguments app_name.go
it works perfect, but the issue appear after compile or try to compile the app for linux, I can't run the app even as root
question from:
https://stackoverflow.com/questions/65910721/issues-while-compiling-a-go-app-from-windows-to-linux 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…