Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

exec format error

Tags:

go

I recently installed lubuntu 11.04 on my pc. Following this guide on installing go from source, installing golang on my pc went well. To test my installation, I ran hello.go and got this error:

fork/exec /tmp/go-build748212890/command-line-arguments/_obj/a.out: exec format error

I looked it up on google, and one of the more relevant results that I found said to remove the package, then reinstall again. That did not help.

Can you tell me what is causing this error, and how I can fix this?

Thanks, and have a nice day!

like image 573
Jim Syyap Avatar asked Dec 14 '12 00:12

Jim Syyap


1 Answers

I had this problem - it was very simple: I had set $GOOS to something other than the OS I was testing on. You can't do cross-platform testing. So for "go test", don't set $GOOS. I'm pretty sure the "Exec format error" you got was a result of go test trying to execute something on the wrong architecture/OS.

like image 157
rfay Avatar answered Oct 17 '22 15:10

rfay