golang远程导入失败

I just install golang with homebrew and I am having trouble importing remote packages.

when I try to instal demo.go which contains

import "github.com/bradfitz/gomemcache/memcache"

I get the following error

$ go install
demo.go:3:8: cannot find package "github.com/bradfitz/gomemcache/memcache" in any of:
/usr/local/Cellar/go/1.4/libexec/src/github.com/bradfitz/gomemcache/memcache (from $GOROOT)
/Users/white/go/src/github.com/bradfitz/gomemcache/memcache (from $GOPATH)

To my untrained eyes it looks like it is just looking locally on my GOPATH.

That means you need to get it first:

go get github.com/bradfitz/gomemcache/memcache

That is what the bradfitz/gomemcache recommends.

Your untrained eyes are not fooling you: the go compiler will only look for code that is stored locally.

The go get tool, however, can be used to fetch code that is stored in a remote repository and copy it over locally. So, if you type:

go get github.com/bradfitz/gomemcache/memcache

you will have a copy of the code in $GOPATH/src/github.com/bradfitz/gomemcache/memcache

Notice that github.com/bradfitz/gomemcahce/memcache is actually a local directory path, so you use import "github.com/bradfitz/gomemcache/memcache" to import it in your code. It just happens to also be the name of a remote repository that the go get tool knows how to fetch.