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.