Features of the Go language

Source: Internet
Author: User
about feature lossFor ease of design, function overloading and operator overloading are not supported in order to avoid some bugs and confusion in C + + development, the implicit conversion of the go language is not supported in another way to implement object-oriented design abandon class and type inheritance although features similar variant types can be implemented in terms of the use of interfaces, However, the variant type is not supported natively does not support dynamic load code does not support the dynamic link library does not support generics through recover and panic to replace the exception mechanism does not support assertion does not support static variables The Go compiler knowledge

There are currently 2 versions of compilers: The Go native compiler GC and the non-native compiler Gccgo compiler, where the GC version of the compiler has been ported to the Windows platform and integrated in the main release, you can also install MinGW to use the GCC compiler under the Windows platform. Both compilers work in the form of a single channel.

The compiler GC compiles quickly, but the compiled program cannot use GCC links, but gccgo instead environment variables for Go

 $GOROOT indicates where Go is installed on your PC, its value is generally $HOME/go, and of course you can install it somewhere else $GOARCH represents the processor architecture of the target machine, which can be a value of 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 it is $GOROOT/bin, if you are using Go 1.0.3 and later, in general you can set its value to null and Go will use the default values mentioned earlier.

The Go compiler supports cross-compiling, meaning that you can build applications running on a single machine that run on different operating systems and processor architectures, meaning that the machine that writes the source code can have a completely different feature (operating system and processor architecture) than the target machine.

To differentiate between the local machine and the target machine, you can use the $GOHOSTOS and $GOHOSTARCH to set the parameters of the target machine, which are used only when cross-compiling, and if you do not display the settings, their values will be the same as the local machine ($GOOS and $GOARCH). $GOPATH defaults to the same values as $GOROOT, but from the Go 1.1 version you have to change to a different path.

It can contain multiple paths that contain the Go language source files, package files, and executable files, which must contain three specified directories: SRC, pkg, and bin, which are used to store source files, package files, and executables, respectively.

$GOARM specifically for ARM architecture-based processors, the value can be 5 or 6, which defaults to 6. $GOMAXPROCS is used to set the number of processors and the number of cores that the application can use. 
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.