From ba02a044f3aac725d0c04f421348313fa3cb6590 Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Sat, 27 Sep 2014 11:56:54 -0700 Subject: doc/faq: update for 1.4 LGTM=iant R=golang-codereviews, bradfitz, iant CC=golang-codereviews https://codereview.appspot.com/150190043 --- doc/go_faq.html | 53 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/doc/go_faq.html b/doc/go_faq.html index 4e90d3907..5813e1d04 100644 --- a/doc/go_faq.html +++ b/doc/go_faq.html @@ -889,6 +889,11 @@ type is generic; if you care about how many bits an integer holds, Go encourages you to be explicit.

+

+A blog post, title Constants, +explores this topic in more detail. +

+

Why are maps built in?

@@ -971,7 +976,7 @@ It is a handy reference for people doing code reviews for Go projects. How do I submit patches to the Go libraries?

-The library sources are in go/src. +The library sources are in the src directory of the repository. If you want to make a significant change, please discuss on the mailing list before embarking.

@@ -1590,30 +1595,40 @@ and uses a variant of the Plan 9 loader to generate ELF/Mach-O/PE binaries.

-We considered writing gc, the original Go compiler, in Go itself but +We considered using LLVM for gc but we felt it was too large and +slow to meet our performance goals. +

+ +

+We also considered writing gc, the original Go compiler, in Go itself but elected not to do so because of the difficulties of bootstrapping and especially of open source distribution—you'd need a Go compiler to set up a Go environment. Gccgo, which came later, makes it possible to -consider writing a compiler in Go, which might well happen. -(Go would be a -fine language in which to implement a compiler; a native lexer and -parser are already available in the go package -and a type checker is in the works.) +consider writing a compiler in Go. +A plan to do that by machine translation of the existing compiler is under development. +A separate document +explains the reason for this approach.

-We also considered using LLVM for gc but we felt it was too large and -slow to meet our performance goals. +That plan aside, +Go is a +fine language in which to implement a self-hosting compiler: a native lexer and +parser are already available in the go package +and a separate type checking +package +has also been written.

How is the run-time support implemented?

-Again due to bootstrapping issues, the run-time code is mostly in C (with a -tiny bit of assembler) although Go is capable of implementing most of -it now. Gccgo's run-time support uses glibc. -Gc uses a custom library to keep the footprint under +Again due to bootstrapping issues, the run-time code was originally written mostly in C (with a +tiny bit of assembler) although much of it has been translated to Go since then +and one day all of it might be (except for the assembler bits). +Gccgo's run-time support uses glibc. +Gc uses a custom C library to keep the footprint under control; it is compiled with a version of the Plan 9 C compiler that supports resizable stacks for goroutines. @@ -1637,8 +1652,8 @@ A simple C "hello, world" program compiled and linked statically using gcc on Linux is around 750 kB, including an implementation of printf. An equivalent Go program using fmt.Printf -is around 1.2 MB, but -that includes more powerful run-time support. +is around 1.9 MB, but +that includes more powerful run-time support and type information.

@@ -1695,6 +1710,14 @@ func main() { } +

+Nowadays, most Go programmers use a tool, +goimports, +which automatically rewrites a Go source file to have the correct imports, +eliminating the unused imports issue in practice. +This program is easily connected to most editors to run automatically when a Go source file is written. +

+

Performance

-- cgit v1.2.1