summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@debian.org>2014-08-13 09:15:13 +0200
committerMichael Stapelberg <stapelberg@debian.org>2014-08-13 09:15:13 +0200
commit529609eb4df48905f8ed2ef746c642fb3113ad36 (patch)
treedcbb48025514e956597ea7c902b95aacdcbbe600
parent384c13fcf3ee95bf43fac6c2407b49817fa4bce4 (diff)
parent64f344c0c94601934187163f7b353d009dc1b63f (diff)
downloadgolang-529609eb4df48905f8ed2ef746c642fb3113ad36.tar.gz
Merge tag 'upstream/1.3.1' into debian-sid
Upstream version 1.3.1
-rw-r--r--VERSION2
-rw-r--r--doc/cmd.html6
-rw-r--r--doc/code.html16
-rw-r--r--doc/contrib.html10
-rw-r--r--doc/devel/release.html73
-rw-r--r--doc/devel/weekly.html2
-rw-r--r--doc/docs.html16
-rw-r--r--doc/effective_go.html8
-rw-r--r--doc/gccgo_contribute.html6
-rw-r--r--doc/go1.1.html2
-rw-r--r--doc/go1.2.html10
-rw-r--r--doc/go1.3.html23
-rw-r--r--doc/go1.html12
-rw-r--r--doc/go1compat.html2
-rw-r--r--doc/go_faq.html38
-rw-r--r--doc/go_spec.html2
-rw-r--r--doc/help.html8
-rw-r--r--doc/install-source.html14
-rw-r--r--doc/install.html4
-rw-r--r--doc/root.html8
-rw-r--r--doc/tos.html4
-rw-r--r--include/u.h1
-rw-r--r--misc/cgo/test/issue8441.go27
-rw-r--r--src/cmd/6g/ggen.c2
-rw-r--r--src/cmd/6g/peep.c5
-rw-r--r--src/cmd/8g/ggen.c2
-rw-r--r--src/cmd/8g/peep.c5
-rw-r--r--src/cmd/cgo/gcc.go57
-rw-r--r--src/cmd/gc/array.c14
-rw-r--r--src/cmd/gc/bv.c36
-rw-r--r--src/cmd/gc/go.h2
-rw-r--r--src/cmd/gc/plive.c52
-rw-r--r--src/pkg/compress/gzip/gzip.go3
-rw-r--r--src/pkg/compress/zlib/writer.go3
-rw-r--r--src/pkg/crypto/rsa/pkcs1v15.go43
-rw-r--r--src/pkg/crypto/rsa/pkcs1v15_test.go20
-rw-r--r--src/pkg/crypto/subtle/constant_time.go9
-rw-r--r--src/pkg/net/dnsconfig_unix.go10
-rw-r--r--src/pkg/net/fd_unix.go18
-rw-r--r--src/pkg/net/fd_windows.go9
-rw-r--r--src/pkg/net/sock_posix.go22
-rw-r--r--src/pkg/net/testdata/resolv.conf1
-rw-r--r--src/pkg/runtime/sys_windows_386.s5
-rw-r--r--src/pkg/runtime/sys_windows_amd64.s5
-rw-r--r--src/pkg/runtime/traceback_arm.c9
-rw-r--r--src/pkg/runtime/traceback_x86.c2
-rw-r--r--test/fixedbugs/issue8325.go31
47 files changed, 440 insertions, 219 deletions
diff --git a/VERSION b/VERSION
index 9c3a7a187..02fc666cd 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-go1.3 \ No newline at end of file
+go1.3.1 \ No newline at end of file
diff --git a/doc/cmd.html b/doc/cmd.html
index b8bdcdade..725666f1d 100644
--- a/doc/cmd.html
+++ b/doc/cmd.html
@@ -62,7 +62,7 @@ details.
</tr>
<tr>
-<td><a href="http://godoc.org/code.google.com/p/go.tools/cmd/cover/">cover</a></td>
+<td><a href="//godoc.org/code.google.com/p/go.tools/cmd/cover/">cover</a></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>Cover is a program for creating and analyzing the coverage profiles
generated by <code>"go test -coverprofile"</code>.
@@ -83,13 +83,13 @@ gofmt</a> command with more general options.</td>
</tr>
<tr>
-<td><a href="http://godoc.org/code.google.com/p/go.tools/cmd/godoc/">godoc</a></td>
+<td><a href="//godoc.org/code.google.com/p/go.tools/cmd/godoc/">godoc</a></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>Godoc extracts and generates documentation for Go packages.</td>
</tr>
<tr>
-<td><a href="http://godoc.org/code.google.com/p/go.tools/cmd/vet/">vet</a></td>
+<td><a href="//godoc.org/code.google.com/p/go.tools/cmd/vet/">vet</a></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>Vet examines Go source code and reports suspicious constructs, such as Printf
calls whose arguments do not align with the format string.</td>
diff --git a/doc/code.html b/doc/code.html
index 0abe6ac74..f019306fa 100644
--- a/doc/code.html
+++ b/doc/code.html
@@ -18,7 +18,7 @@ It explains the simplest way to get up and running with your Go installation.
<p>
A similar explanation is available as a
-<a href="http://www.youtube.com/watch?v=XCsL89YtqCs">screencast</a>.
+<a href="//www.youtube.com/watch?v=XCsL89YtqCs">screencast</a>.
</p>
@@ -508,7 +508,7 @@ revision control system such as Git or Mercurial. The <code>go</code> tool uses
this property to automatically fetch packages from remote repositories.
For instance, the examples described in this document are also kept in a
Mercurial repository hosted at Google Code,
-<code><a href="http://code.google.com/p/go.example">code.google.com/p/go.example</a></code>.
+<code><a href="//code.google.com/p/go.example">code.google.com/p/go.example</a></code>.
If you include the repository URL in the package's import path,
<code>go get</code> will fetch, build, and install it automatically:
</p>
@@ -569,8 +569,8 @@ import "code.google.com/p/go.example/newmath"
<p>
This convention is the easiest way to make your Go packages available for
others to use.
-The <a href="http://code.google.com/p/go-wiki/wiki/Projects">Go Wiki</a>
-and <a href="http://godoc.org/">godoc.org</a>
+The <a href="//code.google.com/p/go-wiki/wiki/Projects">Go Wiki</a>
+and <a href="//godoc.org/">godoc.org</a>
provide lists of external Go projects.
</p>
@@ -584,7 +584,7 @@ For more information on using remote repositories with the <code>go</code> tool,
<p>
Subscribe to the
-<a href="http://groups.google.com/group/golang-announce">golang-announce</a>
+<a href="//groups.google.com/group/golang-announce">golang-announce</a>
mailing list to be notified when a new stable version of Go is released.
</p>
@@ -594,7 +594,7 @@ clear, idiomatic Go code.
</p>
<p>
-Take <a href="http://tour.golang.org/">A Tour of Go</a> to learn the language
+Take <a href="//tour.golang.org/">A Tour of Go</a> to learn the language
proper.
</p>
@@ -613,10 +613,10 @@ For real-time help, ask the helpful gophers in <code>#go-nuts</code> on the
<p>
The official mailing list for discussion of the Go language is
-<a href="http://groups.google.com/group/golang-nuts">Go Nuts</a>.
+<a href="//groups.google.com/group/golang-nuts">Go Nuts</a>.
</p>
<p>
Report bugs using the
-<a href="http://code.google.com/p/go/issues/list">Go issue tracker</a>.
+<a href="//code.google.com/p/go/issues/list">Go issue tracker</a>.
</p>
diff --git a/doc/contrib.html b/doc/contrib.html
index 6529c91d5..a615fc67a 100644
--- a/doc/contrib.html
+++ b/doc/contrib.html
@@ -9,7 +9,7 @@
<p>
Go is an open source project developed by a team at
-<a href="http://google.com/">Google</a> and many
+<a href="//google.com/">Google</a> and many
<a href="/CONTRIBUTORS">contributors</a> from the open source community.
</p>
@@ -17,13 +17,13 @@ Go is an open source project developed by a team at
Go is distributed under a <a href="/LICENSE">BSD-style license</a>.
</p>
-<h3 id="announce"><a href="http://groups.google.com/group/golang-announce">Announcements Mailing List</a></h3>
+<h3 id="announce"><a href="//groups.google.com/group/golang-announce">Announcements Mailing List</a></h3>
<p>
A low traffic mailing list for important announcements, such as new releases.
</p>
<p>
We encourage all Go users to subscribe to
-<a href="http://groups.google.com/group/golang-announce">golang-announce</a>.
+<a href="//groups.google.com/group/golang-announce">golang-announce</a>.
</p>
@@ -72,9 +72,9 @@ href="https://groups.google.com/group/golang-nuts">golang-nuts</a>.</p>
<p>A mailing list that receives a message summarizing each checkin to the Go repository.</p>
<h3 id="golang-bugs"><a href="https://groups.google.com/group/golang-bugs">Bugs Mailing List</a></h3>
-<p>A mailing list that receives each update to the Go <a href="http://golang.org/issue">issue tracker</a>.</p>
+<p>A mailing list that receives each update to the Go <a href="//golang.org/issue">issue tracker</a>.</p>
-<h3 id="build_status"><a href="http://build.golang.org/">Build Status</a></h3>
+<h3 id="build_status"><a href="//build.golang.org/">Build Status</a></h3>
<p>View the status of Go builds across the supported operating
systems and architectures.</p>
diff --git a/doc/devel/release.html b/doc/devel/release.html
index 3a3d5bc13..c1d364c72 100644
--- a/doc/devel/release.html
+++ b/doc/devel/release.html
@@ -3,7 +3,7 @@
}-->
<p>This page summarizes the changes between official stable releases of Go.
-The <a href="http://code.google.com/p/go/source/list">Mercurial change log</a>
+The <a href="//code.google.com/p/go/source/list">Mercurial change log</a>
has the full details.</p>
<p>To update to a specific release, use:</p>
@@ -20,6 +20,13 @@ Go 1.3 is a major release of Go.
Read the <a href="/doc/go1.3">Go 1.3 Release Notes</a> for more information.
</p>
+<h3 id="go1.3.minor">Minor revisions</h3>
+
+<p>
+go1.3.1 (released 2014/08/13) includes bug fixes to the compiler and the the <code>runtime</code>, <code>net</code>, and <code>crypto/rsa</code> packages.
+See the <a href="//code.google.com/p/go/source/list?name=release-branch.go1.3&r=40272ab1339ab2fb9e7160483e5e5d42d6b7e810">change history</a> for details.
+</p>
+
<h2 id="go1.2">go1.2 (released 2013/12/01)</h2>
<p>
@@ -31,12 +38,12 @@ Read the <a href="/doc/go1.2">Go 1.2 Release Notes</a> for more information.
<p>
go1.2.1 (released 2014/03/02) includes bug fixes to the <code>runtime</code>, <code>net</code>, and <code>database/sql</code> packages.
-See the <a href="https://code.google.com/p/go/source/list?name=release-branch.go1.2&r=7ada9e760ce34e78aee5b476c9621556d0fa5d31">change history</a> for details.
+See the <a href="//code.google.com/p/go/source/list?name=release-branch.go1.2&r=7ada9e760ce34e78aee5b476c9621556d0fa5d31">change history</a> for details.
</p>
<p>
go1.2.2 (released 2014/05/05) includes a
-<a href="https://code.google.com/p/go/source/detail?r=bda3619e7a2c&repo=tools">security fix</a>
+<a href="//code.google.com/p/go/source/detail?r=bda3619e7a2c&repo=tools">security fix</a>
that affects the tour binary included in the binary distributions (thanks to Guillaume T).
</p>
@@ -51,18 +58,18 @@ Read the <a href="/doc/go1.1">Go 1.1 Release Notes</a> for more information.
<p>
go1.1.1 (released 2013/06/13) includes several compiler and runtime bug fixes.
-See the <a href="https://code.google.com/p/go/source/list?name=release-branch.go1.1&r=43c4a41d24382a56a90e924800c681e435d9e399">change history</a> for details.
+See the <a href="//code.google.com/p/go/source/list?name=release-branch.go1.1&r=43c4a41d24382a56a90e924800c681e435d9e399">change history</a> for details.
</p>
<p>
go1.1.2 (released 2013/08/13) includes fixes to the <code>gc</code> compiler
and <code>cgo</code>, and the <code>bufio</code>, <code>runtime</code>,
<code>syscall</code>, and <code>time</code> packages.
-See the <a href="https://code.google.com/p/go/source/list?name=release-branch.go1.1&r=a6a9792f94acd4ff686b2bc57383d163608b91cf">change history</a> for details.
+See the <a href="//code.google.com/p/go/source/list?name=release-branch.go1.1&r=a6a9792f94acd4ff686b2bc57383d163608b91cf">change history</a> for details.
If you use package syscall's <code>Getrlimit</code> and <code>Setrlimit</code>
functions under Linux on the ARM or 386 architectures, please note change
-<a href="http://golang.org/change/55ac276af5a7">55ac276af5a7</a>
-that fixes <a href="http://golang.org/issue/5949">issue 5949</a>.
+<a href="//golang.org/change/55ac276af5a7">55ac276af5a7</a>
+that fixes <a href="//golang.org/issue/5949">issue 5949</a>.
</p>
<h2 id="go1">go1 (released 2012/03/28)</h2>
@@ -88,17 +95,17 @@ The go1 release corresponds to
<p>
go1.0.1 (released 2012/04/25) was issued to
-<a href="https://code.google.com/p/go/source/detail?r=a890477d3dfb">fix</a> an
-<a href="https://code.google.com/p/go/issues/detail?id=3545">escape analysis
-bug</a> that can lead to memory corruption.
+<a href="//golang.org/change/a890477d3dfb">fix</a> an
+<a href="//golang.org/issue/3545">escape analysis bug</a>
+that can lead to memory corruption.
It also includes several minor code and documentation fixes.
</p>
<p>
go1.0.2 (released 2012/06/13) was issued to fix two bugs in the implementation
of maps using struct or array keys:
-<a href="http://code.google.com/p/go/issues/detail?id=3695">issue 3695</a> and
-<a href="http://code.google.com/p/go/issues/detail?id=3573">issue 3573</a>.
+<a href="//golang.org/issue/3695">issue 3695</a> and
+<a href="//golang.org/issue/3573">issue 3573</a>.
It also includes many minor code and documentation fixes.
</p>
@@ -107,7 +114,7 @@ go1.0.3 (released 2012/09/21) includes minor code and documentation fixes.
</p>
<p>
-See the <a href="http://code.google.com/p/go/source/list?name=release-branch.go1">go1 release branch history</a> for the complete list of changes.
+See the <a href="//code.google.com/p/go/source/list?name=release-branch.go1">go1 release branch history</a> for the complete list of changes.
</p>
<h2 id="r60">r60 (released 2011/09/07)</h2>
@@ -119,7 +126,7 @@ This section highlights the most significant changes in this release.
For a more detailed summary, see the
<a href="weekly.html#2011-08-17">weekly release notes</a>.
For complete information, see the
-<a href="http://code.google.com/p/go/source/list?r=release-branch.r60">Mercurial change list</a>.
+<a href="//code.google.com/p/go/source/list?r=release-branch.r60">Mercurial change list</a>.
</p>
<h3 id="r60.lang">Language</h3>
@@ -189,26 +196,26 @@ more accessible.
<p>
r60.1 includes a
-<a href="http://code.google.com/p/go/source/detail?r=1824581bf62d">linker
+<a href="//golang.org/change/1824581bf62d">linker
fix</a>, a pair of
-<a href="http://code.google.com/p/go/source/detail?r=9ef4429c2c64">goplay</a>
-<a href="http://code.google.com/p/go/source/detail?r=d42ed8c3098e">fixes</a>,
+<a href="//golang.org/change/9ef4429c2c64">goplay</a>
+<a href="//golang.org/change/d42ed8c3098e">fixes</a>,
and a <code>json</code> package
-<a href="http://code.google.com/p/go/source/detail?r=d5e97874fe84">fix</a> and
+<a href="//golang.org/change/d5e97874fe84">fix</a> and
a new
-<a href="http://code.google.com/p/go/source/detail?r=4f0e6269213f">struct tag
+<a href="//golang.org/change/4f0e6269213f">struct tag
option</a>.
</p>
<p>
r60.2
-<a href="http://code.google.com/p/go/source/detail?r=ff19536042ac">fixes</a>
+<a href="//golang.org/change/ff19536042ac">fixes</a>
a memory leak involving maps.
</p>
<p>
r60.3 fixes a
-<a href="http://code.google.com/p/go/source/detail?r=01fa62f5e4e5">reflect bug</a>.
+<a href="//golang.org/change/01fa62f5e4e5">reflect bug</a>.
</p>
<h2 id="r59">r59 (released 2011/08/01)</h2>
@@ -220,7 +227,7 @@ This section highlights the most significant changes in this release.
For a more detailed summary, see the
<a href="weekly.html#2011-07-07">weekly release notes</a>.
For complete information, see the
-<a href="http://code.google.com/p/go/source/list?r=release-branch.r59">Mercurial change list</a>.
+<a href="//code.google.com/p/go/source/list?r=release-branch.r59">Mercurial change list</a>.
</p>
<h3 id="r59.lang">Language</h3>
@@ -230,7 +237,7 @@ This release includes a language change that restricts the use of
<code>goto</code>. In essence, a <code>goto</code> statement outside a block
cannot jump to a label inside that block. Your code may require changes if it
uses <code>goto</code>.
-See <a href="http://code.google.com/p/go/source/detail?r=dc6d3cf9279d">this
+See <a href="//golang.org/change/dc6d3cf9279d">this
changeset</a> for how the new rule affected the Go tree.
</p>
@@ -328,13 +335,13 @@ This section highlights the most significant changes in this release.
For a more detailed summary, see the
<a href="weekly.html#2011-06-09">weekly release notes</a>.
For complete information, see the
-<a href="http://code.google.com/p/go/source/list?r=release-branch.r58">Mercurial change list</a>.
+<a href="//code.google.com/p/go/source/list?r=release-branch.r58">Mercurial change list</a>.
</p>
<h3 id="r58.lang">Language</h3>
<p>
-This release fixes a <a href="http://code.google.com/p/go/source/detail?r=b720749486e1">use of uninitialized memory in programs that misuse <code>goto</code></a>.
+This release fixes a <a href="//golang.org/change/b720749486e1">use of uninitialized memory in programs that misuse <code>goto</code></a>.
</p>
<h3 id="r58.pkg">Packages</h3>
@@ -393,8 +400,8 @@ the Go tree (and avoid writing Makefiles).
<h3 id="r58.minor">Minor revisions</h3>
<p>r58.1 adds
-<a href="http://code.google.com/p/go/source/detail?r=293c25943586">build</a> and
-<a href="http://code.google.com/p/go/source/detail?r=bf17e96b6582">runtime</a>
+<a href="//golang.org/change/293c25943586">build</a> and
+<a href="//golang.org/change/bf17e96b6582">runtime</a>
changes to make Go run on OS X 10.7 Lion.
</p>
@@ -408,7 +415,7 @@ This section highlights the most significant changes in this release.
For a more detailed summary, see the
<a href="weekly.html#2011-04-27">weekly release notes</a>.
For complete information, see the
-<a href="http://code.google.com/p/go/source/list?r=release-branch.r57">Mercurial change list</a>.
+<a href="//code.google.com/p/go/source/list?r=release-branch.r57">Mercurial change list</a>.
</p>
<p>The new <a href="/cmd/gofix">gofix</a> tool finds Go programs that use old APIs and rewrites them to use
@@ -419,7 +426,7 @@ future changes to the libraries.
Gofix can’t
handle all situations perfectly, so read and test the changes it makes before
committing them.
-See <a href="http://blog.golang.org/2011/04/introducing-gofix.html">the gofix blog post</a> for more
+See <a href="//blog.golang.org/2011/04/introducing-gofix.html">the gofix blog post</a> for more
information.</p>
<h3 id="r57.lang">Language</h3>
@@ -465,7 +472,7 @@ For clients, there are new
<a href="/pkg/http/#Client">Client</a> and <a href="/pkg/http/#Transport">Transport</a>
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 <a href="http://code.google.com/p/goauth2/source/browse/oauth/oauth.go">OAuth2</a>.
+custom clients that add functionality such as <a href="//code.google.com/p/goauth2/source/browse/oauth/oauth.go">OAuth2</a>.
For servers, <a href="/pkg/http/#ResponseWriter">ResponseWriter</a>
has dropped its non-essential methods.
The Hijack and Flush methods are no longer required;
@@ -509,7 +516,7 @@ implements all the possible value methods.
Instead of a type switch on a Value <code>v</code>, switch on <code>v.Kind()</code>.
Typeof and NewValue are now called <a href="/pkg/reflect/#Type.TypeOf">TypeOf</a> and <a href="/pkg/reflect/#Value.ValueOf">ValueOf</a>
To create a writable Value, use <code>New(t).Elem()</code> instead of <code>Zero(t)</code>.
-See <a href="http://code.google.com/p/go/source/detail?r=843855f3c026">the change description</a>
+See <a href="//golang.org/change/843855f3c026">the change description</a>
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.
@@ -545,8 +552,8 @@ For other uses, see the <a href="/pkg/runtime/pprof/">runtime/pprof</a> document
<h3 id="r57.minor">Minor revisions</h3>
-<p>r57.1 fixes a <a href="http://code.google.com/p/go/source/detail?r=ff2bc62726e7145eb2ecc1e0f076998e4a8f86f0">nil pointer dereference in http.FormFile</a>.</p>
-<p>r57.2 fixes a <a href="http://code.google.com/p/go/source/detail?r=063b0ff67d8277df03c956208abc068076818dae">use of uninitialized memory in programs that misuse <code>goto</code></a>.</p>
+<p>r57.1 fixes a <a href="//golang.org/change/ff2bc62726e7145eb2ecc1e0f076998e4a8f86f0">nil pointer dereference in http.FormFile</a>.</p>
+<p>r57.2 fixes a <a href="//golang.org/change/063b0ff67d8277df03c956208abc068076818dae">use of uninitialized memory in programs that misuse <code>goto</code></a>.</p>
<h2 id="r56">r56 (released 2011/03/16)</h2>
diff --git a/doc/devel/weekly.html b/doc/devel/weekly.html
index c22064258..34c87dc64 100644
--- a/doc/devel/weekly.html
+++ b/doc/devel/weekly.html
@@ -5,7 +5,7 @@
<p>This page summarizes the changes between tagged weekly snapshots of Go.
Such snapshots are no longer created. This page remains as a historical reference only.</p>
-<p>For recent information, see the <a href="http://code.google.com/p/go/source/list">Mercurial change log</a> and <a href="http://groups.google.com/group/golang-dev/">development mailing list</a>.</p>
+<p>For recent information, see the <a href="//code.google.com/p/go/source/list">Mercurial change log</a> and <a href="//groups.google.com/group/golang-dev/">development mailing list</a>.</p>
<h2 id="2012-03-27">2012-03-27 (<a href="release.html#go1">Go 1</a>)</h2>
diff --git a/doc/docs.html b/doc/docs.html
index bb2d52dcb..642f36dd4 100644
--- a/doc/docs.html
+++ b/doc/docs.html
@@ -33,20 +33,20 @@ libraries.
<img class="gopher" src="/doc/gopher/doc.png"/>
-<h3 id="go_tour"><a href="http://tour.golang.org/">A Tour of Go</a></h3>
+<h3 id="go_tour"><a href="//tour.golang.org/">A Tour of Go</a></h3>
<p>
An interactive introduction to Go in three sections.
The first section covers basic syntax and data structures; the second discusses
methods and interfaces; and the third introduces Go's concurrency primitives.
Each section concludes with a few exercises so you can practice what you've
-learned. You can <a href="http://tour.golang.org/">take the tour online</a> or
-<a href="http://code.google.com/p/go-tour/">install it locally</a>.
+learned. You can <a href="//tour.golang.org/">take the tour online</a> or
+<a href="//code.google.com/p/go-tour/">install it locally</a>.
</p>
<h3 id="code"><a href="code.html">How to write Go code</a></h3>
<p>
Also available as a
-<a href="http://www.youtube.com/watch?v=XCsL89YtqCs">screencast</a>, this doc
+<a href="//www.youtube.com/watch?v=XCsL89YtqCs">screencast</a>, this doc
explains how to use the <a href="/cmd/go/">go command</a> to fetch, build, and
install packages, commands, and run tests.
</p>
@@ -103,7 +103,7 @@ same variable in a different goroutine.
<h2 id="articles">Articles</h2>
-<h3 id="blog"><a href="http://blog.golang.org/">The Go Blog</a></h3>
+<h3 id="blog"><a href="//blog.golang.org/">The Go Blog</a></h3>
<p>The official blog of the Go project, featuring news and in-depth articles by
the Go team and guests.</p>
@@ -169,17 +169,17 @@ interfaces, reflection, and concurrency. Builds a toy web crawler to
demonstrate these.
</p>
-<h3 id="go_code_that_grows"><a href="http://vimeo.com/53221560">Code that grows with grace</a></h3>
+<h3 id="go_code_that_grows"><a href="//vimeo.com/53221560">Code that grows with grace</a></h3>
<p>
One of Go's key design goals is code adaptability; that it should be easy to take a simple design and build upon it in a clean and natural way. In this talk Andrew Gerrand describes a simple "chat roulette" server that matches pairs of incoming TCP connections, and then use Go's concurrency mechanisms, interfaces, and standard library to extend it with a web interface and other features. While the function of the program changes dramatically, Go's flexibility preserves the original design as it grows.
</p>
-<h3 id="go_concurrency_patterns"><a href="http://www.youtube.com/watch?v=f6kdp27TYZs">Go Concurrency Patterns</a></h3>
+<h3 id="go_concurrency_patterns"><a href="//www.youtube.com/watch?v=f6kdp27TYZs">Go Concurrency Patterns</a></h3>
<p>
Concurrency is the key to designing high performance network services. Go's concurrency primitives (goroutines and channels) provide a simple and efficient means of expressing concurrent execution. In this talk we see how tricky concurrency problems can be solved gracefully with simple Go code.
</p>
-<h3 id="advanced_go_concurrency_patterns"><a href="http://www.youtube.com/watch?v=QDDwwePbDtw">Advanced Go Concurrency Patterns</a></h3>
+<h3 id="advanced_go_concurrency_patterns"><a href="//www.youtube.com/watch?v=QDDwwePbDtw">Advanced Go Concurrency Patterns</a></h3>
<p>
This talk expands on the <i>Go Concurrency Patterns</i> talk to dive deeper into Go's concurrency primitives.
</p>
diff --git a/doc/effective_go.html b/doc/effective_go.html
index 25266d6ab..c1e310796 100644
--- a/doc/effective_go.html
+++ b/doc/effective_go.html
@@ -28,7 +28,7 @@ will be easy for other Go programmers to understand.
<p>
This document gives tips for writing clear, idiomatic Go code.
It augments the <a href="/ref/spec">language specification</a>,
-the <a href="http://tour.golang.org/">Tour of Go</a>,
+the <a href="//tour.golang.org/">Tour of Go</a>,
and <a href="/doc/code.html">How to Write Go Code</a>,
all of which you
should read first.
@@ -43,8 +43,8 @@ only as the core library but also as examples of how to
use the language.
Moreover, many of the packages contain working, self-contained
executable examples you can run directly from the
-<a href="http://golang.org">golang.org</a> web site, such as
-<a href="http://golang.org/pkg/strings/#example_Map">this one</a> (if
+<a href="//golang.org">golang.org</a> web site, such as
+<a href="//golang.org/pkg/strings/#example_Map">this one</a> (if
necessary, click on the word "Example" to open it up).
If you have a question about how to approach a problem or how something
might be implemented, the documentation, code and examples in the
@@ -3214,7 +3214,7 @@ Although the concurrency features of Go can make some problems easy
to structure as parallel computations, Go is a concurrent language,
not a parallel one, and not all parallelization problems fit Go's model.
For a discussion of the distinction, see the talk cited in
-<a href="http://blog.golang.org/2013/01/concurrency-is-not-parallelism.html">this
+<a href="//blog.golang.org/2013/01/concurrency-is-not-parallelism.html">this
blog post</a>.
<h3 id="leaky_buffer">A leaky buffer</h3>
diff --git a/doc/gccgo_contribute.html b/doc/gccgo_contribute.html
index ad2ce46ac..9dd6ecb85 100644
--- a/doc/gccgo_contribute.html
+++ b/doc/gccgo_contribute.html
@@ -30,7 +30,7 @@ contribution rules</a>.
<p>
The master sources for the gccgo frontend may be found at
-<a href="http://code.google.com/p/gofrontend">http://code.google.com/p/gofrontend</a>.
+<a href="//code.google.com/p/gofrontend">http://code.google.com/p/gofrontend</a>.
The master sources are not buildable by themselves, but only in
conjunction with GCC (in the future, other compilers may be
supported). Changes made to the gccgo frontend are also applied to
@@ -40,7 +40,7 @@ is mirrored to the <code>gcc/go/gofrontend</code> directory in the GCC
repository, and the <code>gofrontend</code> <code>libgo</code>
directory is mirrored to the GCC <code>libgo</code> directory. In
addition, the <code>test</code> directory
-from <a href="http://code.google.com/p/go">the main Go repository</a>
+from <a href="//code.google.com/p/go">the main Go repository</a>
is mirrored to the <code>gcc/testsuite/go.test/test</code> directory
in the GCC repository.
</p>
@@ -65,7 +65,7 @@ from <code>gcc/go/gofrontend</code> to <code>gcc/go</code>.
<p>
The run-time library for gccgo is mostly the same as the library
-in <a href="http://code.google.com/p/go">the main Go repository</a>.
+in <a href="//code.google.com/p/go">the main Go repository</a>.
The library code in the Go repository is periodically merged into
the <code>libgo/go</code> directory of the <code>gofrontend</code> and
then the GCC repositories, using the shell
diff --git a/doc/go1.1.html b/doc/go1.1.html
index 87d5f5c87..825867f44 100644
--- a/doc/go1.1.html
+++ b/doc/go1.1.html
@@ -304,7 +304,7 @@ The race detector is documented in <a href="/doc/articles/race_detector.html">a
<p>
Due to the change of the <a href="#int"><code>int</code></a> to 64 bits and
-a new internal <a href="http://golang.org/s/go11func">representation of functions</a>,
+a new internal <a href="//golang.org/s/go11func">representation of functions</a>,
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.
diff --git a/doc/go1.2.html b/doc/go1.2.html
index c7a9f8442..b9d36f29c 100644
--- a/doc/go1.2.html
+++ b/doc/go1.2.html
@@ -63,7 +63,7 @@ The implementation may inject extra tests into the compiled program to enforce t
<p>
Further details are in the
-<a href="http://golang.org/s/go12nil">design document</a>.
+<a href="//golang.org/s/go12nil">design document</a>.
</p>
<p>
@@ -115,7 +115,7 @@ It is possible that future releases of Go may introduce default values for these
<p>
Further details are in the
-<a href="http://golang.org/s/go12slice">design document</a>.
+<a href="//golang.org/s/go12slice">design document</a>.
</p>
<p>
@@ -199,7 +199,7 @@ compiler to build any pieces of the linked-to library that are written in C++;
<p>
Both binaries are still included with the distribution, but the source code for the
godoc and vet commands has moved to the
-<a href="http://code.google.com/p/go.tools">go.tools</a> subrepository.
+<a href="//code.google.com/p/go.tools">go.tools</a> subrepository.
</p>
<p>
@@ -218,7 +218,7 @@ no client Go code depends on the their source and no updating is required.
</p>
<p>
-The binary distributions available from <a href="http://golang.org">golang.org</a>
+The binary distributions available from <a href="//golang.org">golang.org</a>
include these binaries, so users of these distributions are unaffected.
</p>
@@ -448,7 +448,7 @@ The new interfaces are called
and
<a href="/pkg/encoding/#TextUnmarshaler"><code>TextUnmarshaler</code></a>.
Full details are in the <a href="/pkg/encoding/">documentation</a> for the package
-and a separate <a href="http://golang.org/s/go12encoding">design document</a>.
+and a separate <a href="//golang.org/s/go12encoding">design document</a>.
</p>
<h3 id="fmt_indexed_arguments">The fmt package</h3>
diff --git a/doc/go1.3.html b/doc/go1.3.html
index ae5c02598..042de1bc7 100644
--- a/doc/go1.3.html
+++ b/doc/go1.3.html
@@ -66,7 +66,7 @@ It runs on the 32-bit Intel architectures (<code>GOARCH=386</code>) and also on
There is not yet support for Native Client on ARM.
Note that this is Native Client (NaCl), not Portable Native Client (PNaCl).
Details about Native Client are <a href="https://developers.google.com/native-client/dev/">here</a>;
-how to set up the Go version is described <a href="http://golang.org/wiki/NativeClient">here</a>.
+how to set up the Go version is described <a href="//golang.org/wiki/NativeClient">here</a>.
</p>
<h3 id="netbsd">Support for NetBSD</h3>
@@ -118,7 +118,7 @@ than is available, its stack is transferred to a larger single block of memory.
The overhead of this transfer operation amortizes well and eliminates the old "hot spot"
problem when a calculation repeatedly steps across a segment boundary.
Details including performance numbers are in this
-<a href="http://golang.org/s/contigstacks">design document</a>.
+<a href="//golang.org/s/contigstacks">design document</a>.
</p>
<h3 id="garbage_collector">Changes to the garbage collector</h3>
@@ -141,7 +141,7 @@ Programs that use <a href="/pkg/unsafe/">package unsafe</a> to store pointers
in integer-typed values are also illegal but more difficult to diagnose during execution.
Because the pointers are hidden from the runtime, a stack expansion or garbage collection
may reclaim the memory they point at, creating
-<a href="http://en.wikipedia.org/wiki/Dangling_pointer">dangling pointers</a>.
+<a href="//en.wikipedia.org/wiki/Dangling_pointer">dangling pointers</a>.
</p>
<p>
@@ -154,7 +154,7 @@ Such code can be identified by <code>go vet</code>.
<p>
Iterations over small maps no longer happen in a consistent order.
-Go 1 defines that &ldquo;<a href="http://golang.org/ref/spec#For_statements">The iteration order over maps
+Go 1 defines that &ldquo;<a href="//golang.org/ref/spec#For_statements">The iteration order over maps
is not specified and is not guaranteed to be the same from one iteration to the next.</a>&rdquo;
To keep code from depending on map iteration order,
Go 1.0 started each map iteration at a random index in the map.
@@ -175,7 +175,7 @@ Because only small maps are affected, the problem arises most often in tests.
<h3 id="liblink">The linker</h3>
<p>
-As part of the general <a href="http://golang.org/s/go13linker">overhaul</a> to
+As part of the general <a href="//golang.org/s/go13linker">overhaul</a> to
the Go linker, the compilers and linkers have been refactored.
The linker is still a C program, but now the instruction selection phase that
was part of the linker has been moved to the compiler through the creation of a new
@@ -298,7 +298,7 @@ For example,
<h3 id="godoc">Changes to godoc</h3>
<p>
When invoked with the <code>-analysis</code> flag,
-<a href="http://godoc.org/code.google.com/p/go.tools/cmd/godoc">godoc</a>
+<a href="//godoc.org/code.google.com/p/go.tools/cmd/godoc">godoc</a>
now performs sophisticated <a href="/lib/godoc/analysis/help.html">static
analysis</a> of the code it indexes.
The results of analysis are presented in both the source view and the
@@ -318,7 +318,7 @@ call sites and their callees.
The program <code>misc/benchcmp</code> that compares
performance across benchmarking runs has been rewritten.
Once a shell and awk script in the main repository, it is now a Go program in the <code>go.tools</code> repo.
-Documentation is <a href="http://godoc.org/code.google.com/p/go.tools/cmd/benchcmp">here</a>.
+Documentation is <a href="//godoc.org/code.google.com/p/go.tools/cmd/benchcmp">here</a>.
</p>
<p>
@@ -521,6 +521,15 @@ field to specify an end-to-end timeout on requests made using the
client.
</li>
+<li>
+The <a href="/pkg/net/http/"><code>net/http</code></a> package's
+<a href="/pkg/net/http/#Request.ParseMultipartForm"><code>Request.ParseMultipartForm</code></a>
+method will now return an error if the body's <code>Content-Type</code>
+is not <code>mutipart/form-data</code>.
+Prior to Go 1.3 it would silently fail and return <code>nil</code>.
+Code that relies on the previous behavior should be updated.
+</li>
+
<li> In the <a href="/pkg/net/"><code>net</code></a> package,
the <a href="/pkg/net/#Dialer"><code>Dialer</code></a> struct now
has a <code>KeepAlive</code> option to specify a keep-alive period for the connection.
diff --git a/doc/go1.html b/doc/go1.html
index a664b6555..5cf5df929 100644
--- a/doc/go1.html
+++ b/doc/go1.html
@@ -486,7 +486,7 @@ into subdirectories. For instance, <code>utf8</code> and
<code>utf16</code> now occupy subdirectories of <code>unicode</code>.
Also, <a href="#subrepo">some packages</a> have moved into
subrepositories of
-<a href="http://code.google.com/p/go"><code>code.google.com/p/go</code></a>
+<a href="//code.google.com/p/go"><code>code.google.com/p/go</code></a>
while <a href="#deleted">others</a> have been deleted outright.
</p>
@@ -565,7 +565,7 @@ by hand.
<p>
Because they are not standardized, the packages under the <code>exp</code> directory will not be available in the
standard Go 1 release distributions, although they will be available in source code form
-in <a href="http://code.google.com/p/go/">the repository</a> for
+in <a href="//code.google.com/p/go/">the repository</a> for
developers who wish to use them.
</p>
@@ -651,7 +651,7 @@ and also the command <code>gotry</code>.
<em>Updating</em>:
Code that uses <code>container/vector</code> should be updated to use
slices directly. See
-<a href="http://code.google.com/p/go-wiki/wiki/SliceTricks">the Go
+<a href="//code.google.com/p/go-wiki/wiki/SliceTricks">the Go
Language Community Wiki</a> for some suggestions.
Code that uses the other packages (there should be almost zero) will need to be rethought.
</p>
@@ -660,7 +660,7 @@ Code that uses the other packages (there should be almost zero) will need to be
<p>
Go 1 has moved a number of packages into other repositories, usually sub-repositories of
-<a href="http://code.google.com/p/go/">the main Go repository</a>.
+<a href="//code.google.com/p/go/">the main Go repository</a>.
This table lists the old and new import paths:
<table class="codetable" frame="border" summary="Sub-repositories">
@@ -1695,7 +1695,7 @@ The compiler will catch code using the old interface.
The <a href="/pkg/regexp/"><code>regexp</code></a> package has been rewritten.
It has the same interface but the specification of the regular expressions
it supports has changed from the old "egrep" form to that of
-<a href="http://code.google.com/p/re2/">RE2</a>.
+<a href="//code.google.com/p/re2/">RE2</a>.
</p>
<p>
@@ -1912,7 +1912,7 @@ package <a href="/pkg/reflect/"><code>reflect</code></a>.
<em>Updating</em>:
Code using these functions must be rewritten to use
package <a href="/pkg/reflect/"><code>reflect</code></a>.
-The changes to <a href="http://code.google.com/p/go/source/detail?r=2646dc956207">encoding/gob</a> and the <a href="http://code.google.com/p/goprotobuf/source/detail?r=5340ad310031">protocol buffer library</a>
+The changes to <a href="//golang.org/change/2646dc956207">encoding/gob</a> and the <a href="//code.google.com/p/goprotobuf/source/detail?r=5340ad310031">protocol buffer library</a>
may be helpful as examples.
</p>
diff --git a/doc/go1compat.html b/doc/go1compat.html
index 7ca3d355d..d10b9af29 100644
--- a/doc/go1compat.html
+++ b/doc/go1compat.html
@@ -145,7 +145,7 @@ developed software based on Go 1.
<p>
Code in sub-repositories of the main go tree, such as
-<a href="http://code.google.com/p/go.net">code.google.com/p/go.net</a>,
+<a href="//code.google.com/p/go.net">code.google.com/p/go.net</a>,
may be developed under
looser compatibility requirements. However, the sub-repositories
will be tagged as appropriate to identify versions that are compatible
diff --git a/doc/go_faq.html b/doc/go_faq.html
index b1945dda8..f2082ef5b 100644
--- a/doc/go_faq.html
+++ b/doc/go_faq.html
@@ -57,7 +57,7 @@ software on multicore machines.
<p>
A much more expansive answer to this question is available in the article,
-<a href="http://talks.golang.org/2012/splash.article">Go at Google:
+<a href="//talks.golang.org/2012/splash.article">Go at Google:
Language Design in the Service of Software Engineering</a>.
<h3 id="What_is_the_status_of_the_project">
@@ -66,7 +66,7 @@ What is the status of the project?</h3>
<p>
Go became a public open source project on November 10, 2009.
After a couple of years of very active design and development, stability was called for and
-Go 1 was <a href="http://blog.golang.org/2012/03/go-version-1-is-released.html">released</a>
+Go 1 was <a href="//blog.golang.org/2012/03/go-version-1-is-released.html">released</a>
on March 28, 2012.
Go 1, which includes a <a href="/ref/spec">language specification</a>,
<a href="/pkg/">standard libraries</a>,
@@ -163,7 +163,7 @@ language was called for.
</p>
<p>
-The article <a href="http://talks.golang.org/2012/splash.article">Go at Google</a>
+The article <a href="//talks.golang.org/2012/splash.article">Go at Google</a>
discusses the background and motivation behind the design of the Go language,
as well as providing more detail about many of the answers presented in this FAQ.
</p>
@@ -221,7 +221,7 @@ easier to understand what happens when things combine.
<p>
Yes. There are now several Go programs deployed in
production inside Google. A public example is the server behind
-<a href="http://golang.org">http://golang.org</a>.
+<a href="//golang.org">golang.org</a>.
It's just the <a href="/cmd/godoc"><code>godoc</code></a>
document server running in a production configuration on
<a href="https://developers.google.com/appengine/">Google App Engine</a>.
@@ -260,7 +260,7 @@ Does Go support Google's protocol buffers?</h3>
<p>
A separate open source project provides the necessary compiler plugin and library.
It is available at
-<a href="http://code.google.com/p/goprotobuf/">http://code.google.com/p/goprotobuf/</a>
+<a href="//code.google.com/p/goprotobuf/">code.google.com/p/goprotobuf/</a>
</p>
@@ -270,9 +270,9 @@ Can I translate the Go home page into another language?</h3>
<p>
Absolutely. We encourage developers to make Go Language sites in their own languages.
However, if you choose to add the Google logo or branding to your site
-(it does not appear on <a href="http://golang.org/">golang.org</a>),
+(it does not appear on <a href="//golang.org/">golang.org</a>),
you will need to abide by the guidelines at
-<a href="http://www.google.com/permissions/guidelines.html">http://www.google.com/permissions/guidelines.html</a>
+<a href="//www.google.com/permissions/guidelines.html">www.google.com/permissions/guidelines.html</a>
</p>
<h2 id="Design">Design</h2>
@@ -466,7 +466,7 @@ Will you accept my language change?</h3>
<p>
People often suggest improvements to the language—the
-<a href="http://groups.google.com/group/golang-nuts">mailing list</a>
+<a href="//groups.google.com/group/golang-nuts">mailing list</a>
contains a rich history of such discussions—but very few of these changes have
been accepted.
</p>
@@ -484,7 +484,7 @@ to start talking about what that might be.
<p>
Even if your proposal is compatible with the Go 1 spec, it might
not be in the spirit of Go's design goals.
-The article <i><a href="http://talks.golang.org/2012/splash.article">Go
+The article <i><a href="//talks.golang.org/2012/splash.article">Go
at Google: Language Design in the Service of Software Engineering</a></i>
explains Go's origins and the motivation behind its design.
</p>
@@ -940,9 +940,9 @@ How are libraries documented?</h3>
There is a program, <code>godoc</code>, written in Go, that extracts
package documentation from the source code. It can be used on the
command line or on the web. An instance is running at
-<a href="/pkg/">http://golang.org/pkg/</a>.
+<a href="/pkg/">golang.org/pkg/</a>.
In fact, <code>godoc</code> implements the full site at
-<a href="/">http://golang.org/</a>.
+<a href="/">golang.org/</a>.
</p>
<h3 id="Is_there_a_Go_programming_style_guide">
@@ -961,7 +961,7 @@ All the Go code in the repository has been run through <code>gofmt</code>.
<p>
The document titled
-<a href="http://golang.org/s/comments">Go Code Review Comments</a>
+<a href="//golang.org/s/comments">Go Code Review Comments</a>
is a collection of very short essays about details of Go idiom that are often
missed by programmers.
It is a handy reference for people doing code reviews for Go projects.
@@ -986,14 +986,14 @@ Why does the project use Mercurial and not git?</h3>
<p>
The Go project, hosted by Google Code at
-<a href="http://code.google.com/p/go">code.google.com/p/go</a>,
+<a href="//code.google.com/p/go">code.google.com/p/go</a>,
uses Mercurial as its version control system.
When the project launched,
Google Code supported only Subversion and Mercurial.
Mercurial was a better choice because of its plugin mechanism
that allowed us to create the "codereview" plugin to connect
the project to the excellent code review tools at
-<a href="http://codereview.appspot.com">codereview.appspot.com</a>.
+<a href="//codereview.appspot.com">codereview.appspot.com</a>.
</p>
<p>
@@ -1304,7 +1304,7 @@ Do not communicate by sharing memory. Instead, share memory by communicating.
</p>
<p>
-See the <a href="/doc/codewalk/sharemem/">Share Memory By Communicating</a> code walk and its <a href="http://blog.golang.org/2010/07/share-memory-by-communicating.html">associated article</a> for a detailed discussion of this concept.
+See the <a href="/doc/codewalk/sharemem/">Share Memory By Communicating</a> code walk and its <a href="//blog.golang.org/2010/07/share-memory-by-communicating.html">associated article</a> for a detailed discussion of this concept.
</p>
<h3 id="Why_no_multi_CPU">
@@ -1321,7 +1321,7 @@ run-time support to utilize more than one OS thread.
Programs that perform parallel computation should benefit from an increase in
<code>GOMAXPROCS</code>.
However, be aware that
-<a href="http://blog.golang.org/2013/01/concurrency-is-not-parallelism.html">concurrency
+<a href="//blog.golang.org/2013/01/concurrency-is-not-parallelism.html">concurrency
is not parallelism</a>.
</p>
@@ -1358,7 +1358,7 @@ should recognize such cases and optimize its use of OS threads. For now,
<p>
For more detail on this topic see the talk entitled,
-<a href="http://blog.golang.org/2013/01/concurrency-is-not-parallelism.html">Concurrency
+<a href="//blog.golang.org/2013/01/concurrency-is-not-parallelism.html">Concurrency
is not Parallelism</a>.
<h2 id="Functions_methods">Functions and Methods</h2>
@@ -1736,7 +1736,7 @@ In any case, Go can often be very competitive.
There has been significant improvement in the performance of many programs
as the language and tools have developed.
See the blog post about
-<a href="http://blog.golang.org/2011/06/profiling-go-programs.html">profiling
+<a href="//blog.golang.org/2011/06/profiling-go-programs.html">profiling
Go programs</a> for an informative example.
<h2 id="change_from_c">Changes from C</h2>
@@ -1895,7 +1895,7 @@ considerable control over memory layout and allocation, much more than
is typical in garbage-collected languages. A careful programmer can reduce
the garbage collection overhead dramatically by using the language well;
see the article about
-<a href="http://blog.golang.org/2011/06/profiling-go-programs.html">profiling
+<a href="//blog.golang.org/2011/06/profiling-go-programs.html">profiling
Go programs</a> for a worked example, including a demonstration of Go's
profiling tools.
</p>
diff --git a/doc/go_spec.html b/doc/go_spec.html
index baa0ecf40..660c8535e 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -23,7 +23,7 @@ TODO
<p>
This is a reference manual for the Go programming language. For
-more information and other documents, see <a href="/">http://golang.org</a>.
+more information and other documents, see <a href="/">golang.org</a>.
</p>
<p>
diff --git a/doc/help.html b/doc/help.html
index ad92c5695..a307b2aad 100644
--- a/doc/help.html
+++ b/doc/help.html
@@ -20,11 +20,11 @@ Need help with Go? Try these resources.
<h3 id="wiki"><a href="/wiki">The Go Wiki</a></h3>
<p>A wiki maintained by the Go community.</p>
-<h3 id="mailinglist"><a href="http://groups.google.com/group/golang-nuts">Go Nuts Mailing List</a></h3>
+<h3 id="mailinglist"><a href="//groups.google.com/group/golang-nuts">Go Nuts Mailing List</a></h3>
<p>
-Search the <a href="http://groups.google.com/group/golang-nuts">golang-nuts</a>
+Search the <a href="//groups.google.com/group/golang-nuts">golang-nuts</a>
archives and consult the <a href="/doc/go_faq.html">FAQ</a> and
-<a href="http://code.google.com/p/go-wiki/wiki">wiki</a> before posting.
+<a href="//code.google.com/p/go-wiki/wiki">wiki</a> before posting.
</p>
<h3 id="irc"><a href="irc:irc.freenode.net/go-nuts">Go IRC Channel</a></h3>
@@ -37,7 +37,7 @@ Go IRC channel.</p>
<h3 id="plus"><a href="https://plus.google.com/101406623878176903605/posts">The Go Programming Language at Google+</a></h3>
<p>The Go project's Google+ page.</p>
-<h3 id="twitter"><a href="http://twitter.com/golang">@golang at Twitter</a></h3>
+<h3 id="twitter"><a href="//twitter.com/golang">@golang at Twitter</a></h3>
<p>The Go project's official Twitter account.</p>
<p>Tweeting about your problem with the <code>#golang</code> hashtag usually
generates some helpful responses.</p>
diff --git a/doc/install-source.html b/doc/install-source.html
index 6f6a15afd..82859b50f 100644
--- a/doc/install-source.html
+++ b/doc/install-source.html
@@ -81,7 +81,7 @@ The full set of supported combinations is listed in the discussion of
<p>
The Go tool chain is written in C. To build it, you need a C compiler installed.
-Please refer to the <a href="http://code.google.com/p/go-wiki/wiki/InstallFromSource#Install_C_tools">InstallFromSource</a>
+Please refer to the <a href="//golang.org/wiki/InstallFromSource#Install_C_tools">InstallFromSource</a>
page on the Go community Wiki for operating system specific instructions.
</p>
@@ -283,16 +283,16 @@ You can access the latter commands with
The usual community resources such as
<code>#go-nuts</code> on the <a href="http://freenode.net/">Freenode</a> IRC server
and the
-<a href="http://groups.google.com/group/golang-nuts">Go Nuts</a>
+<a href="//groups.google.com/group/golang-nuts">Go Nuts</a>
mailing list have active developers that can help you with problems
with your installation or your development work.
For those who wish to keep up to date,
-there is another mailing list, <a href="http://groups.google.com/group/golang-checkins">golang-checkins</a>,
+there is another mailing list, <a href="//groups.google.com/group/golang-checkins">golang-checkins</a>,
that receives a message summarizing each checkin to the Go repository.
</p>
<p>
-Bugs can be reported using the <a href="http://code.google.com/p/go/issues/list">Go issue tracker</a>.
+Bugs can be reported using the <a href="//code.google.com/p/go/issues/list">Go issue tracker</a>.
</p>
@@ -306,7 +306,7 @@ The Go project maintains a stable tag in its Mercurial repository:
<p>
The <code>release</code> tag refers to the current stable release of Go.
Most Go users should use this version. New releases are announced on the
-<a href="http://groups.google.com/group/golang-announce">golang-announce</a>
+<a href="//groups.google.com/group/golang-announce">golang-announce</a>
mailing list.
</p>
@@ -482,8 +482,8 @@ should target. If you are compiling on the target system, its value will be auto
<p>
If in doubt, leave this variable unset, and adjust it if required
when you first run the Go executable.
-The <a href="http://code.google.com/p/go-wiki/wiki/GoArm">GoARM</a> page
-on the <a href="http://code.google.com/p/go-wiki/w/list">Go community wiki</a>
+The <a href="//golang.org/wiki/GoArm">GoARM</a> page
+on the <a href="//golang.org/wiki">Go community wiki</a>
contains further details regarding Go's ARM support.
</p>
diff --git a/doc/install.html b/doc/install.html
index 7282ae947..2de04471c 100644
--- a/doc/install.html
+++ b/doc/install.html
@@ -270,12 +270,12 @@ For real-time help, ask the helpful gophers in <code>#go-nuts</code> on the
<p>
The official mailing list for discussion of the Go language is
-<a href="http://groups.google.com/group/golang-nuts">Go Nuts</a>.
+<a href="//groups.google.com/group/golang-nuts">Go Nuts</a>.
</p>
<p>
Report bugs using the
-<a href="http://code.google.com/p/go/issues/list">Go issue tracker</a>.
+<a href="//golang.org/issue">Go issue tracker</a>.
</p>
diff --git a/doc/root.html b/doc/root.html
index 43637933a..3c6de2e46 100644
--- a/doc/root.html
+++ b/doc/root.html
@@ -26,7 +26,7 @@ Hello, 世界
<div class="buttons">
<a class="run" href="#" title="Run this code [shift-enter]">Run</a>
<a class="share" href="#" title="Share this code">Share</a>
-<a class="tour" href="http://tour.golang.org/" title="Learn Go from your browser">Tour</a>
+<a class="tour" href="//tour.golang.org/" title="Learn Go from your browser">Tour</a>
</div>
<div class="toys">
<select>
@@ -78,7 +78,7 @@ Linux, Mac OS X, Windows, and more.
<div id="blog">
<div class="rootHeading">Featured articles</div>
-<div class="read"><a href="http://blog.golang.org/">Read more</a></div>
+<div class="read"><a href="//blog.golang.org/">Read more</a></div>
</div>
</div>
@@ -124,7 +124,7 @@ window.initFuncs.push(function() {
"outputEl": "#learn .output",
"runEl": "#learn .run",
"shareEl": "#learn .share",
- "shareRedirect": "http://play.golang.org/p/",
+ "shareRedirect": "//play.golang.org/p/",
"toysEl": "#learn .toys select"
});
} else {
@@ -133,7 +133,7 @@ window.initFuncs.push(function() {
// Load blog feed.
$('<script/>').attr('text', 'text/javascript')
- .attr('src', 'http://blog.golang.org/.json?jsonp=feedLoaded')
+ .attr('src', '//blog.golang.org/.json?jsonp=feedLoaded')
.appendTo('body');
// Set the video at random.
diff --git a/doc/tos.html b/doc/tos.html
index 67b107dca..fff46428e 100644
--- a/doc/tos.html
+++ b/doc/tos.html
@@ -5,7 +5,7 @@
<p>
The Go website (the "Website") is hosted by Google.
By using and/or visiting the Website, you consent to be bound by Google's general
-<a href="http://www.google.com/intl/en/policies/terms/">Terms of Service</a>
+<a href="//www.google.com/intl/en/policies/terms/">Terms of Service</a>
and Google's general
-<a href="http://www.google.com/intl/en/privacy/privacy-policy.html">Privacy Policy</a>.
+<a href="//www.google.com/intl/en/privacy/privacy-policy.html">Privacy Policy</a>.
</p>
diff --git a/include/u.h b/include/u.h
index 6b2d50cc1..489b2a388 100644
--- a/include/u.h
+++ b/include/u.h
@@ -40,6 +40,7 @@ extern "C" {
#endif
#define _BSD_SOURCE 1
#define _NETBSD_SOURCE 1 /* NetBSD */
+#define _DEFAULT_SOURCE 1 /* glibc > 2.19 */
#define _SVID_SOURCE 1
#if !defined(__APPLE__) && !defined(__OpenBSD__)
# define _XOPEN_SOURCE 1000
diff --git a/misc/cgo/test/issue8441.go b/misc/cgo/test/issue8441.go
new file mode 100644
index 000000000..2d871f083
--- /dev/null
+++ b/misc/cgo/test/issue8441.go
@@ -0,0 +1,27 @@
+// Copyright 2014 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 8368 and 8441. Recursive struct definitions didn't work.
+// No runtime test; just make sure it compiles.
+
+package cgotest
+
+/*
+typedef struct one one;
+typedef struct two two;
+struct one {
+ two *x;
+};
+struct two {
+ one *x;
+};
+*/
+import "C"
+
+func issue8368(one *C.struct_one, two *C.struct_two) {
+}
+
+func issue8441(one *C.one, two *C.two) {
+ issue8441(two.x, one.x)
+}
diff --git a/src/cmd/6g/ggen.c b/src/cmd/6g/ggen.c
index c385798f2..9665d831b 100644
--- a/src/cmd/6g/ggen.c
+++ b/src/cmd/6g/ggen.c
@@ -943,7 +943,7 @@ cgen_hmul(Node *nl, Node *nr, Node *res)
if(t->width == 1) {
// byte multiply behaves differently.
nodreg(&ax, t, D_AH);
- nodreg(&dx, t, D_DL);
+ nodreg(&dx, t, D_DX);
gmove(&ax, &dx);
}
nodreg(&dx, t, D_DX);
diff --git a/src/cmd/6g/peep.c b/src/cmd/6g/peep.c
index 0f2720443..24617836f 100644
--- a/src/cmd/6g/peep.c
+++ b/src/cmd/6g/peep.c
@@ -838,6 +838,11 @@ copyu(Prog *p, Adr *v, Adr *s)
static int
copyas(Adr *a, Adr *v)
{
+ if(D_AL <= a->type && a->type <= D_R15B)
+ fatal("use of byte register");
+ if(D_AL <= v->type && v->type <= D_R15B)
+ fatal("use of byte register");
+
if(a->type != v->type)
return 0;
if(regtyp(v))
diff --git a/src/cmd/8g/ggen.c b/src/cmd/8g/ggen.c
index 2285a04e6..5e3140480 100644
--- a/src/cmd/8g/ggen.c
+++ b/src/cmd/8g/ggen.c
@@ -991,7 +991,7 @@ cgen_hmul(Node *nl, Node *nr, Node *res)
if(t->width == 1) {
// byte multiply behaves differently.
nodreg(&ax, t, D_AH);
- nodreg(&dx, t, D_DL);
+ nodreg(&dx, t, D_DX);
gmove(&ax, &dx);
}
nodreg(&dx, t, D_DX);
diff --git a/src/cmd/8g/peep.c b/src/cmd/8g/peep.c
index a4e516dd3..e2f3a003d 100644
--- a/src/cmd/8g/peep.c
+++ b/src/cmd/8g/peep.c
@@ -634,6 +634,11 @@ copyu(Prog *p, Adr *v, Adr *s)
static int
copyas(Adr *a, Adr *v)
{
+ if(D_AL <= a->type && a->type <= D_BL)
+ fatal("use of byte register");
+ if(D_AL <= v->type && v->type <= D_BL)
+ fatal("use of byte register");
+
if(a->type != v->type)
return 0;
if(regtyp(v))
diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go
index 7a802102d..f55cfbac4 100644
--- a/src/cmd/cgo/gcc.go
+++ b/src/cmd/cgo/gcc.go
@@ -552,8 +552,8 @@ func (p *Package) loadDWARF(f *File, names []*Name) {
n.Const = fmt.Sprintf("%#x", enumVal[i])
}
}
+ conv.FinishType(pos)
}
-
}
// mangleName does name mangling to translate names
@@ -926,6 +926,12 @@ type typeConv struct {
m map[dwarf.Type]*Type
typedef map[string]ast.Expr
+ // Map from types to incomplete pointers to those types.
+ ptrs map[dwarf.Type][]*Type
+
+ // Fields to be processed by godefsField after completing pointers.
+ todoFlds [][]*ast.Field
+
// Predeclared types.
bool ast.Expr
byte ast.Expr // denotes padding
@@ -950,6 +956,7 @@ func (c *typeConv) Init(ptrSize, intSize int64) {
c.ptrSize = ptrSize
c.intSize = intSize
c.m = make(map[dwarf.Type]*Type)
+ c.ptrs = make(map[dwarf.Type][]*Type)
c.bool = c.Ident("bool")
c.byte = c.Ident("byte")
c.int8 = c.Ident("int8")
@@ -1029,6 +1036,32 @@ func (tr *TypeRepr) Set(repr string, fargs ...interface{}) {
tr.FormatArgs = fargs
}
+// FinishType completes any outstanding type mapping work.
+// In particular, it resolves incomplete pointer types and also runs
+// godefsFields on any new struct types.
+func (c *typeConv) FinishType(pos token.Pos) {
+ // Completing one pointer type might produce more to complete.
+ // Keep looping until they're all done.
+ for len(c.ptrs) > 0 {
+ for dtype := range c.ptrs {
+ // Note Type might invalidate c.ptrs[dtype].
+ t := c.Type(dtype, pos)
+ for _, ptr := range c.ptrs[dtype] {
+ ptr.Go.(*ast.StarExpr).X = t.Go
+ ptr.C.Set("%s*", t.C)
+ }
+ delete(c.ptrs, dtype)
+ }
+ }
+
+ // Now that pointer types are completed, we can invoke godefsFields
+ // to rewrite struct definitions.
+ for _, fld := range c.todoFlds {
+ godefsFields(fld)
+ }
+ c.todoFlds = nil
+}
+
// Type returns a *Type with the same memory layout as
// dtype when used as the type of a variable or a struct field.
func (c *typeConv) Type(dtype dwarf.Type, pos token.Pos) *Type {
@@ -1068,13 +1101,12 @@ func (c *typeConv) Type(dtype dwarf.Type, pos token.Pos) *Type {
t.Go = c.Opaque(t.Size)
break
}
- gt := &ast.ArrayType{
- Len: c.intExpr(dt.Count),
- }
- t.Go = gt // publish before recursive call
sub := c.Type(dt.Type, pos)
t.Align = sub.Align
- gt.Elt = sub.Go
+ t.Go = &ast.ArrayType{
+ Len: c.intExpr(dt.Count),
+ Elt: sub.Go,
+ }
t.C.Set("__typeof__(%s[%d])", sub.C, dt.Count)
case *dwarf.BoolType:
@@ -1184,11 +1216,10 @@ func (c *typeConv) Type(dtype dwarf.Type, pos token.Pos) *Type {
break
}
- gt := &ast.StarExpr{}
- t.Go = gt // publish before recursive call
- sub := c.Type(dt.Type, pos)
- gt.X = sub.Go
- t.C.Set("%s*", sub.C)
+ // Placeholder initialization; completed in FinishType.
+ t.Go = &ast.StarExpr{}
+ t.C.Set("<incomplete>*")
+ c.ptrs[dt.Type] = append(c.ptrs[dt.Type], t)
case *dwarf.QualType:
// Ignore qualifier.
@@ -1265,8 +1296,8 @@ func (c *typeConv) Type(dtype dwarf.Type, pos token.Pos) *Type {
}
name := c.Ident("_Ctype_" + dt.Name)
goIdent[name.Name] = name
- t.Go = name // publish before recursive call
sub := c.Type(dt.Type, pos)
+ t.Go = name
t.Size = sub.Size
t.Align = sub.Align
oldType := typedef[name.Name]
@@ -1604,7 +1635,7 @@ func (c *typeConv) Struct(dt *dwarf.StructType, pos token.Pos) (expr *ast.Struct
csyntax = buf.String()
if *godefs || *cdefs {
- godefsFields(fld)
+ c.todoFlds = append(c.todoFlds, fld)
}
expr = &ast.StructType{Fields: &ast.FieldList{List: fld}}
return
diff --git a/src/cmd/gc/array.c b/src/cmd/gc/array.c
index 5e53c1ff0..611fc9fbd 100644
--- a/src/cmd/gc/array.c
+++ b/src/cmd/gc/array.c
@@ -108,20 +108,6 @@ arrayadd(Array *array, void *element)
arrayset(array, array->length - 1, element);
}
-int32
-arrayindexof(Array *array, void *element)
-{
- void *p;
- int32 i;
-
- for(i = 0; i < array->length; i++) {
- p = arrayget(array, i);
- if(memcmp(p, &element, array->size) == 0)
- return i;
- }
- return -1;
-}
-
void
arraysort(Array *array, int (*cmp)(const void*, const void*))
{
diff --git a/src/cmd/gc/bv.c b/src/cmd/gc/bv.c
index 2efbbc565..0e8f8d473 100644
--- a/src/cmd/gc/bv.c
+++ b/src/cmd/gc/bv.c
@@ -9,6 +9,8 @@
enum {
WORDSIZE = sizeof(uint32),
WORDBITS = 32,
+ WORDMASK = WORDBITS - 1,
+ WORDSHIFT = 5,
};
static uintptr
@@ -94,13 +96,35 @@ bvconcat(Bvec *src1, Bvec *src2)
int
bvget(Bvec *bv, int32 i)
{
- uint32 mask, word;
-
if(i < 0 || i >= bv->n)
fatal("bvget: index %d is out of bounds with length %d\n", i, bv->n);
- mask = 1U << (i % WORDBITS);
- word = bv->b[i / WORDBITS] & mask;
- return word ? 1 : 0;
+ return (bv->b[i>>WORDSHIFT] >> (i&WORDMASK)) & 1;
+}
+
+// bvnext returns the smallest index >= i for which bvget(bv, i) == 1.
+// If there is no such index, bvnext returns -1.
+int
+bvnext(Bvec *bv, int32 i)
+{
+ uint32 w;
+
+ // Jump i ahead to next word with bits.
+ if((bv->b[i>>WORDSHIFT]>>(i&WORDMASK)) == 0) {
+ i &= ~WORDMASK;
+ i += WORDBITS;
+ while(i < bv->n && bv->b[i>>WORDSHIFT] == 0)
+ i += WORDBITS;
+ }
+ if(i >= bv->n)
+ return -1;
+
+ // Find 1 bit.
+ w = bv->b[i>>WORDSHIFT]>>(i&WORDMASK);
+ while((w&1) == 0) {
+ w>>=1;
+ i++;
+ }
+ return i;
}
int
@@ -109,7 +133,7 @@ bvisempty(Bvec *bv)
int32 i;
for(i = 0; i < bv->n; i += WORDBITS)
- if(bv->b[i / WORDBITS] != 0)
+ if(bv->b[i>>WORDSHIFT] != 0)
return 0;
return 1;
}
diff --git a/src/cmd/gc/go.h b/src/cmd/gc/go.h
index 413e71069..ee879f67f 100644
--- a/src/cmd/gc/go.h
+++ b/src/cmd/gc/go.h
@@ -1017,7 +1017,6 @@ int32 arraylength(Array *array);
void* arrayget(Array *array, int32 index);
void arrayset(Array *array, int32 index, void *element);
void arrayadd(Array *array, void *element);
-int32 arrayindexof(Array* array, void *element);
void arraysort(Array* array, int (*cmp)(const void*, const void*));
/*
@@ -1043,6 +1042,7 @@ int bvcmp(Bvec *bv1, Bvec *bv2);
void bvcopy(Bvec *dst, Bvec *src);
Bvec* bvconcat(Bvec *src1, Bvec *src2);
int bvget(Bvec *bv, int32 i);
+int32 bvnext(Bvec *bv, int32 i);
int bvisempty(Bvec *bv);
void bvnot(Bvec *bv);
void bvor(Bvec *dst, Bvec *src1, Bvec *src2);
diff --git a/src/cmd/gc/plive.c b/src/cmd/gc/plive.c
index eb8901733..7a40ab559 100644
--- a/src/cmd/gc/plive.c
+++ b/src/cmd/gc/plive.c
@@ -283,13 +283,30 @@ getvariables(Node *fn)
// For arguments and results, the bitmap covers all variables,
// so we must include all the variables, even the ones without
// pointers.
+ //
+ // The Node.opt field is available for use by optimization passes.
+ // We use it to hold the index of the node in the variables array, plus 1
+ // (so that 0 means the Node is not in the variables array).
+ // Each pass should clear opt when done, but you never know,
+ // so clear them all ourselves too.
+ // The Node.curfn field is supposed to be set to the current function
+ // already, but for some compiler-introduced names it seems not to be,
+ // so fix that here.
+ // Later, when we want to find the index of a node in the variables list,
+ // we will check that n->curfn == curfn and n->opt > 0. Then n->opt - 1
+ // is the index in the variables list.
+ ll->n->opt = nil;
+ ll->n->curfn = curfn;
switch(ll->n->class) {
case PAUTO:
- if(haspointers(ll->n->type))
+ if(haspointers(ll->n->type)) {
+ ll->n->opt = (void*)(uintptr)(arraylength(result)+1);
arrayadd(result, &ll->n);
+ }
break;
case PPARAM:
case PPARAMOUT:
+ ll->n->opt = (void*)(uintptr)(arraylength(result)+1);
arrayadd(result, &ll->n);
break;
}
@@ -718,14 +735,16 @@ progeffects(Prog *prog, Array *vars, Bvec *uevar, Bvec *varkill, Bvec *avarinit)
}
if(info.flags & (LeftRead | LeftWrite | LeftAddr)) {
from = &prog->from;
- if (from->node != nil && from->sym != nil) {
+ if (from->node != nil && from->sym != nil && from->node->curfn == curfn) {
switch(from->node->class & ~PHEAP) {
case PAUTO:
case PPARAM:
case PPARAMOUT:
- pos = arrayindexof(vars, from->node);
+ pos = (int)(uintptr)from->node->opt - 1; // index in vars
if(pos == -1)
goto Next;
+ if(pos >= arraylength(vars) || *(Node**)arrayget(vars, pos) != from->node)
+ fatal("bad bookkeeping in liveness %N %d", from->node, pos);
if(from->node->addrtaken) {
bvset(avarinit, pos);
} else {
@@ -741,14 +760,16 @@ progeffects(Prog *prog, Array *vars, Bvec *uevar, Bvec *varkill, Bvec *avarinit)
Next:
if(info.flags & (RightRead | RightWrite | RightAddr)) {
to = &prog->to;
- if (to->node != nil && to->sym != nil) {
+ if (to->node != nil && to->sym != nil && to->node->curfn == curfn) {
switch(to->node->class & ~PHEAP) {
case PAUTO:
case PPARAM:
case PPARAMOUT:
- pos = arrayindexof(vars, to->node);
+ pos = (int)(uintptr)to->node->opt - 1; // index in vars
if(pos == -1)
goto Next1;
+ if(pos >= arraylength(vars) || *(Node**)arrayget(vars, pos) != to->node)
+ fatal("bad bookkeeping in liveness %N %d", to->node, pos);
if(to->node->addrtaken) {
if(prog->as != AVARKILL)
bvset(avarinit, pos);
@@ -1020,6 +1041,9 @@ checkptxt(Node *fn, Prog *firstp)
{
Prog *p;
+ if(debuglive == 0)
+ return;
+
for(p = firstp; p != P; p = p->link) {
if(0)
print("analyzing '%P'\n", p);
@@ -1172,21 +1196,17 @@ twobitlivepointermap(Liveness *lv, Bvec *liveout, Array *vars, Bvec *args, Bvec
vlong xoffset;
int32 i;
- for(i = 0; i < arraylength(vars); i++) {
+ for(i = 0; (i = bvnext(liveout, i)) >= 0; i++) {
node = *(Node**)arrayget(vars, i);
switch(node->class) {
case PAUTO:
- if(bvget(liveout, i)) {
- xoffset = node->xoffset + stkptrsize;
- twobitwalktype1(node->type, &xoffset, locals);
- }
+ xoffset = node->xoffset + stkptrsize;
+ twobitwalktype1(node->type, &xoffset, locals);
break;
case PPARAM:
case PPARAMOUT:
- if(bvget(liveout, i)) {
- xoffset = node->xoffset;
- twobitwalktype1(node->type, &xoffset, args);
- }
+ xoffset = node->xoffset;
+ twobitwalktype1(node->type, &xoffset, args);
break;
}
}
@@ -1937,6 +1957,7 @@ liveness(Node *fn, Prog *firstp, Sym *argssym, Sym *livesym)
Array *cfg, *vars;
Liveness *lv;
int debugdelta;
+ NodeList *l;
// Change name to dump debugging information only for a specific function.
debugdelta = 0;
@@ -1977,6 +1998,9 @@ liveness(Node *fn, Prog *firstp, Sym *argssym, Sym *livesym)
twobitwritesymbol(lv->argslivepointers, argssym);
// Free everything.
+ for(l=fn->dcl; l != nil; l = l->next)
+ if(l->n != N)
+ l->n->opt = nil;
freeliveness(lv);
arrayfree(vars);
freecfg(cfg);
diff --git a/src/pkg/compress/gzip/gzip.go b/src/pkg/compress/gzip/gzip.go
index 3a0bf54e1..5131d128e 100644
--- a/src/pkg/compress/gzip/gzip.go
+++ b/src/pkg/compress/gzip/gzip.go
@@ -245,7 +245,8 @@ func (z *Writer) Flush() error {
return z.err
}
-// Close closes the Writer. It does not close the underlying io.Writer.
+// Close closes the Writer, flushing any unwritten data to the underlying
+// io.Writer, but does not close the underlying io.Writer.
func (z *Writer) Close() error {
if z.err != nil {
return z.err
diff --git a/src/pkg/compress/zlib/writer.go b/src/pkg/compress/zlib/writer.go
index fac7e15a7..3b4313a8b 100644
--- a/src/pkg/compress/zlib/writer.go
+++ b/src/pkg/compress/zlib/writer.go
@@ -174,7 +174,8 @@ func (z *Writer) Flush() error {
return z.err
}
-// Calling Close does not close the wrapped io.Writer originally passed to NewWriter.
+// Close closes the Writer, flushing any unwritten data to the underlying
+// io.Writer, but does not close the underlying io.Writer.
func (z *Writer) Close() error {
if !z.wroteHeader {
z.err = z.writeHeader()
diff --git a/src/pkg/crypto/rsa/pkcs1v15.go b/src/pkg/crypto/rsa/pkcs1v15.go
index d9957aec1..59e8bb5b7 100644
--- a/src/pkg/crypto/rsa/pkcs1v15.go
+++ b/src/pkg/crypto/rsa/pkcs1v15.go
@@ -53,11 +53,14 @@ func DecryptPKCS1v15(rand io.Reader, priv *PrivateKey, ciphertext []byte) (out [
if err := checkPub(&priv.PublicKey); err != nil {
return nil, err
}
- valid, out, err := decryptPKCS1v15(rand, priv, ciphertext)
- if err == nil && valid == 0 {
- err = ErrDecryption
+ valid, out, index, err := decryptPKCS1v15(rand, priv, ciphertext)
+ if err != nil {
+ return
}
-
+ if valid == 0 {
+ return nil, ErrDecryption
+ }
+ out = out[index:]
return
}
@@ -80,21 +83,32 @@ func DecryptPKCS1v15SessionKey(rand io.Reader, priv *PrivateKey, ciphertext []by
}
k := (priv.N.BitLen() + 7) / 8
if k-(len(key)+3+8) < 0 {
- err = ErrDecryption
- return
+ return ErrDecryption
}
- valid, msg, err := decryptPKCS1v15(rand, priv, ciphertext)
+ valid, em, index, err := decryptPKCS1v15(rand, priv, ciphertext)
if err != nil {
return
}
- valid &= subtle.ConstantTimeEq(int32(len(msg)), int32(len(key)))
- subtle.ConstantTimeCopy(valid, key, msg)
+ if len(em) != k {
+ // This should be impossible because decryptPKCS1v15 always
+ // returns the full slice.
+ return ErrDecryption
+ }
+
+ valid &= subtle.ConstantTimeEq(int32(len(em)-index), int32(len(key)))
+ subtle.ConstantTimeCopy(valid, key, em[len(em)-len(key):])
return
}
-func decryptPKCS1v15(rand io.Reader, priv *PrivateKey, ciphertext []byte) (valid int, msg []byte, err error) {
+// decryptPKCS1v15 decrypts ciphertext using priv and blinds the operation if
+// rand is not nil. It returns one or zero in valid that indicates whether the
+// plaintext was correctly structured. In either case, the plaintext is
+// returned in em so that it may be read independently of whether it was valid
+// in order to maintain constant memory access patterns. If the plaintext was
+// valid then index contains the index of the original message in em.
+func decryptPKCS1v15(rand io.Reader, priv *PrivateKey, ciphertext []byte) (valid int, em []byte, index int, err error) {
k := (priv.N.BitLen() + 7) / 8
if k < 11 {
err = ErrDecryption
@@ -107,7 +121,7 @@ func decryptPKCS1v15(rand io.Reader, priv *PrivateKey, ciphertext []byte) (valid
return
}
- em := leftPad(m.Bytes(), k)
+ em = leftPad(m.Bytes(), k)
firstByteIsZero := subtle.ConstantTimeByteEq(em[0], 0)
secondByteIsTwo := subtle.ConstantTimeByteEq(em[1], 2)
@@ -115,8 +129,7 @@ func decryptPKCS1v15(rand io.Reader, priv *PrivateKey, ciphertext []byte) (valid
// octets, followed by a 0, followed by the message.
// lookingForIndex: 1 iff we are still looking for the zero.
// index: the offset of the first zero byte.
- var lookingForIndex, index int
- lookingForIndex = 1
+ lookingForIndex := 1
for i := 2; i < len(em); i++ {
equals0 := subtle.ConstantTimeByteEq(em[i], 0)
@@ -129,8 +142,8 @@ func decryptPKCS1v15(rand io.Reader, priv *PrivateKey, ciphertext []byte) (valid
validPS := subtle.ConstantTimeLessOrEq(2+8, index)
valid = firstByteIsZero & secondByteIsTwo & (^lookingForIndex & 1) & validPS
- msg = em[index+1:]
- return
+ index = subtle.ConstantTimeSelect(valid, index+1, 0)
+ return valid, em, index, nil
}
// nonZeroRandomBytes fills the given slice with non-zero random octets.
diff --git a/src/pkg/crypto/rsa/pkcs1v15_test.go b/src/pkg/crypto/rsa/pkcs1v15_test.go
index 37c14d1d9..2dc5dbc2c 100644
--- a/src/pkg/crypto/rsa/pkcs1v15_test.go
+++ b/src/pkg/crypto/rsa/pkcs1v15_test.go
@@ -227,6 +227,26 @@ func TestUnpaddedSignature(t *testing.T) {
}
}
+func TestShortSessionKey(t *testing.T) {
+ // This tests that attempting to decrypt a session key where the
+ // ciphertext is too small doesn't run outside the array bounds.
+ ciphertext, err := EncryptPKCS1v15(rand.Reader, &rsaPrivateKey.PublicKey, []byte{1})
+ if err != nil {
+ t.Fatalf("Failed to encrypt short message: %s", err)
+ }
+
+ var key [32]byte
+ if err := DecryptPKCS1v15SessionKey(nil, rsaPrivateKey, ciphertext, key[:]); err != nil {
+ t.Fatalf("Failed to decrypt short message: %s", err)
+ }
+
+ for _, v := range key {
+ if v != 0 {
+ t.Fatal("key was modified when ciphertext was invalid")
+ }
+ }
+}
+
// In order to generate new test vectors you'll need the PEM form of this key:
// -----BEGIN RSA PRIVATE KEY-----
// MIIBOgIBAAJBALKZD0nEffqM1ACuak0bijtqE2QrI/KLADv7l3kK3ppMyCuLKoF0
diff --git a/src/pkg/crypto/subtle/constant_time.go b/src/pkg/crypto/subtle/constant_time.go
index de1a4e8c5..9c4b14a65 100644
--- a/src/pkg/crypto/subtle/constant_time.go
+++ b/src/pkg/crypto/subtle/constant_time.go
@@ -49,9 +49,14 @@ func ConstantTimeEq(x, y int32) int {
return int(z & 1)
}
-// ConstantTimeCopy copies the contents of y into x iff v == 1. If v == 0, x is left unchanged.
-// Its behavior is undefined if v takes any other value.
+// ConstantTimeCopy copies the contents of y into x (a slice of equal length)
+// if v == 1. If v == 0, x is left unchanged. Its behavior is undefined if v
+// takes any other value.
func ConstantTimeCopy(v int, x, y []byte) {
+ if len(x) != len(y) {
+ panic("subtle: slices have different lengths")
+ }
+
xmask := byte(v - 1)
ymask := byte(^(v - 1))
for i := 0; i < len(x); i++ {
diff --git a/src/pkg/net/dnsconfig_unix.go b/src/pkg/net/dnsconfig_unix.go
index af288253e..db45716f1 100644
--- a/src/pkg/net/dnsconfig_unix.go
+++ b/src/pkg/net/dnsconfig_unix.go
@@ -75,19 +75,19 @@ func dnsReadConfig(filename string) (*dnsConfig, error) {
for i := 1; i < len(f); i++ {
s := f[i]
switch {
- case len(s) >= 6 && s[0:6] == "ndots:":
+ case hasPrefix(s, "ndots:"):
n, _, _ := dtoi(s, 6)
if n < 1 {
n = 1
}
conf.ndots = n
- case len(s) >= 8 && s[0:8] == "timeout:":
+ case hasPrefix(s, "timeout:"):
n, _, _ := dtoi(s, 8)
if n < 1 {
n = 1
}
conf.timeout = n
- case len(s) >= 8 && s[0:9] == "attempts:":
+ case hasPrefix(s, "attempts:"):
n, _, _ := dtoi(s, 9)
if n < 1 {
n = 1
@@ -103,3 +103,7 @@ func dnsReadConfig(filename string) (*dnsConfig, error) {
return conf, nil
}
+
+func hasPrefix(s, prefix string) bool {
+ return len(s) >= len(prefix) && s[:len(prefix)] == prefix
+}
diff --git a/src/pkg/net/fd_unix.go b/src/pkg/net/fd_unix.go
index b82ecd11c..e22861abb 100644
--- a/src/pkg/net/fd_unix.go
+++ b/src/pkg/net/fd_unix.go
@@ -68,16 +68,19 @@ func (fd *netFD) name() string {
return fd.net + ":" + ls + "->" + rs
}
-func (fd *netFD) connect(la, ra syscall.Sockaddr) error {
+func (fd *netFD) connect(la, ra syscall.Sockaddr, deadline time.Time) error {
// Do not need to call fd.writeLock here,
// because fd is not yet accessible to user,
// so no concurrent operations are possible.
- if err := fd.pd.PrepareWrite(); err != nil {
- return err
- }
switch err := syscall.Connect(fd.sysfd, ra); err {
case syscall.EINPROGRESS, syscall.EALREADY, syscall.EINTR:
case nil, syscall.EISCONN:
+ if !deadline.IsZero() && deadline.Before(time.Now()) {
+ return errTimeout
+ }
+ if err := fd.init(); err != nil {
+ return err
+ }
return nil
case syscall.EINVAL:
// On Solaris we can see EINVAL if the socket has
@@ -92,6 +95,13 @@ func (fd *netFD) connect(la, ra syscall.Sockaddr) error {
default:
return err
}
+ if err := fd.init(); err != nil {
+ return err
+ }
+ if !deadline.IsZero() {
+ fd.setWriteDeadline(deadline)
+ defer fd.setWriteDeadline(noDeadline)
+ }
for {
// Performing multiple connect system calls on a
// non-blocking socket under Unix variants does not
diff --git a/src/pkg/net/fd_windows.go b/src/pkg/net/fd_windows.go
index a1f6bc5f8..d1129dccc 100644
--- a/src/pkg/net/fd_windows.go
+++ b/src/pkg/net/fd_windows.go
@@ -313,10 +313,17 @@ func (fd *netFD) setAddr(laddr, raddr Addr) {
runtime.SetFinalizer(fd, (*netFD).Close)
}
-func (fd *netFD) connect(la, ra syscall.Sockaddr) error {
+func (fd *netFD) connect(la, ra syscall.Sockaddr, deadline time.Time) error {
// Do not need to call fd.writeLock here,
// because fd is not yet accessible to user,
// so no concurrent operations are possible.
+ if err := fd.init(); err != nil {
+ return err
+ }
+ if !deadline.IsZero() {
+ fd.setWriteDeadline(deadline)
+ defer fd.setWriteDeadline(noDeadline)
+ }
if !canUseConnectEx(fd.net) {
return syscall.Connect(fd.sysfd, ra)
}
diff --git a/src/pkg/net/sock_posix.go b/src/pkg/net/sock_posix.go
index a6ef874c9..c80c7d6a2 100644
--- a/src/pkg/net/sock_posix.go
+++ b/src/pkg/net/sock_posix.go
@@ -107,24 +107,18 @@ func (fd *netFD) dial(laddr, raddr sockaddr, deadline time.Time, toAddr func(sys
}
}
}
- if err := fd.init(); err != nil {
- return err
- }
var rsa syscall.Sockaddr
if raddr != nil {
if rsa, err = raddr.sockaddr(fd.family); err != nil {
return err
- } else if rsa != nil {
- if !deadline.IsZero() {
- fd.setWriteDeadline(deadline)
- }
- if err := fd.connect(lsa, rsa); err != nil {
- return err
- }
- fd.isConnected = true
- if !deadline.IsZero() {
- fd.setWriteDeadline(noDeadline)
- }
+ }
+ if err := fd.connect(lsa, rsa, deadline); err != nil {
+ return err
+ }
+ fd.isConnected = true
+ } else {
+ if err := fd.init(); err != nil {
+ return err
}
}
lsa, _ = syscall.Getsockname(fd.sysfd)
diff --git a/src/pkg/net/testdata/resolv.conf b/src/pkg/net/testdata/resolv.conf
index b5972e09c..3841bbf90 100644
--- a/src/pkg/net/testdata/resolv.conf
+++ b/src/pkg/net/testdata/resolv.conf
@@ -3,3 +3,4 @@
domain Home
nameserver 192.168.1.1
options ndots:5 timeout:10 attempts:3 rotate
+options attempts 3
diff --git a/src/pkg/runtime/sys_windows_386.s b/src/pkg/runtime/sys_windows_386.s
index e0c0631cf..576831d2c 100644
--- a/src/pkg/runtime/sys_windows_386.s
+++ b/src/pkg/runtime/sys_windows_386.s
@@ -88,6 +88,10 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$0-0
// fetch g
get_tls(DX)
+ CMPL DX, $0
+ JNE 3(PC)
+ MOVL $0, AX // continue
+ JMP done
MOVL m(DX), AX
CMPL AX, $0
JNE 2(PC)
@@ -100,6 +104,7 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$0-0
CALL runtime·sighandler(SB)
// AX is set to report result back to Windows
+done:
// restore callee-saved registers
MOVL 24(SP), DI
MOVL 20(SP), SI
diff --git a/src/pkg/runtime/sys_windows_amd64.s b/src/pkg/runtime/sys_windows_amd64.s
index 94845903e..d161be6a5 100644
--- a/src/pkg/runtime/sys_windows_amd64.s
+++ b/src/pkg/runtime/sys_windows_amd64.s
@@ -120,6 +120,10 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$0-0
// fetch g
get_tls(DX)
+ CMPQ DX, $0
+ JNE 3(PC)
+ MOVQ $0, AX // continue
+ JMP done
MOVQ m(DX), AX
CMPQ AX, $0
JNE 2(PC)
@@ -132,6 +136,7 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$0-0
CALL runtime·sighandler(SB)
// AX is set to report result back to Windows
+done:
// restore registers as required for windows callback
MOVQ 24(SP), R15
MOVQ 32(SP), R14
diff --git a/src/pkg/runtime/traceback_arm.c b/src/pkg/runtime/traceback_arm.c
index d15244c2a..30f43d54c 100644
--- a/src/pkg/runtime/traceback_arm.c
+++ b/src/pkg/runtime/traceback_arm.c
@@ -128,9 +128,14 @@ runtime·gentraceback(uintptr pc0, uintptr sp0, uintptr lr0, G *gp, int32 skip,
frame.lr = *(uintptr*)frame.sp;
flr = runtime·findfunc(frame.lr);
if(flr == nil) {
- runtime·printf("runtime: unexpected return pc for %s called from %p\n", runtime·funcname(f), frame.lr);
- if(callback != nil)
+ // This happens if you get a profiling interrupt at just the wrong time.
+ // In that context it is okay to stop early.
+ // But if callback is set, we're doing a garbage collection and must
+ // get everything, so crash loudly.
+ if(callback != nil) {
+ runtime·printf("runtime: unexpected return pc for %s called from %p\n", runtime·funcname(f), frame.lr);
runtime·throw("unknown caller pc");
+ }
}
}
diff --git a/src/pkg/runtime/traceback_x86.c b/src/pkg/runtime/traceback_x86.c
index 851504f52..7359cfcc9 100644
--- a/src/pkg/runtime/traceback_x86.c
+++ b/src/pkg/runtime/traceback_x86.c
@@ -214,7 +214,7 @@ runtime·gentraceback(uintptr pc0, uintptr sp0, uintptr lr0, G *gp, int32 skip,
// the SP is two words lower than normal.
sparg = frame.sp;
if(wasnewproc)
- sparg += 2*sizeof(uintreg);
+ sparg += 2*sizeof(uintptr);
// Determine frame's 'continuation PC', where it can continue.
// Normally this is the return address on the stack, but if sigpanic
diff --git a/test/fixedbugs/issue8325.go b/test/fixedbugs/issue8325.go
new file mode 100644
index 000000000..e22fd319d
--- /dev/null
+++ b/test/fixedbugs/issue8325.go
@@ -0,0 +1,31 @@
+// run
+
+// Copyright 2014 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 8325: corrupted byte operations during optimization
+// pass.
+
+package main
+
+const alphanum = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+
+func main() {
+ var bytes = []byte{10, 20, 30, 40, 50}
+
+ for i, b := range bytes {
+ bytes[i] = alphanum[b%byte(len(alphanum))]
+ }
+
+ for _, b := range bytes {
+ switch {
+ case '0' <= b && b <= '9',
+ 'A' <= b && b <= 'Z':
+ default:
+ println("found a bad character", string(b))
+ panic("BUG")
+ }
+
+ }
+}