Go the next day

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

Read the "Go" note https://github.com/Unknwon/the-way-to-go_ZH_CN

The second chapter is about the go installation and operating environment, I have written before Linux go installed, Windows and Mac installation is not written down, its environment variable meaning is worth noting

$GOROOT indicates where Go is installed on your PC, and it's usually the $HOME/go same value, and you can install it somewhere else, of course.

$GOARCH represents the processor architecture of the target machine, and its value can be 386,amd64 or arm.

$GOOS represents the operating system of the target machine, and its value can be darwin,freebsd,linux or windows

$GOBIN indicates where the compiler and linker are installed, by default $GOROOT/bin , if you are using Go 1.0.3 and later versions, you can normally set its value to NULL, and Go will use the default values mentioned earlier.

Go installation directory and its role can be understood (the following is the directory under window):

\ bin contains executable files, such as: Compiler, Go tool

\docContains sample programs, code tools, local documents, etc.

\includeContains a/C + + header file

\libInclude document templates

\miscContains examples of configuration files and cgo that support the Go editor

\pkg\os_archThe object file () of the package that contains the standard library .a

\srcInclude source code build script

\src\cmdCompiler and command line scripts with Go and C

\src\lib9\src\libbio \src\libmach contains C files

src\pkgFull source code for packages containing Go standard library (go is an open source language)

The third chapter is about the editor and integrated development tools and other tools, I think liteide is very useful, but take a good look at this chapter is also a harvest

Like what:

fmt.Printfuse the following specifier in to print information about the variable:

%+vPrint full information about an instance that includes a field

%#vPrint full information for instances that include fields and qualified type names

%TPrint a full description of a type

GOFMT and Godoc applications, very powerful tools

Some examples of commands:

Gofmt–w format and rewrite the file, you can specify a file, *.go you can rewrite a lot of files at once, you can also specify a directory, format all the go files in that directory

Gofmt-r "(a)-a" –w *.go before formatting can be replaced by noon replace "original content, replace content"

The Go Doc package gets the documentation comments for the packages, for example: go doc fmt godoc A document comment that uses the generated package is displayed fmt .

go doc package/subpackageGets the document comment for the child package, for example: go doc container/list .

go doc package functionGets the document comment for a function in a package, for example: go doc fmt Printf displays fmt.Printf() instructions for use.

The godoc-http=:6060 command, which provides a page that the browsing server can access on port 6060,

Go to C and C + + calls, to tell the truth, temporarily did not see, want to use the time, self-write some code, use will deepen the impression it

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.