Help with $GOPATH, keep getting "$GOPATH not set" error

I am trying to download install Google Stenographer on Ubuntu 16.04 per the instructions [here] (https://github.com/google/stenographer/blob/master/README.md). However, every time I try downloading Stenographer, I get the following error message despite my $GOPATH being set:

package github.com/google/stenographer: cannot download, $GOPATH not set

I have researched extensively and tried suggestions from numerous sites for setting GOPATH, setting environment variables, etc., but cannot get past this (despite verifying numerous times that GOPATH is set in go env and in my environment variables).




Does anyone know how I can get past this error?

Thank you in advance for any help that can be provided.

~Jeff S.

go%20env

1 Like

I’m not sure, if the go command sees your GOPATH, then I’d think go get would work from that same terminal. Does the directory specified in your GOPATH exist already?

1 Like

What command exactly causes the error you see? What version of go is installed? And what is your actual gopath as seen by the environment (env | grep GOPATH)

1 Like

Thank you for your responses, skillian and Nobbz. To answer your questions:
Does the directory specified in your GOPATH exist already? Yes

What command exactly causes the error you see? ```
go get github.com/google/stenographer

What version of go is installed?  go1.13
What is your actual GOPATH?  Currently it is $HOME/Projects


BUT...  I am happy to say I found the issue.  I changed the ownership of the folder I'm using in my GOPATH from root to my user account (sudo chown), and after that I was able to download Stenographer per the instructions I'm using.  Previously it was root.  It took some digging, but nowhere in any documentation I found for Go indicated that ownership of the GOPATH folder would be needed.

I go the idea from the [this](https://stackoverflow.com/questions/17872223/error-cannot-download-gopath-not-set/40750437#40750437) link and figured I'd give it a shot as nothing else had worked for me.  :smile:
1 Like

Ownership probably wasn’t the problem, but permissions instead. A folder that isn’t rwx-able is hard to differentiate from one that doesn’t exist.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.