The State of Go
Where we are in May 2015
27 May 2015
Andrew Gerrand
Go 1.5新特性:支持Android,實驗性支持iOS(演講幻燈)The State of GoWhere we are in May 201527 May 2015Andrew Gerrand The State of the State of GoI gave a similar talk at FOSDEM in February 2015. This talk builds on that talk. Go 1.5Release scheduleGo 1.5 is scheduled for release in August 2015. The major work is done.We are now in the "feature freeze" period. From C to Go The Machine-translated Machine-translated New Go 1.5 has no C code in the tool chain or runtime. Rob will talk more about this. Concurrent Garbage CollectorGoals:
Concurrent GC trade-offsThe new GC spends a little more memory and CPU timein exchange for significantly shorter GC pause times. Better concurrency performance Setting Better performance executing goroutines in parallel: Better perfomance switching between goroutines in serial: Better concurrency performance (bottom line)Better performance under practical workloads: And our benchmark suite: Go 1.5 overall performance![]() Go 1.5 overall performance (continued)![]() OS/Arch ports Go 1.5 supports some new
And retires some old ones: DragonflyBSD dropped support for i386; Apple no longer supports OS X 10.6 (no security updates since 2013);the Go port to OS X 10.6 (Snow Leopard) is no longer actively maintained. Shared librariesGo 1.5 can produce Go shared libraries that can be consumed by Go programs. Build the standard library as shared libraries: $ go install -buildmode=shared std
Build a "Hello, world" program that links against the shared libraries: $ go build -linkshared hello.go $ ls -l hello -rwxr-xr-x 1 adg adg 13926 May 26 02:13 hello Go 1.5 can also build Go programs as C archive files (for static linking)or shared libraries (for dynamic linking) that can be consumed by C programs. (Demo) Go programs as C librariesGiven a package: package p // import "p" import "C" //export Foo func Foo() int32 { return 42 } And a main package that imports it: package main // import "m" import _ "p" func main() {} // ignored You can build an archive file that can be linked into a C program: $ go build -buildmode=c-archive m $ ls $GOPATH/pkg/linux_amd64 m.a p.a p.h A minor language changeYou may now omit the key type from a map literal. This map literal m := map[Point]string{ Point{29.935523, 52.891566}: "Persepolis", Point{-25.352594, 131.034361}: "Uluru", Point{37.422455, -122.084306}: "Googleplex", } may now be written as: m := map[Point]string{ {29.935523, 52.891566}: "Persepolis", {-25.352594, 131.034361}: "Uluru", {37.422455, -122.084306}: "Googleplex", } "go doc" The with a much improved command-line interface: $ go doc zip.reader package zip // import "archive/zip" type Reader struct { File []*File Comment string // Has unexported fields. } func NewReader(r io.ReaderAt, size int64) (*Reader, error) $ cd $GOROOT/src/archive/zip $ go doc reader # same output as above (Demo) Execution tracingThe new execution tracer collects data to produce diagrams of process execution. Front end is the Android/Chrome trace-viewer. ( github.com/google/trace-viewer ) Analysis and Refactoring ToolsWe have been working on tools for analyzing and manipulating Go source code. Analysis tools:
Refactoring tools:
Builder infrastructureWe have been hacking away at our continuous build infrastructure. Now running Linux, Windows, OS X, FreeBSD, OpenBSD, and Plan 9 builderson Google Compute Engine. Spin up builders to do work, spin up many in parallel.Gives us results much faster. Sharding of tests on slower platforms (eg, ARM). Trybots test pending changes. (Demo) MobileGo 1.5 provides support for Android and experimental support for iOS. The gomobile tool The (It only supports Android right now.) To install the Android compiler toolchain: $ gomobile init
To build an Android APK and install on a device: $ gomobile install
To build a shared library for an Android or iOS app: $ gomobile bind
(Demo) Go community events
And more to be announced. Thank youAndrew Gerrand |
|