Home  >  Article  >  Backend Development  >  How to configure the environment for running go language in idea

How to configure the environment for running go language in idea

青灯夜游
青灯夜游Original
2021-06-04 14:17:3811873browse

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.

How to configure the environment for running go language in idea

The operating environment of this tutorial: Windows 10 system, GO 1.11.2, Dell G3 computer.

You must have a go language setting environment at the beginning

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.

Configure environment variables

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

Configure idea

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&Frameworks

Then configure GOROO and GOPATH, as shown in the figure

Then you’re done!

Test

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn