gitpod icon indicating copy to clipboard operation
gitpod copied to clipboard

Goland does not set GOPATH to the same value as Workspace environment variables

Open easyCZ opened this issue 3 years ago • 2 comments

Bug description

When I launch gitpod on one of my personal repositories, Goland automatically detects GOPATH (in IDE config) and sets it to home/gitpod/go.

If I do the exact same thing with our gitpod-io/gitpod repo, it for some reason sets it to home/gitpod/go-packages. This then causes the IDE to not have the dependencies and requires me to manually ask it to fetch and index the dependencies.

Steps to reproduce

Launch Goland on gitpod-io/gitpod repository and observe the GOPATH variable in Goland Settings is set to home/gitpod/go-packages

Screenshot of the GoLand Preferences (right after the workspace startup) with "Use GOPATH that is defined in system environment" set:

image

And then, here is what it looks like when we uncheck this option:

image

Workspace affected

No response

Expected behavior

No response

Example repository

No response

Anything else?

As a possible datapoint, if I add GOPATH=/workspace/go into my Gitpod env variables, it then shows up in the IDE configuration. However, that should not be needed, as the GOPATH in the workspace image is set to /workspace/go already.

See internal thread

easyCZ avatar Sep 21 '22 09:09 easyCZ

Extra info: When we uncheck the "Use GOPATH that is defined in system environment" option and ask GoLand to sync the project dependencies, it prints this warning:

GOROOT=/home/gitpod/go #gosetup
GOPATH=/home/gitpod/go #gosetup
/home/gitpod/go/bin/go mod tidy #gosetup
warning: GOPATH set to GOROOT (/home/gitpod/go) has no effect

felladrin avatar Sep 21 '22 09:09 felladrin

@felladrin Did you file an issue on youtrack?

akosyakov avatar Oct 20 '22 08:10 akosyakov

We're closing this issue, as the GOPATH in GoLand settings is now correctly set with the same value from the workspace's GOPATH environment variable.

image

felladrin avatar Dec 15 '22 13:12 felladrin