The State of the Gopher (Oct)
10 October 2014
Brad Fitzpatrick
Gopher, Google
Brad Fitzpatrick
Gopher, Google
gc
and gccgo
gc
: "Go compiler", based originally on Plan 9's C compiler. The main Go compiler.GC
: "Garbage Collector"With gccgo, more.
11// before Go 1: latLong[storeID] = LatLong{}, false name[userID] = "", false // new: delete(name, userID)
pkg net/http, const StatusOK = 200 pkg net/http, const StatusOK ideal-int pkg net/http, type RoundTripper interface { RoundTrip } pkg net/http, type Server struct, TLSConfig *tls.Config pkg net/http, var DefaultServeMux *ServeMux pkg time, method (*Timer) Reset(Duration) bool pkg unicode/utf8, func ValidRune(int32) bool
go
tool (get, build, test, ...)type S struct { once sync.Once; ... } func (s *S) init() { ... } func (s *S) Foo() { s.once.Do(s.init)
func abs(n int) int { switch { case n < 0: return -n default: return n } }
Conservative GC: if it "looks like" a pointer, treat it like one.
[ ptr? ] [ ptr? ] [ ptr? ] [ ptr? ] [ ptr? ] [ ptr? ] [ ptr? ] [ ptr? ] [ ptr? ] [ byte slice (skipped in Go 1.0) ] [ ptr? ] [ ptr? ] [ ptr? ] [ ptr? ] [ ptr? ] [ ptr? ] [ ptr? ] [ ptr? ]
Terrible for 32-bit (e.g. ARM) computers: many integers look like pointers.
Precise GC:
[ int ] [ ptr ] [ string ] [ byte slice ] [ int ] [ t f t f ] [ ptr ] [ int ] [ float64 ] [ ptr ]
Requires knowing what every position in memory actually is.
s := make([]byte, 10, 20) foo(s[10:12:15]) func foo(s []byte) { fmt.Println(len(s), cap(s)) }
golang-nuts@
(1450 → 14134), -dev
(37 → 2152)Go: the emerging language of cloud infrastructure
Tooling begets better tooling!
runtime
conversion from C to Go: maps, channels, interfaces, type checks, println, defer, panic, etc.Didn't make Go 1.4:
cmd/link
: linker rewrite in Gocmd/asm
: assembler rewrite in Goeg
, gorename
, etc8g
, 5g
, 6g
, 9g
See rsc's GopherCon slides, notes, video.
42
Who knows.
Find out next year at dotGo Paris 2015!
net/http
goimports
, eg
, gorename
, oracle
, ...All checking & improving each other:
And all three written in Go, use go/parser
, go/types
, etc.
We can't wait to join them.