Skip to content

This issue is resolved, setting up projects with a recursive GOPATH is cumbersome but works.

Notifications You must be signed in to change notification settings

klingtnet/gogland-import-issue

Repository files navigation

gogland-import-issue

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 (or make) to setup the local GOPATH
$ 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

Open project in Gogland

  • set the projects GOPATH to this parent directory /project/root/.go

Setup GOPATH in Gogland

  • add a Go Application run configuration for the github.com/klingtnet/gogland-import-issue package

Run configuration in Gogland

That's it, folks!

Build

$ 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!

About

This issue is resolved, setting up projects with a recursive GOPATH is cumbersome but works.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published