I'm using Goland 2017.3 with Go 1.9.2, and have a custom GOPATH with govendor that replicates the DigitalOcean monorepo, as explained here: https://blog.digitalocean.com/cthulhu-organizing-go-code-in-a-scalable-repo/
The structure looks like this:
gocode
├── .env.sh
├── bin
├── src
│ └── acmecorp
│ ├── teams
│ └── vendor
├── pkg
and .env.sh
looks like this:
SCRIPT=`python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "${0}"`
GOCODE=$(dirname $SCRIPT)
export GOPATH="$GOCODE"
export PATH="$PATH:$GOPATH/bin"
I have no issue building code with source .env.sh
and govendor build
. govendor
resolves all dependencies and builds the project.
However, when I attempt to set up GOPATH
in GoLand and set PROJECT GOPATH
to $HOME/gocode
, GoLand stops recognizing the stdlib because it starts looking for the stdlib in vendor
: $HOME/gocode/src/acmecorp/vendor/time has no buildable Go source files
. If I remove the PROJECT GOPATH
it finds the stdlib but not the code in the mono repo.
How can I get GoLand to stop looking in vendor
for the stdlib?
Edit: GOROOT
is kept as standard in the IDE: screenshot of GOROOT