Go to the first lesson

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Here is the tutorial for learning: http://docscn.studygolang.com/doc/code.html

Take notes based on download installation to code execution

Install the download configuration environment variable:

Follow the tutorials to install the download, and then configure the Goroot and Gopath environment variables in/etc/profile.

Let's talk about go. When installing the download configuration environment variable, unlike C and Java, he only Goroot and gopath two environment variables. Goroot is the basic environment variable, which is the directory where the official bin is located. And Gopath is the directory where personal space (which can be seen as workspace) resides.

Export Goroot and Gopath in the/etc/profile file so that the basic GO command can be invoked by defining the goroot, including go install,go build,go test,go env, etc. By Gopath, you can call yourself to compile the installed program.

For example: I wrote a hello.go code, and I installed it with go install to $gopath/bin. Because I export this ¥gopath/bin directory in profile, I can use the Hello command everywhere. So: Gopath is a directory to store the packages you need to call, the source code you need to write, and the programs you need to run.

-Not to be continued-

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

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.