GOPATH messed up; can not reset

I tried to enter 2 values for GOPATH, but must have entered something stupid.
Now, GOPATH is broken. Can not reset it.

If I ask:
go env GOPATH

I get:
go: GOPATH entry is relative; must be absolute path: "GOPATH=/var/www/localdev/goGeneric".

When I try to override with the proper path:
go env -w GOPATH=/var/www/localdev/goTest

Then comes the same error.

How to remove a corrupt value for GOPATH?

in the same terminal issue

export GOPATH="/some/path/here" # only on linux or osx

if on windows adapt above to define environment variable GOPATH to your value

now execute your go build or go run in this same terminal … if this fixes it then you need to save above export command in your system environment variable definition list which is OS specific … above is for linux or osx I do no know the windows equivalent … if linux save above export command in your ~/.bashrc file or in file ~/.profile if on osx

1 Like

Hi Scott,
That saved the day! The solution worked.

Thank you, Rene

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