Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Google's Golang an interpreter or compiler?

Tags:

gcc

go

system

People also ask

Is Go natively compiled?

Go is Fast Because Go is compiled to machine code, it will naturally outperform languages that are interpreted or have virtual runtimes.

Does Golang use compiler or interpreter?

Golang is a compiler-based language, it can easily be compiled on the development computer for any targeted system such as linux and mac. A golang project when have compiled turns to a self-sufficient executable and can be ran on the targeted system without anything additional.

Is Golang compiler written in Go?

Golang was formerly written in C but is now written in Go itself. As of December 2013, the Go team announced their transitioning of the compiler to Go. Since February 2015 the implementation of C has been deleted and the compiler is now self-hosting, with the new compiler first introduced in Go 1.5.

What compiler does Golang use?

There are three Go compiler implementations supported by the Go team. These are gc , the default compiler, gccgo , which uses the GCC back end, and a somewhat less mature gollvm , which uses the LLVM infrastructure.


This is really a compiler (in fact it embbeds 2 compilers) and it makes totally self sufficient executables. You don't need any supplementary library or any kind of runtime to execute it on your server. You just have to have it compiled for your target computer architecture.

From the documentation :

There are two official Go compiler tool chains. This document focuses on the gc Go compiler and tools (6g, 8g etc.). For information on how to work on gccgo, a more traditional compiler using the GCC back end, see Setting up and using gccgo.

The Go compilers support three instruction sets. There are important differences in the quality of the compilers for the different architectures.

amd64 (a.k.a. x86-64); 6g,6l,6c,6a A mature implementation. The compiler has an effective optimizer (registerizer) and generates good code (although gccgo can do noticeably better sometimes).

386 (a.k.a. x86 or x86-32); 8g,8l,8c,8a Comparable to the amd64 port.

arm (a.k.a. ARM); 5g,5l,5c,5a Supports only Linux binaries. Less widely used than the other ports and therefore not as thoroughly tested.

Except for things like low-level operating system interface code, the run-time support is the same in all ports and includes a mark-and-sweep garbage collector, efficient array and string slicing, and support for efficient goroutines, such as stacks that grow and shrink on demand.

The compilers can target the FreeBSD, Linux, NetBSD, OpenBSD, OS X (Darwin), and Windows operating systems. The full set of supported combinations is listed in the discussion of environment variables below.

On a server you'll usually target the amd64 platform.

Note that Go is well known for the speed of compilation. When deploying my server programs, I don't build for the different platforms on the development computer : I deploy the sources and I compile directly on the production servers. Since Go1 I never had a code compiling on one platform and not compiling on the other ones.

On Windows I had no problem in making an exe on my development computer and simply sending this exe to people never having installed anything Go related.