go install: no install location for directory * outside GOPATH

5,117 views
Skip to first unread message

Dan Kortschak

unread,
Jun 24, 2013, 8:09:43 PM6/24/13
to golang-nuts
Can someone help me out with this error? I'm obviously missing something
really obvious; but errors is clearly in my GOPATH.

Ahh, I cannot name the package "errors". Why?

$ go install
go install: no install location for directory /home/daniel/Development/src/errors outside GOPATH
$ go env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/daniel/Development"
GORACE=""
GOROOT="/usr/local/src/go"
GOTOOLDIR="/usr/local/src/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread"
CGO_ENABLED="1"


Dave Cheney

unread,
Jun 24, 2013, 8:13:44 PM6/24/13
to Dan Kortschak, golang-nuts
errors is already owned by the standard library.

Try again with something like fmt or image/gif. If this is the same
error, then please raise a bug, the go tool should detect this
earlier* and give a better error

Dave

* i believe the Go tool is compiling the pkg to a temp directory then
getting confused because the normal path that errors would be
installed to, $GOROOT/pkg/$GOOS_$GOARCH/ is rightly not inside
$GOPATH.
> --
> You received this message because you are subscribed to the Google Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Dan Kortschak

unread,
Jun 24, 2013, 8:33:23 PM6/24/13
to Dave Cheney, golang-nuts
Yes, I figured that when I changed the package name. It seems to be an
unfortunate collision of me using errors as the package and working at
the base of my GOPATH out of laziness. I was surprised as I have an
errors package that is deeper in my GOPATH which works fine, but you
explanation makes perfect sense.

Yes, fmt does the same thing:

$ go install
go install: no install location for directory /home/daniel/Development/src/fmt outside GOPATH

http://code.google.com/p/go/issues/detail?id=5774

thanks
Dan

Dave Cheney

unread,
Jun 24, 2013, 8:39:11 PM6/24/13
to Dan Kortschak, golang-nuts
Thanks for raising the issue. The root cause is, some names are
reserved for the standard library. How we handle that could be a
subject of debate. Eg, do we compile $GOPATH/src/errors into
$GOPATH/pkg/$GOOS_$GOARCH/errors.a? If so, you'll never be able to
reference it.
Reply all
Reply to author
Forward
0 new messages