Go Learning notes: Golang profile

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

The main features of the Go language

Automatic garbage collection richer built-in type functions multiple return value error handling anonymous function and closure type and interface concurrent programming reflection language interactivity high performance/efficient development


Installation

Installation Instructions Address

Package Download Address

Confirm that the installation is successful

Go version//view versions


environment variable Settings

Overall directory structure

With the package organization, only the package name, called Main, can contain the main function

One program has and only one main package

Importing other non-main packages with the Import keyword

bin/|-mathapppkg/|-platform name |-xxx.asrc/|-Mathapp |-main.go


Helloworld

The package main//declaration file Packageimport {"FMT"//import package, cannot contain unused packages, otherwise the compilation error}func main () {//Ingress function, no parameter no return value FMT. Println ("Hello World")}
Run the $go run Hello.go$go build Hello.go$./hello


Go command

Use the command line to view

Go helpgo build compile Go clean Remove compile build file from current source package Go FMT format code go get dynamic Get Remote code package go install Generate result file and compile results one to $gopath/pkg or $gopath/b Ingo Test run test executable file Go Doc godoc-http=:8080 view document go fix fix previous old version code to new release go version view current version Go ENV view current GO environment variable go list List all currently installed Packagego run to compile and run the Go Language program


Debugging

Debugging with GDB, the inside of the go language has built-in

Listbreakdeletebacktraceinfoprintwhatisnextcontinueset variable


Editor settings

Vim

Other supplements

Comments

Single-ROW/*-----*/Multiline

Import multiple Packages

Import ("FMT" "OS")

Calling the package in the ground function

<packageName>.<Function>



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.