This page summarizes the changes between official stable releases of Go. Between releases we issue less stable weekly snapshots. The weekly snapshot history contains more detail, and the Mercurial change log has full details.

To update to a specific release, use:

hg pull
hg update release.rNN

r60 (released 2011/09/07)

The r60 release corresponds to weekly.2011-08-17. This section highlights the most significant changes in this release. For a more detailed summary, see the weekly release notes. For complete information, see the Mercurial change list.

Language

An "else" block is now required to have braces except if the body of the "else" is another "if". Since gofmt always puts those braces in anyway, gofmt-formatted programs will not be affected. To fix other programs, run gofmt.

Packages

Package http's URL parsing and query escaping code (such as ParseURL and URLEscape) has been moved to the new url package, with several simplifications to the names. Client code can be updated automatically with gofix.

Package image has had significant changes made to the Pix field of struct types such as image.RGBA and image.NRGBA. The image.Image interface type has not changed, though, and you should not need to change your code if you don't explicitly refer to Pix fields. For example, if you decode a number of images using the image/jpeg package, compose them using image/draw, and then encode the result using image/png, then your code should still work as before. If your code does refer to Pix fields see the weekly.2011-07-19 snapshot notes for how to update your code.

Package template has been replaced with a new templating package (formerly exp/template). The original template package is still available as old/template. The old/template package is deprecated and will be removed. The Go tree has been updated to use the new template package. We encourage users of the old template package to switch to the new one. Code that uses template or exp/template will need to change its import lines to "old/template" or "template", respectively.

Tools

Goinstall now uses a new tag selection scheme. When downloading or updating, goinstall looks for a tag or branch with the "go." prefix that corresponds to the local Go version. For Go release.r58 it looks for go.r58. For weekly.2011-06-03 it looks for go.weekly.2011-06-03. If the specific go.X tag or branch is not found, it chooses the closest earlier version. If an appropriate tag or branch is found, goinstall uses that version of the code. Otherwise it uses the default version selected by the version control system. Library authors are encouraged to use the appropriate tag or branch names in their repositories to make their libraries more accessible.

r59 (released 2011/08/01)

The r59 release corresponds to weekly.2011-07-07. This section highlights the most significant changes in this release. For a more detailed summary, see the weekly release notes. For complete information, see the Mercurial change list.

Language

This release includes a language change that restricts the use of goto. In essence, a goto statement outside a block cannot jump to a label inside that block. Your code may require changes if it uses goto. See this changeset for how the new rule affected the Go tree.

Packages

As usual, gofix will handle the bulk of the rewrites necessary for these changes to package APIs.

Package http has a new FileSystem interface that provides access to files. The FileServer helper now takes a FileSystem argument instead of an explicit file system root. By implementing your own FileSystem you can use the FileServer to serve arbitrary data.

Package os's ErrorString type has been hidden. Most uses of os.ErrorString can be replaced with os.NewError.

Package reflect supports a new struct tag scheme that enables sharing of struct tags between multiple packages. In this scheme, the tags must be of the form:

	`key:"value" key2:"value2"`

The StructField type's Tag field now has type StructTag, which has a Get method. Clients of json and xml will need to be updated. Code that says

	type T struct {
		X int "name"
	}

should become

	type T struct {
		X int `json:"name"`  // or `xml:"name"`
	}

Use govet to identify struct tags that need to be changed to use the new syntax.

Package sort's IntArray type has been renamed to IntSlice, and similarly for Float64Slice and StringSlice.

Package strings's Split function has itself been split into Split and SplitN. SplitN is the same as the old Split. The new Split is equivalent to SplitN with a final argument of -1.

Package image/draw's Draw function now takes an additional argument, a compositing operator. If in doubt, use draw.Over.

Tools

Goinstall now installs packages and commands from arbitrary remote repositories (not just Google Code, Github, and so on). See the goinstall documentation for details.

r58 (released 2011/06/29)

The r58 release corresponds to weekly.2011-06-09 with additional bug fixes. This section highlights the most significant changes in this release. For a more detailed summary, see the weekly release notes. For complete information, see the Mercurial change list.

Language

This release fixes a use of uninitialized memory in programs that misuse goto.

Packages

As usual, gofix will handle the bulk of the rewrites necessary for these changes to package APIs.

Package http drops the finalURL return value from the Client.Get method. The value is now available via the new Request field on http.Response. Most instances of the type map[string][]string in have been replaced with the new Values type.

