0
votes

I've installed go using Homebrew on my OS X 10.10 machine. Every time I try to compile a sample app that imports net/http, I get the following error:

load cmd/cgo: package cmd/cgo: no Go source files in /Users/bbaron/google_appengine/goroot/src/cmd/cgo

I have my GOPATH variable set correctly ($HOME/go) and my directory structure appears to be correct:

/Users/bbaron/go/src/github.com/einsteinx2/gamenotifier /Users/bbaron/go/src/github.com/einsteinx2/gamenotifier/server.go

Why does cgo seem to thing the GOPATH is $HOME/google_appengine/goroot

I previously (maybe a year ago) did some go development using App Engine, so there must be some left over garbage, but I can't figure out what I need to change to get this working.

I do have the App Engine SDK installed to $HOME/google_appengine but I don't see why that's affecting anything when I'm not importing any App Engine stuff.

Any ideas?

EDIT: It looks like the problem is my GOROOT. The following are also in go env:

GOROOT="/Users/bbaron/google_appengine/goroot" GOTOOLDIR="/Users/bbaron/google_appengine/goroot/pkg/tool/darwin_amd64"

But even if I export a correct GOROOT and check with echo $GOROOT, go env does not see the correct GOROOT

1
Where are you setting your GOPATH variable?Ewan
In my .zshrc file and I can see it successfully if I use echo $GOPATH or go envBen Baron

1 Answers

0
votes

It turned out that my google app engine installation was clobbering these environment variables somehow. I deleted the folder google_appengine in my home directory and then uninstalled the Homebrew version of Go and reinstalled from the official OS X package and now it's working fine.