From f154da9e12608589e8d5f0508f908a0c3e88a1bb Mon Sep 17 00:00:00 2001
From: Tianon Gravi
-Other examples include the Vitess
+Other examples include the Vitess
system for large-scale SQL installations and Google's download server, dl.google.com
,
which delivers Chrome binaries and other large installables such as apt-get
packages.
@@ -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. +
+@@ -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/pkg
.
+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.
-The Go project, hosted by Google Code at -code.google.com/p/go, -uses Mercurial as its version control system. -When the project launched, -Google Code supported only Subversion and Mercurial. -Mercurial was a better choice because of its plugin mechanism -that allowed us to create the "codereview" plugin to connect -the project to the excellent code review tools at -codereview.appspot.com. -
- --Programmers who work -with the Go project's source rather than release downloads sometimes -ask for the project to switch to git. -That would be possible, but it would be a lot of work and -would also require reimplementing the codereview plugin. -Given that Mercurial works today, with code review support, -combined with the Go project's mostly linear, non-branching use of -version control, a switch to git doesn't seem worthwhile. -
-@@ -1351,7 +1330,7 @@ to speed it up.
-Go's goroutine scheduler is not as good as it needs to be. In future, it
+Go's goroutine scheduler is not as good as it needs to be. In the future, it
should recognize such cases and optimize its use of OS threads. For now,
GOMAXPROCS
should be set on a per-application basis.
fmt
package.
+the formatting tests for the fmt
package.
@@ -1590,30 +1569,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.
-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 +1626,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.
The presence of an unused variable may indicate a bug, while -unused imports just slow down compilation. -Accumulate enough unused imports in your code tree and -things can get very slow. -For these reasons, Go allows neither. +unused imports just slow down compilation, +an effect that can become substantial as a program accumulates +code and programmers over time. +For these reasons, Go refuses to compile programs with unused +variables or imports, +trading short-term convenience for long-term build speed and +program clarity.
-When developing code, it's common to create these situations +Still, when developing code, it's common to create these situations temporarily and it can be annoying to have to edit them out before the program will compile.
@@ -1695,6 +1687,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. +
+