Go Language Primer to Mastery (i) Golang environment construction

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

Haha, the name up like those textbooks, the introduction to proficient, seemingly simple words, in fact, I can not master Golang or a little pressure, learning this language is also a personal interest, good, nonsense not much to say, into our subject.

A brief introduction to the Golang bar,go is a compiler developed by Google, can be parallel, and has a garbage collection function of the programming language, if you have a C language Foundation, then learning Go will be more easy, The go language is typically used for server programming. These concepts ha, read it again nothing is normal, roughly understand this is a language, and is Google Pro son, and can write server OK.

My personal habit is to learn a language, first set up a good environment, choose the IDE, write a HelloWorld say, the following start.

The next go from the Internet, generally is the type of EXE executable file or a compressed package, if the former, directly fool installation can, if the latter, decompression can be, we recommend that everyone in the installation and decompression in the root directory, my environment configuration is this:


Remember our path is D:\go, the path to the bin file is D:\go\bin (which will be used later)

After the installation of Go, but also to build environment variables, desktop right-click on the computer properties


Click Change settings and you'll see



In the environment variable we have to do three things, first of all in the user variable path to add the Go installation path, and then add in the system variables:


Gopath field: This path is used to store the code you write later

Goroot field: Get the go language up and running

Once added, open cmd, enter go version, and display the following information indicating that you have successfully installed go:



The beginning of many languages is HelloWorld, this great tradition can not put me here broken, nonsense said, on the code:

Package Main

Import "FMT"
Func Main () {
Fmt. Printf ("Hello, world\n")
}

The code is simple, just create a new TXT document and copy it in, and then change the suffix to go (don't tell me you won't change the suffix name)

Then execute in cmd:


It's done, great HelloWorld!

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.