Golang Learning-A brief introduction to the first Golang and installation, deployment in the Windows environment

Source: Internet
Author: User

Preface

This is my blog park the first article, write not in place, I hope you guys understand.

I have been engaged. NET development work, recently in learning Golang, so think about the process of learning before not how to properly record the learning process. Deeply sorry!

Now will golang the learning bit record share, nonsense to this, enter the text below.

Note: The development platform for this article and all future content is: Windows

Development tools: JetBrains Gogland x64 version

Official: https://www.jetbrains.com/go/download/#section =windows

The Golang version is: Go1.8.3

Official: https://golang.org/dl/(requires FQ to access)

Golang Introduction

The go language is the second open source programming language that Google released in 2009. This is a new programming language that can reduce the complexity of your code without losing application performance.

The go language is highly expressive, concise, clear and efficient. Thanks to its concurrency mechanism, programs written in it can make very efficient use of multicore and networked computers, and its novel type system makes the program structure flexible and modular. The Go code compiles into machine code not only very quickly, but also has a handy garbage collection mechanism and a powerful runtime reflection mechanism. It is a fast, static type of compiled language that feels like a dynamic type of interpreted language.

Golang Installation

After downloading the Golang installation package, click Install, change the installation directory to: D:\\go (the default installation directory is: C:\\go), and then click Next directly to finish. So the basic installation is complete.

After the installation is complete, you need to configure the system environment variables.

Right-click My Computer----> Properties----> Advanced system settings----> Environment variables such as:

Golang a Goroot variable is automatically added to the system variable after the installation is complete, which is the Golang installation directory. A D:\Go\bin variable is also automatically added to the path variable, which is the bin directory under the Golang installation directory. (These two environment variables do not need to be added manually, the installation of Golang will be automatically added to the system variables)

Next we will set up the working directory of the Golang, which is used to store our project directory and various third-party package files.

Find the project Tray first we'll use the D disk here, the new folder in the D-disk goworks, in the Goworks in the new three subdirectories: src (this directory is used to store project source code) PKG (this directory is used to store the project compiled build file) Bin ( This directory is used to store executable files generated after compilation)

Once the folders are new, we will add the Gopath variable manually to the system environment variable with the value: D:\GoWorks. Locate the path variable and click the Edit button to add D:\GoWorks\bin

The above is the entire Golang installation configuration process, after all the configuration is complete, open the command line (Windows key +r, input cmd Click OK), enter the command go version after the display of Golang versions are configured successfully, such as:

IDE Configuration

After the Gogland download is complete, click Install, the installation address defaults to C drive (can be installed to other drive characters according to personal needs), the installation process can choose 32-bit and 64-bit desktop shortcuts, and. Go check (the author chooses 64 bits,. Go is checked as selected), and the configuration is done directly next Until the Finish is installed.

After the installation is complete, open the tool, the first open will pop up the settings screen, choose not to import settings, click OK such as:

After clicking OK, enter the Gogland welcome page such as:

First we first configure the tool's project default path, click Configure----> Settings----> Go----> Gopath, click the right + sign, add D:\GoWorks, click OK, so our project path is The setup is complete.

Golang first item (Magnum Hello Wrold)

Click New Project to create the item (Gogland theme changes, Configure----> Settings----> Appearance & Behavior----> Appearance---- ; UI Options----> Theme:darcula to Black Theme)

New file main Click file----> New----> Go file

Write code:

Package Mainimport "FMT" Func Main ()  {fmt. Print ("Hello world!")}

To run the code:

  

Shows the Hello world! Then run successfully!

--------------------------------------------------------------------------------------------------------End-- -------------------------------------------------------------------------------------------------------

Golang Learning-A brief introduction to the first Golang and installation, deployment in a Windows environment

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.