Pycharm Build Go development environment (Go language learning 1th)

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.
pycharm Build Go development environment is not too difficult, cough, the main oneself did not understand the configuration and use of Goroot and Gopath took a detour, deliberately recorded this process. Detailed introduction for the benefit of the public! (I am the Windows environment, Linux, MAC OS is similar)

1. Go Language SDK installation package download and install

First go to Golang official website (https://golang.org/dl/) Download the SDK, need to turn over the wall, the author uses is lantern (Https://github.com/getlantern ... )

Download the corresponding files for installation, the author chooses the installation directory is: F:\golang .

2. Goroot and GOPATH environment variable configuration

2.1 ConfigurationPATH

Select Advanced System configuration, environment variables, PATH add the bin path to the go on the end of the corresponding value, notice that there is a semicolon in front;

2.2 Configuring Goroot

In the System variables box, create a new GOROOT variable with a value of the installation path:

2.3 Configuring Gopath

GOPATHis the Go project directory, is the next directory to write the program, I put in E:\GoProjects , in the system variable box, the new GORATH variable:

2.4 The detection configuration is successful:

cmdCommand Window input to view the version of the Go go version go, in the input go env can view all the environment configuration information, focusing on our manual configuration of information:

If you see this information successfully, the configuration is successful!

3. Pycharm to go Plugin

Select File -> Setting... -> Plugins , selectBrowse repositories...

into the plug-In search interface, enter in the input box go , select the second item, Ann turn a bit long, may fail, try more than a few times OK.

4. New Project Test Run

Be sure to GOPATH create a new project, the process and other programs are the same, not repeat, in the Setting... configuration GO of the SDK path:

New Go file: hello.go , Edit code:

package mainimport "fmt"func main(){    fmt.Printf("hello world\n")}

Compile and run: right-clickRun 'go run hello.go'

Congratulations on the Go Programming journey, Happy coding!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.