brew install doesn't set GOPATH

5,455 views
Skip to first unread message

Mehul Kar

unread,
Dec 11, 2013, 2:12:15 PM12/11/13
to golan...@googlegroups.com
Hi, 

Instead of using the OSX package, I installed go using `brew` on Mavericks.

I have set up my `GOPATH` and `PATH` variables in bash_profiles like this:

export GOPATH=$HOME/go
PATH=$PATH:$GOPATH/bin

My directory structure looks like this:

~/go/
    bin/
    pkg/
    src/
        hello/
            hello.go

Inside ~/go/src/hello/, when I run `go install home.go`, I get this error:

`go install: no install location for .go files listed on command line (GOBIN not set)`

I don't see anything about GOBIN in http://golang.org/doc/code.html, but after setting GOBIN to $GOPATH/bin, I am able to install.

Is this an error on my part, a need for documentation, or possibly an issue with brew install?

Rodrigo Kochenburger

unread,
Dec 11, 2013, 2:20:38 PM12/11/13
to Mehul Kar, golan...@googlegroups.com
Can you check if your GOPATH is actually set properly on bash? Run this: env | grep -E "^GO"

PS: make sure you reply to all, I had to include the group again

- RK


On Wed, Dec 11, 2013 at 11:18 AM, Mehul Kar <mehu...@gmail.com> wrote:
Hi Rodrigo, 

I hadn’t tried that, but I just unset the GOBIN variable and tried just `go install` and I get this:

go install: no install location for directory /Users/mehulkar/dev/go/src/hello outside GOPATH

Mehul Kar
@mehulkar

On Dec 11, 2013, at 11:15 AM, Rodrigo Kochenburger <div...@gmail.com> wrote:

Have you tried just running `go install` inside the hello folder? go tool operates on package names, not files (except the run cmd)

- RK



--
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.



Mehul Kar

unread,
Dec 11, 2013, 2:22:12 PM12/11/13
to Rodrigo Kochenburger, golan...@googlegroups.com
yes, looks like GOPATH is set:

$ env | grep -E “^GO”
GOPATH=/Users/mehulkar/go


Mehul Kar
@mehulkar

Rodrigo Kochenburger

unread,
Dec 11, 2013, 2:26:38 PM12/11/13
to Mehul Kar, golan...@googlegroups.com
Looks like your GOPATH is set to ~/go but you ran the go install command on ~/dev/go

- RK

Mehul Kar

unread,
Dec 11, 2013, 2:28:04 PM12/11/13
to Rodrigo Kochenburger, golan...@googlegroups.com
Oh wow, that is embarrassing. Maybe I should have kept this offline. 

Happy Wednesday everyone! :)

Mehul Kar
@mehulkar

Rodrigo Kochenburger

unread,
Dec 11, 2013, 2:28:37 PM12/11/13
to Mehul Kar, golan...@googlegroups.com
It happens to the best of us :) Cheers

- RK
Reply all
Reply to author
Forward
0 new messages