Method: 1. Download and install the go language; 2. Configure the environment variables of go; 3. Open the idea, select "File"-"settings"-"Plugins", search for go, and click "install". Restart; 4. Create a project, select go, and configure GOROO and GOPATH.
The operating environment of this tutorial: Windows 10 system, GO 1.11.2, Dell G3 computer.
Official website: https://golang.google.cn/
Download (I am win10, I am used to it): https://golang.google.cn/dl/
Here I choose the one in the red box, then select the path you want, download and install it.
Right-click this computer, select Advanced System Settings, select environment variables, double-click Path in the environment variables, and fill in your go language path, as shown in the figure:
cmd, then run go version, no error is reported, indicating success
Select File-》settings-》Plugins-》Search for go, Then install, after restarting
Create project, select go,
Then in File->settings you will see Go
in Languages&FrameworksThen configure GOROO and GOPATH, as shown in the figure
Then you’re done!
package main import "fmt" func add(a int, b int) int { var sum int = a+b return sum } func main(){ fmt.Print("hello world!!",add(100,299)) }
Run, OK! Hope it helps you!
Recommended learning: Golang tutorial
The above is the detailed content of How to configure the environment for running go language in idea. For more information, please follow other related articles on the PHP Chinese website!