On the Mac computer, compile the code of golang. After the code is successfully compiled, execute it. An error is reported
exec format error
After a long time of investigation, I finally found the problem: my computer’s configuration of golang is as follows:
GOOS="linux"
After compiling, I run it on MacOS, so I report an error.
When you know where the problem is, it’s very easy to solve it. When compiling, the execution is as follows:
GOOS=darwin GOARCH=amd64 go build -o http -v ./main.go
Read More:
- Docker run failed with the following error in logs, standard_ init_ linux.go:211 : exec user process caused “exec format error“
- standard_init_linux.go:211: exec user process caused “exec format error”
- Exec format error: Java
- Solve cannot execute binary file: exec format error under Linux
- insmod: init_module ‘hello.ko’ failed (Exec format error)
- Use the Zsh plug-in ‘Zsh syntax highlighting’ to highlight your available Zsh commands
- [Solved] Source Zsh error: zsh problem: compinit:503: no such file or directory
- FRP installation error:. / FRPC: cannot execute binary file: exec format error
- Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:exec (default-cli) on project Hello
- Error response from daemon: OCI runtime exec failed: exec failed: container_linux.go:345:
- Convert Tencent video QLV format to MP4 format
- invalid connection string format, a valid format is host:ip:port
- Extract audio from ffmpeg video to mp3 format or m4a format command
- Solution to flash back of MacBook Pro open software of M1 chip
- MacBook M1 Big Sur logging into forticlient SSL VPN
- Mac reports an error zsh: fork failed: resource temporarily unavailable (reasons and solutions)
- MacBook Pro battery 0%, connected to the power but showed that the battery is not charging solution
- Configure Java environment variables for Ubuntu with Zsh configuration
- Golang gets the list of files under the folder
- Common linux commands — find command’s Exec