I use IntelliJ IDEA as golang IDE in Windows , and system environment have already set GOPATH,but IDEA can't load $GOPATH.
I use go get github.com/astaxie/beego
, this package is installed correctly, but in IDEA can't import this library.
I have added this package in project's structure in this way:
and this project's choice “Go sdk go1.1.1 windows/amd64 ”like
how can I set GOPATH in idea?
Enable Go modules in a projectPress Ctrl+Alt+S to open the IDE settings and select Languages & Frameworks | Go | Go Modules. Select the Enable Go modules integration checkbox. Click OK.
The Go functionality in IntelliJ IDEA is supported by the Go plugin. The Go plugin provides support of all the features that are available in GoLand, the standalone IDE for Go developers.
Open an existing projectIn the Welcome to IntelliJ IDEA dialog, click Open. Alternatively, click File | Open. In the file browser, navigate to a folder with project files and click Open…. Click OK.
You can go to Tools | Create command line launcher... and then start GoLand from the command line, which will then inherit those environment variables and pass it to your run configurations.
According to the release notes of the new version of Gogland (EAP 16), the corresponding Go plugin can only be used with IntelliJ IDEA Ultimate from now on. This follows the pattern of providing support for different languages either via a plugin for IntelliJ IDEA Ultimate, or as a standalone IDE, such as PyCharm, Webstorm, or in this case, Goland.
For more details see the related blog post.
As an alternative solution that ultimately deals with the OP's problem, I would like to recommend the new IDE specifically for Go development, JetBrains Gogland. The setup is pretty much effortless, but in case you would have difficulties, there is already heplful documentation provided.
Check Gogland, might work for you.
There is also an official plugin that "has everything you could find in Gogland".
In case you are wondering what could be the difference between this new plugin, and the old go-lang-idea-plugin
, check the FAQ article with the explanation.
On OS X Mavericks, Go installed via Macports. Using Go plugin version 0.9.15 with IntelliJ IDEA.
I wanted to make the IDE understand the imports and provide autocomplete for any package I have installed in GOPATH. (I started creating an app using Revel and were missing the autocomplete...)
Here is what I did:
Hope this might be what you were looking for!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With