From 5b7d422a05652893e27fc8393f9435ec2386bc83 Mon Sep 17 00:00:00 2001
From: Oling Cat
-Before Go 1.1, a function that returned a value needed an explicit "return"
+Before Go 1.1, a function that returned a value needed an explicit "return"
or call to Return requirements
panic
at
the end of the function; this was a simple way to make the programmer
be explicit about the meaning of the function. But there are many cases
@@ -131,7 +131,7 @@ In Go 1.1, the rule about final "return" statements is more permissive.
It introduces the concept of a
terminating statement,
a statement that is guaranteed to be the last one a function executes.
-Examples include
+Examples include
"for" loops with no condition and "if-else"
statements in which each half ends in a "return".
If the final statement of a function can be shown syntactically to
@@ -172,7 +172,7 @@ from the traditional Unix flag parsing. This may affect scripts that invoke
the tool directly.
For example,
go tool 6c -Fw -Dfoo
must now be written
-go tool 6c -F -w -D foo
.
+go tool 6c -F -w -D foo
.
Size of int on 64-bit platforms
@@ -197,6 +197,7 @@ However, programs that contain implicit assumptions
that int
is only 32 bits may change behavior.
For example, this code prints a positive number on 64-bit systems and
a negative one on 32-bit systems:
+
x := ^uint32(0) // x is 0xffffffff @@ -294,7 +295,7 @@ variable, where at least one of the accesses is a write. This new facility is built into thego
tool. For now, it is only available on Linux, Mac OS X, and Windows systems with 64-bit x86 processors. -To enable it, set the-race
flag when building or testing your program +To enable it, set the-race
flag when building or testing your program (for instance,go test -race
). The race detector is documented in a separate article. @@ -331,7 +332,7 @@ 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/you/go/src/pkg/foo/quxx (from $GOROOT) - /home/you/src/foo/quxx (from $GOPATH) + /home/you/src/foo/quxx (from $GOPATH)
@@ -343,12 +344,12 @@ command, a valid $GOPATH
is now
$ 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 +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.
+when $GOPATH
and $GOROOT
are set to the same value.
@@ -427,7 +428,7 @@ To build a file only with Go 1.0.x, use the converse constraint:The Go 1.1 tool chain adds experimental support for
@@ -546,7 +547,7 @@ The Go 1.1 implementation instead returns a to allow reading and writing with itsfreebsd/arm
, -netbsd/386
,netbsd/amd64
,netbsd/arm
, +netbsd/386
,netbsd/amd64
,netbsd/arm
,openbsd/386
andopenbsd/amd64
platforms.ReadFrom
-and +andWriteTo
methods. @@ -665,6 +666,7 @@ 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. +Exp and old subtrees moved to go.exp and go.text subrepositories
@@ -732,7 +734,7 @@ See the relevant package documentation for more information about each change.
bytes
package has two new functions,
TrimPrefix
and
@@ -745,7 +747,7 @@ provides some control over memory allocation inside the buffer.
Finally, the
Reader
type now has a
WriteTo
method
-so it implements the
+so it implements the
io.WriterTo
interface.
database/sql
package
-has a new
+has a new
Ping
method for its
DB
@@ -922,11 +924,11 @@ The net
package adds
net
package adds protocol-specific
+The net
package adds protocol-specific
packet reading and writing methods to
IPConn
(ReadMsgIP
-and WriteMsgIP
) and
+and WriteMsgIP
) and
UDPConn
(ReadMsgUDP
and
WriteMsgUDP
).
@@ -934,15 +936,15 @@ These are specialized versions of PacketCon
ReadFrom
and WriteTo
methods that provide access to out-of-band data associated
with the packets.
net
package adds methods to
-UnixConn
to allow closing half of the connection
+UnixConn
to allow closing half of the connection
(CloseRead
and
CloseWrite
),
matching the existing methods of TCPConn
.
net/http
package includes several new additions.
ParseTime
parses a time string, trying
@@ -1020,7 +1022,7 @@ including disabling it altogether.
sort
package has a new function,
Reverse
.
-Wrapping the argument of a call to
+Wrapping the argument of a call to
sort.Sort
with a call to Reverse
causes the sort order to be reversed.