From: Rob Pike
+The Go compatibility document promises
+that programs written to the Go 1 language specification will continue to operate,
+and those promises are maintained.
+In the interest of firming up the specification, though, there are some
+details about some error cases that have been clarified.
+There is also some new language features.
+Changes to the language
-TODO
+Integer division by zero
@@ -31,6 +37,25 @@ func f(x int) int {
In Go 1.1, an integer division by constant zero is not a legal program, so it is a compile-time error.
+The definition of string and rune literals has been refined to exclude surrogate halves from the +set of valid Unicode code points. +See the Unicode section for more information. +
+ ++TODO +
+ ++TODO +
In the gc tool chain, the compilers and linkers now use the @@ -53,7 +78,11 @@ For example,
-The language allows the implementation to choose whether the int
type and uint
types are 32 or 64 bits. Previous Go implementations made int
and uint
32 bits on all systems. Both the gc and gccgo implementations (TODO: check that gccgo does) now make int
and uint
64 bits on 64-bit platforms such as AMD64/x86-64.
+The language allows the implementation to choose whether the int
type and
+uint
types are 32 or 64 bits. Previous Go implementations made int
+and uint
32 bits on all systems. Both the gc and gccgo implementations
+now make
+int
and uint
64 bits on 64-bit platforms such as AMD64/x86-64.
Among other things, this enables the allocation of slices with
more than 2 billion elements on 64-bit platforms.
Portable code intending 32-bit sign extension (yielding -1 on all systems) +
Portable code intending 32-bit sign extension (yielding -1
on all systems)
would instead say:
To make it possible to represent code points greater than 65535 in UTF-16, @@ -126,34 +155,46 @@ some editors add them as a kind of "magic number" identifying a UTF-8 encoded fi Updating: Most programs will be unaffected by the surrogate change. Programs that depend on the old behavior should be modified to avoid the issue. -The byte-order-mark change is strictly backwards- compatible. +The byte-order-mark change is strictly backwards-compatible.
-
-Due to the int and TODO: OTHER changes,
-the placement of function arguments on the stack has changed.
+Due to the change of the int
to 64 bits and some other changes,
+the arrangement of function arguments on the stack has changed in the gc tool chain.
Functions written in assembly will need to be revised at least
to adjust frame pointer offsets.
+TODO: Point to cmd/vet once it handles this. +
-The go
tool has acquired several improvements which are intended to improve the experience for new Go users.
Firstly, when compiling, testing, or running Go code, the go
tool will now give more detailed errors messages, including a list of paths searched, when a package cannot be located.
+
+The go
command has acquired several
+changes intended to improve the experience for new Go users.
+
+First, when compiling, testing, or running Go code, the go
command will now give more detailed error messages,
+including a list of paths searched, when a package cannot be located.
$ go build foo/quxx can't load package: package foo/quxx: cannot find package "foo/quxx" in any of: - /home/User/go/src/pkg/foo/quxx (from $GOROOT) - /home/User/src/foo/quxx (from $GOPATH) + /home/you/go/src/pkg/foo/quxx (from $GOROOT) + /home/you/src/foo/quxx (from $GOPATH)
-Secondly, the go get
command no longer allows $GOROOT
as the default destination when downloading package source. To use go get
command, a valid $GOPATH
is now required.
+Second, the go get
command no longer allows $GOROOT
+as the default destination when downloading package source.
+To use the go get
+command, a valid $GOPATH
is now required.
@@ -161,7 +202,9 @@ $ GOPATH= go get code.google.com/p/foo/quxx package code.google.com/p/foo/quxx: cannot download, $GOPATH not set. For more details see: go help gopath-
Finally, as a result of the previous change, the go get
command will also fail when $GOPATH
and $GOROOT
are set to the same value.
+
+Finally, as a result of the previous change, the go get
command will also fail
+when $GOPATH
and $GOROOT
are set to the same value.
@@ -170,11 +213,17 @@ warning: GOPATH set to GOROOT (/home/User/go) has no effect package code.google.com/p/foo/quxx: cannot download, $GOPATH must not be set to $GOROOT. For more details see: go help gopath+
+TODO: go test uses -c with a profile flag. +
+
-The go fix
command no longer applies fixes to update code from
-before Go 1 to use Go 1 APIs. To update pre-Go 1 code to Go 1.1, use a Go 1.0 tool chain
+The fix
command, usually run as
+go fix
, no longer applies fixes to update code from
+before Go 1 to use Go 1 APIs.
+To update pre-Go 1 code to Go 1.1, use a Go 1.0 tool chain
to convert the code to Go 1.0 first.
-Previous versions of the debug/elf package intentionally skipped over the first -symbol in the ELF symbol table, since it is always an empty symbol. This symbol -is no longer skipped since indexes into the symbol table returned by debug/elf, -will be different to indexes into the original ELF symbol table. Any code that -calls the debug/elf functions Symbols or ImportedSymbols may need to be -adjusted to account for the additional symbol and the change in symbol offsets. +TODO: Decide whether to keep this change. See CL 6848044. +
+ +
+Previous versions of the debug/elf
package
+intentionally skipped over the first
+symbol in the ELF symbol table, since it is always an empty symbol.
+This symbol
+is no longer skipped since indexes into the symbol table returned by debug/elf
+will be different from indexes into the original ELF symbol table.
+Any code that calls the methods
+Symbols
+or
+ImportedSymbols
+of the
+elf.File
+type may need to be adjusted to account for the additional symbol and the change in symbol offsets.
-The protocol-specific resolvers were formerly
-lax about the network name passed in. For example, although the documentation was clear
-that the only valid networks for ResolveTCPAddr
are "tcp"
,
-"tcp4"
, and "tcp6"
, the Go 1.0 implementation silently accepted
-any string. The Go 1.1 implementation returns an error if the network is not one of those strings.
-The same is true of the other protocol-specific resolvers ResolveIPAddr
, ResolveUDPAddr
, and
-ResolveUnixAddr
.
+The protocol-specific resolvers in the net
package were formerly
+lax about the network name passed in.
+Although the documentation was clear
+that the only valid networks for
+ResolveTCPAddr
+are "tcp"
,
+"tcp4"
, and "tcp6"
, the Go 1.0 implementation silently accepted any string.
+The Go 1.1 implementation returns an error if the network is not one of those strings.
+The same is true of the other protocol-specific resolvers ResolveIPAddr
,
+ResolveUDPAddr
, and
+ResolveUnixAddr
.
-The previous ListenUnixgram
returned UDPConn
as
-a representation of the connection endpoint. The Go 1.1 implementation
-returns UnixConn
to allow reading and writing
-with ReadFrom
and WriteTo
methods on
-the UnixConn
.
+The previous implementation of
+ListenUnixgram
+returned a
+UDPConn
as
+a representation of the connection endpoint.
+The Go 1.1 implementation instead returns a
+UnixConn
+to allow reading and writing
+with its
+ReadFrom
+and
+WriteTo
+methods.
-On FreeBSD, Linux, NetBSD, OS X and OpenBSD, previous versions of the time package
-returned times with microsecond precision. The Go 1.1 implementation of time on these
-systems now returns times with nanosecond precision. Code may exist that expects to be
-able to store such a time in an external format with only microsecond precision,
-read it back, and recover exactly the same time instant.
-In Go 1.1 the same time will not be recovered, since the external storage
-will have discarded nanoseconds.
-To address this case, there are two new methods of time.Time, Round and Truncate,
+On FreeBSD, Linux, NetBSD, OS X and OpenBSD, previous versions of the
+time
package
+returned times with microsecond precision.
+The Go 1.1 implementation on these
+systems now returns times with nanosecond precision.
+Programs that write to an external format with microsecond precision
+and read it back, expecting to recover the original value, will be affected
+by the loss of precision.
+There are two new methods of Time
,
+Round
+and
+Truncate
,
that can be used to remove precision from a time before passing it to
external storage.
TODO:
-time
: ParseInLocation, Timer.Reset, Time.YearDay
+
+The new method
+YearDay
+returns the one-indexed integral day number of the year specified by the time value.
+
+The
+Timer
+type has a new method
+Reset
+that modifies the timer to expire after a specified duration.
+Finally, the new function
+ParseInLocation
+is like the existing
+Parse
+but parses the time in the context of a location (time zone), ignoring
+time zone information in the parsed string.
+This function addresses a common source of confusion in the time API.
+
+Updating: +Code that needs to read and write times using an external format with +lower precision should be modified to use the new methods. + +
To make it easier for binary distributions to access them if desired, the exp
@@ -283,6 +385,12 @@ and then in Go source,
import "code.google.com/p/go.exp/ssa"
+
+The old package exp/norm
has also been moved, but to a new repository
+go.text
, where the Unicode APIs and other text-related packages will
+be developed.
+