johndisk
johndisk

Reputation: 227

Golang download and '$GOPATH not set'

I downloaded Golang 1.11.1, but in the terminal when I type go version, I get: go version go1.6.2 darwin/amd64.

When I type which go in the terminal, I get: /usr/local/bin/go

I can see in /usr/local that there is a go directory, and when I open the file VERSION, it says 1.11.1

When I try go get https://github.com/blablabla in the terminal, it spits out package github.com/google/uuid: cannot download, $GOPATH not set. For more details see: go help gopath.

What is the issue here? Could it be that I am one of the users (and not the original user) on my mac? To get to my files, I have to go to Users/myusername first... How do I change my GOPATH so that this works?

Thank you -S

Update: I set my $GOPATH to /Users/myusername/go by editing my bash_profile, but the version still has not changed, although I re-downloaded Go.

Upvotes: 2

Views: 1978

Answers (1)

Anshu
Anshu

Reputation: 1337

you can try this

  1. You can go to user/local/go/src

    if the golang is install .it show many file.

  2. Then you can open terminal. and type go env

  3. after that set the $GOPATH

    export GOPATH=/user/local/go

  4. Also set the $GOBIN

    export GOBIN= $GOPATH/bin

Upvotes: 3

Related Questions