Package exec has been redesigned with a more convenient and succinct API.

Package strconv's Quote function now escapes only those Unicode code points not classified as printable by unicode.IsPrint. Previously Quote would escape all non-ASCII characters. This also affects the fmt package's "%q" formatting directive. The previous quoting behavior is still available via strconv's new QuoteToASCII function.

Package os/signal's Signal and UnixSignal types have been moved to the os package.

Package image/draw is the new name for exp/draw. The GUI-related code from exp/draw is now located in the exp/gui package.

Tools

Goinstall now observes the GOPATH environment variable to build and install your own code and external libraries outside of the Go tree (and avoid writing Makefiles).

Minor revisions

r58.1 adds build and runtime changes to make Go run on OS X 10.7 Lion.

r57 (released 2011/05/03)

The r57 release corresponds to weekly.2011-04-27 with additional bug fixes. This section highlights the most significant changes in this release. For a more detailed summary, see the weekly release notes. For complete information, see the Mercurial change list.

The new gofix tool finds Go programs that use old APIs and rewrites them to use newer ones. After you update to a new Go release, gofix helps make the necessary changes to your programs. Gofix will handle the http, os, and syscall package changes described below, and we will update the program to keep up with future changes to the libraries. Gofix can’t handle all situations perfectly, so read and test the changes it makes before committing them. See the gofix blog post for more information.

Language

Multiple assignment syntax replaces the closed function. The syntax for channel receives allows an optional second assigned value, a boolean value indicating whether the channel is closed. This code:

	v := <-ch
	if closed(ch) {
		// channel is closed
	}

should now be written as:

	v, ok := <-ch
	if !ok {
		// channel is closed
	}

Unused labels are now illegal, just as unused local variables are.

Packages

Package gob will now encode and decode values of types that implement the GobEncoder and GobDecoder interfaces. This allows types with unexported fields to transmit self-consistent descriptions; examples include big.Int and big.Rat.

Package http has been redesigned. For clients, there are new Client and Transport abstractions that give more control over HTTP details such as headers sent and redirections followed. These abstractions make it easy to implement custom clients that add functionality such as OAuth2. For servers, ResponseWriter has dropped its non-essential methods. The Hijack and Flush methods are no longer required; code can test for them by checking whether a specific value implements Hijacker or Flusher. The RemoteAddr and UsingTLS methods are replaced by Request's RemoteAddr and TLS fields. The SetHeader method is replaced by a Header method; its result, of type Header, implements Set and other methods.

Package net drops the laddr argument from Dial and drops the cname return value from LookupHost. The implementation now uses cgo to implement network name lookups using the C library getaddrinfo(3) function when possible. This ensures that Go and C programs resolve names the same way and also avoids the OS X application-level firewall.

Package os introduces simplified Open and Create functions. The original Open is now available as OpenFile. The final three arguments to StartProcess have been replaced by a pointer to a ProcAttr.

Package reflect has been redesigned. Type is now an interface that implements all the possible type methods. Instead of a type switch on a Type t, switch on t.Kind(). Value is now a struct value that implements all the possible value methods. Instead of a type switch on a Value v, switch on v.Kind(). Typeof and NewValue are now called TypeOf and ValueOf To create a writable Value, use New(t).Elem() instead of Zero(t). See the change description for the full details. The new API allows a more efficient implementation of Value that avoids many of the allocations required by the previous API.

Remember that gofix will handle the bulk of the rewrites necessary for these changes to package APIs.

Tools

Gofix, a new command, is described above.

Gotest is now a Go program instead of a shell script. The new -test.short flag in combination with package testing's Short function allows you to write tests that can be run in normal or “short” mode; all.bash runs tests in short mode to reduce installation time. The Makefiles know about the flag: use make testshort.

The run-time support now implements CPU and memory profiling. Gotest's new -test.cpuprofile and -test.memprofile flags make it easy to profile tests. To add profiling to your web server, see the http/pprof documentation. For other uses, see the runtime/pprof documentation.

Minor revisions

r57.1 fixes a nil pointer dereference in http.FormFile.

r57.2 fixes a use of uninitialized memory in programs that misuse goto.

r56 (released 2011/03/16)

The r56 release was the first stable release and corresponds to weekly.2011-03-07.1. The numbering starts at 56 because before this release, what we now consider weekly snapshots were called releases.