Go Language Environment Installation

Source: Internet
Author: User

When you're sure you want to learn a technology, the first thing you need to do is install the environment, the go language is easy to install, and the dots are expanded

Language installation

  • Download the binary package of the corresponding platform for installation
  • Linux,mac installed under the installation tool
  • Source code compilation installation, need to rely on some tools, gcc,make, etc.

Environment variable Installation

There are two important environment variables in the go language, Goroot,gopath,goroot is the directory of Go Language installation directory and language built-in package, Gopath is the work space of Go language development, there are three directories in this directory, Src,pkg,bin, SRC is the source of the path of storage, Pkg is the compilation of the connection library file, bin is compiled executable file.

This step is critical when starting the development tour of the Go language, where the reference path to the package in the go language is particularly important. A reference to a third-party package that is loaded at compile time through the $gopath/src+ reference path.

Third-party Package acquisition

The go language provides a powerful built-in package through which we can develop a number of projects, of course, in project development, we also inseparable from the third-party package reference, go language provides a pull third-party package tool go get, This command is mainly in GitHub or Google's code management library git clone, or Hg way to pull the source code, and execute install compile build Dynamic Connection library. This references the library in your code.

Code compilation

Although the go language is a compiled language, its compilation is very efficient, the go language tool built into a go build command to build, go install, you can post the compiled results to the corresponding directory. In addition, go also provides an efficient development of the compile command, go run, We can develop efficiently as an explanatory language.

Editor

The go language has strict code style requirements, and the Go FMT command can unify the code into a style. This also facilitates reading different code.

Editor, each their own, I prefer to sublime, by installing the Go plugin can open the development of the go language.

Summarize

The above content, just a simple introduction of the go installation of some basic content, there are some advanced content, in the future of the article gradually improved.

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.