This is a created article in which the information may have evolved or changed.
Go Plugin
First make sure the Go plugin is installed: Files-settings-plugins-browse repositories, search go, then install
Set up the project SDK
You need to set a Go SDK for your open project to tell if this is a go project, if not set please set: File-project Structure, choose Go SDK, if not added on the new one
After Setup, follow the prompts reload
Run Package
If you run a single file, such as: Main.go, the code used in other files defined functions, structs, etc., then the direct operation will be reported undefined error. At this point we need to run the entire package instead of a single file, run-edit the "+"-go application in the upper-left corner of the configurations-point, you might see something like this:
Give it a name, my project name is test, it runs a call "Run Test", run kind Select the package, then the package text box appears below, the project name, I am "test", because we set up the project SDK, So module it will automatically select our project name, if not set the project SDK, there will be no choice, always error.
Click OK, then click Run on the menu bar above to see if there is a "run ' Run Test '", "Debug ' Run Test '" option, if yes, congratulations:) happy Run and Debug ~ ~ ~