3

I'm trying to migrate from Goclipse dev environment to IDEA. Could not find a killing feature in golang-idea-plugin, that exists in Goclipse - each GO project automatically adds itself as a GOPATH item for Eclipse session, so I don't have to put it to global GOPATH manually. This is extremely useful, as I don't want to mix my local code with globally grabbed ones (I don't plan to share my code in any ways), plus several projects are distinguished from each other in their envs. But I did not found any kind of this feature in golang IDEA plugin, so my builds keep failing with follows:

cannot find package "wnd/modules/network" in any of:
C:\go\src\wnd\modules\network (from $GOROOT)
c:\gopath\src\wnd\modules\network (from $GOPATH)

Are there any cures for this within IDEA?

snuk182
  • 1,022
  • 1
  • 12
  • 28
  • IMO you are misusing [GOPATH](https://golang.org/doc/code.html#GOPATH). If you just want to separate fetched stuff from your stuff then a single [`GOPATH=/path/to/fetched/stuff:/path/to/your/own/stuff`](https://golang.org/doc/articles/go_command.html?h=GOPATH#tmp_3) is all you need. See `go help gopath`. – Dave C Mar 17 '15 at 16:07
  • @dave-c , will turn to this approach, if did not find a way to provide env codebase to session-narrowed GOPATH with IDEA plugin. I really don't need my code in a global GOPATH for now - it's ugly and even sometimes self-repeating (I've started learning Golang a while ago, so had a bit of mess of little educational projects around) – snuk182 Mar 17 '15 at 16:50

1 Answers1

4

If you are using the latest version of the plugin see the repository then you are able to fully customize the GOPATH layout. You can chose to have global entries, which are persisted for all your projects, or per project entries, which are project specific entries. You can really be creative with the options.

dlsniper
  • 7,188
  • 1
  • 35
  • 44
  • 1
    Indeed. Works as I expect since 0.9.371. Thanks! – snuk182 Jul 15 '15 at 07:22
  • @disniper ok, now can you explain me the steps to do it in intellij? – deFreitas Jan 25 '17 at 21:56
  • @deFreitas as this question / answer are very old. I recommend trying Gogland, the new JetBrains Go IDE, which is currently in private EAP, see: https://www.jetbrains.com/help/go/1.0/getting-started-with-gogland.html As for the plugin itself, please see: https://github.com/go-lang-plugin-org/go-lang-idea-plugin/wiki/Documentation#changing-the-go-libraries-go-packages – dlsniper Jan 26 '17 at 00:52
  • awesome solution:) – Faris Rayhan Sep 22 '17 at 09:31