How to make PyCharm work with the Go plugin?
Solution 1
You can get most of the way there with External Tools. There is no way to replace the 'Run' button until the next version of the plug-in, per Issue #728.
To set up your external tools, go to PyCharm -> Preferences (command+,) -> Tools -> External Tools -> +
Fill in the form:
Hit OK. Use it from the menus:
Solution 2
Please use the latest release from Github releases https://github.com/go-lang-plugin-org/go-lang-idea-plugin/releases. It supports PyCharm 4.0.5+.
Solution 3
You can achieve it now with a Version 2016.1 or higher. I will give a complete guide, so the first steps would not be relevant for you. Also I write it using MacOS, so some names might be different. Go to
Preferences -> Plugins -> Browse Repositories -> Manage repositories
and insert https://plugins.jetbrains.com/plugins/alpha/5047
which is the plugin behind this repo (maintained by IntelliJ). Install that plugin.
After plugin is installed, create a .go
file. When you open it you will see a popup go project sdk is not defined
. Click on it and select your /usr/local/go
path.
A couple of helpful links:
warvariuc
An engineer who cares about what he does and how he does it.
Updated on June 05, 2022Comments
-
warvariuc about 2 years
I am using PyCharm 3.1.1 and I have installed the Go plugin for IntelliJ Idea. I did
export GOROOT=$(go env GOROOT)
to prevent PyCharm from complaining about missingGOROOT
environment variable.Now I was able to create a sample project, but the run command complains:
Error running untitled1.go: No Go Sdk defined for this project
On other sites I found that I should do something like:
Go to the
File -> Project Structure
and configure Go SDK by clicking+
button and selecting/usr/lib/go/
folder.But I don't have
File -> Project Structure
menu item.How to make PyCharm work with the Go plugin?
-
warvariuc about 10 yearsThe question is not about about
GOROOT
environment variable. It's about PyCharm vs IDEA -
Stuart Carnie almost 10 yearsWhy then does is the last statement in the article "How to make PyCharm work with Google Go language plugin?" and the title of the question is "Google Go language plugin with PyCharm"
-
warvariuc almost 10 yearsThe question was not about environment variables. It was how to set up Go SDK in PyCharm.