This project should act as an example for the following import resolution issue GO-3264.
Gogland fails to find imports in a symlinked GOPATH.
Jetbrains@dlsniper reacted with a tutorial video on how to setup projects with a recursive GOPATH
, awesome!
It works flawlessly if you setup the project as explained there or if you follow these steps:
- call
s/bootstrap
(ormake
) to setup the localGOPATH
$ s/bootstrap
Submodule path 'vendor/github.com/sirupsen/logrus': checked out '7f4b1adc791766938c29457bed0703fb9134421a'
linking "/tmp/gogland-import-issue" into local GOPATH: /tmp/gogland-import-issue/.go/src/github.com/klingtnet/gogland-import-issue
- open
/project/root/.go/src/github.com/klingtnet/gogland-import-issue
as project in Gogland
- set the projects
GOPATH
to this parent directory/project/root/.go
- add a Go Application run configuration for the
github.com/klingtnet/gogland-import-issue
package
That's it, folks!
$ make
Expected output:
$ make
s/bootstrap
Submodule 'vendor/github.com/sirupsen/logrus' (https://github.com/sirupsen/logrus.git) registered for path 'vendor/github.com/sirupsen/logrus'
Cloning into '/tmp/gogland-import-issue/vendor/github.com/sirupsen/logrus'...
Submodule path 'vendor/github.com/sirupsen/logrus': checked out '7f4b1adc791766938c29457bed0703fb9134421a'
linking "/tmp/gogland-import-issue" into local GOPATH: /tmp/gogland-import-issue/.go/src/github.com/klingtnet/gogland-import-issue
GOPATH=/tmp/gogland-import-issue/.go go build -ldflags="-X main.Version=fba0269" github.com/klingtnet/gogland-import-issue
$ ./gogland-import-issue
WARN[0000] I am printing!
I am printing!