lib/time/update.bash | 4 ++-- src/cmd/go/alldocs.go | 3 ++- src/cmd/go/build.go | 3 ++- src/cmd/go/go_test.go | 86 ++++++++++++++++++++++++++++++++++++++++++++++++----- src/cmd/go/pkg.go | 9 ++++++--- src/cmd/vet/cgo.go | 3 +++ src/cmd/vet/testdata/cgo2.go | 9 +++++++++ src/net/http/httputil/reverseproxy.go | 5 +++-- src/net/http/httputil/reverseproxy_test.go | 8 ++++++++ src/net/http/transport_test.go | 5 ++--- src/runtime/pprof/pprof_test.go | 14 ++++++++------ src/sync/waitgroup_test.go | 11 ++++++++--- diff --git a/lib/time/update.bash b/lib/time/update.bash index 3ffadc2ab4c07d333b1aad5432d37486e3908048..86b1f211000b4017ecb08b7263a65747346c09bf 100755 --- a/lib/time/update.bash +++ b/lib/time/update.bash @@ -8,8 +8,8 @@ # downloaded from the ICANN/IANA distribution. # Consult http://www.iana.org/time-zones for the latest versions. # Versions to use. -CODE=2015g -DATA=2015g +CODE=2016a +DATA=2016a set -e rm -rf work diff --git a/lib/time/zoneinfo.zip b/lib/time/zoneinfo.zip index 740d81988b194a75737abfae5c1005e5bf2a6d53..0207d6bcbc6a1edc4372b2d4737a108344982866 100644 Binary files a/lib/time/zoneinfo.zip and b/lib/time/zoneinfo.zip differ diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go index 5db4bc6beca4d4d9a31791a26a96e5fa112719e9..c81bd40864a3c74bc36a8f40f00893bc9dd9b74b 100644 --- a/src/cmd/go/alldocs.go +++ b/src/cmd/go/alldocs.go @@ -93,7 +93,8 @@ enable data race detection. Supported only on linux/amd64, freebsd/amd64, darwin/amd64 and windows/amd64. -msan enable interoperation with memory sanitizer. - Supported only on linux/amd64. + Supported only on linux/amd64, + and only with Clang/LLVM as the host C compiler. -v print the names of packages as they are compiled. -work diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go index 12867004aadda7632d4f40271463656d80183e4a..a1f925ed0ba2d7b8c26410150a78bd299c56edb8 100644 --- a/src/cmd/go/build.go +++ b/src/cmd/go/build.go @@ -72,7 +72,8 @@ enable data race detection. Supported only on linux/amd64, freebsd/amd64, darwin/amd64 and windows/amd64. -msan enable interoperation with memory sanitizer. - Supported only on linux/amd64. + Supported only on linux/amd64, + and only with Clang/LLVM as the host C compiler. -v print the names of packages as they are compiled. -work diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go index 0136ba4b1b1c3bdd523e019e4cd4a77074380a11..6d12f7507396540fb0f4ad77cf4c382f04645c69 100644 --- a/src/cmd/go/go_test.go +++ b/src/cmd/go/go_test.go @@ -657,6 +657,9 @@ tg.run("install", "math") // should be up to date already but just in case tg.setenv("TESTGO_IS_GO_RELEASE", "0") tg.run("build", "-v", "-a", "math") tg.grepStderr("runtime", "testgo build -a math in dev branch DID NOT build runtime, but should have") + + // Everything is out of date. Rebuild to leave things in a better state. + tg.run("install", "std") } func TestGoBuildDashAInReleaseBranch(t *testing.T) { @@ -672,11 +675,80 @@ tg.run("install", "-v", "-a", "math") tg.grepStderr("runtime", "testgo build -a math in release branch DID NOT build runtime, but should have") // Now runtime.a is updated (newer mtime), so everything would look stale if not for being a release. - // tg.run("build", "-v", "net/http") tg.grepStderrNot("strconv", "testgo build -v net/http in release branch with newer runtime.a DID build strconv but should not have") tg.grepStderrNot("golang.org/x/net/http2/hpack", "testgo build -v net/http in release branch with newer runtime.a DID build .../golang.org/x/net/http2/hpack but should not have") tg.grepStderrNot("net/http", "testgo build -v net/http in release branch with newer runtime.a DID build net/http but should not have") + + // Everything is out of date. Rebuild to leave things in a better state. + tg.run("install", "std") +} + +func TestNewReleaseRebuildsStalePackagesInGOPATH(t *testing.T) { + if testing.Short() { + t.Skip("don't rebuild the standard library in short mode") + } + + tg := testgo(t) + defer tg.cleanup() + + addNL := func(name string) (restore func()) { + data, err := ioutil.ReadFile(name) + if err != nil { + t.Fatal(err) + } + old := data + data = append(data, '\n') + if err := ioutil.WriteFile(name, append(data, '\n'), 0666); err != nil { + t.Fatal(err) + } + tg.sleep() + return func() { + if err := ioutil.WriteFile(name, old, 0666); err != nil { + t.Fatal(err) + } + } + } + + tg.setenv("TESTGO_IS_GO_RELEASE", "1") + + tg.tempFile("d1/src/p1/p1.go", `package p1`) + tg.setenv("GOPATH", tg.path("d1")) + tg.run("install", "-a", "p1") + tg.wantNotStale("p1", "./testgo list claims p1 is stale, incorrectly") + tg.sleep() + + // Changing mtime and content of runtime/internal/sys/sys.go + // should have no effect: we're in a release, which doesn't rebuild + // for general mtime or content changes. + sys := runtime.GOROOT() + "/src/runtime/internal/sys/sys.go" + restore := addNL(sys) + defer restore() + tg.wantNotStale("p1", "./testgo list claims p1 is stale, incorrectly, after updating runtime/internal/sys/sys.go") + restore() + tg.wantNotStale("p1", "./testgo list claims p1 is stale, incorrectly, after restoring runtime/internal/sys/sys.go") + + // But changing runtime/internal/sys/zversion.go should have an effect: + // that's how we tell when we flip from one release to another. + zversion := runtime.GOROOT() + "/src/runtime/internal/sys/zversion.go" + restore = addNL(zversion) + defer restore() + tg.wantStale("p1", "./testgo list claims p1 is NOT stale, incorrectly, after changing to new release") + restore() + tg.wantNotStale("p1", "./testgo list claims p1 is stale, incorrectly, after changing back to old release") + addNL(zversion) + tg.wantStale("p1", "./testgo list claims p1 is NOT stale, incorrectly, after changing again to new release") + tg.run("install", "p1") + tg.wantNotStale("p1", "./testgo list claims p1 is stale after building with new release") + + // Restore to "old" release. + restore() + tg.wantStale("p1", "./testgo list claims p1 is NOT stale, incorrectly, after changing to old release after new build") + tg.run("install", "p1") + tg.wantNotStale("p1", "./testgo list claims p1 is stale after building with old release") + + // Everything is out of date. Rebuild to leave things in a better state. + tg.run("install", "std") } func TestGoListStandard(t *testing.T) { @@ -756,8 +828,8 @@ func F() {}`) sep := string(filepath.ListSeparator) tg.setenv("GOPATH", tg.path("d1")+sep+tg.path("d2")) tg.run("install", "p1") - tg.wantNotStale("p1", "./testgo list mypkg claims p1 is stale, incorrectly") - tg.wantNotStale("p2", "./testgo list mypkg claims p2 is stale, incorrectly") + tg.wantNotStale("p1", "./testgo list claims p1 is stale, incorrectly") + tg.wantNotStale("p2", "./testgo list claims p2 is stale, incorrectly") tg.sleep() if f, err := os.OpenFile(tg.path("d2/src/p2/p2.go"), os.O_WRONLY|os.O_APPEND, 0); err != nil { t.Fatal(err) @@ -766,12 +838,12 @@ t.Fatal(err) } else { tg.must(f.Close()) } - tg.wantStale("p2", "./testgo list mypkg claims p2 is NOT stale, incorrectly") - tg.wantStale("p1", "./testgo list mypkg claims p1 is NOT stale, incorrectly") + tg.wantStale("p2", "./testgo list claims p2 is NOT stale, incorrectly") + tg.wantStale("p1", "./testgo list claims p1 is NOT stale, incorrectly") tg.run("install", "p1") - tg.wantNotStale("p2", "./testgo list mypkg claims p2 is stale after reinstall, incorrectly") - tg.wantNotStale("p1", "./testgo list mypkg claims p1 is stale after reinstall, incorrectly") + tg.wantNotStale("p2", "./testgo list claims p2 is stale after reinstall, incorrectly") + tg.wantNotStale("p1", "./testgo list claims p1 is stale after reinstall, incorrectly") } func TestGoInstallDetectsRemovedFiles(t *testing.T) { diff --git a/src/cmd/go/pkg.go b/src/cmd/go/pkg.go index 95a06ffedcd8b7deced2782677f0fb031bd08b87..a804ccd277cfdff699efff776e337543f5f8678c 100644 --- a/src/cmd/go/pkg.go +++ b/src/cmd/go/pkg.go @@ -1542,11 +1542,14 @@ for _, file := range inputFiles { fmt.Fprintf(h, "file %s\n", file) } - // Include the content of runtime/zversion.go in the hash + // Include the content of runtime/internal/sys/zversion.go in the hash // for package runtime. This will give package runtime a // different build ID in each Go release. - if p.Standard && p.ImportPath == "runtime" { - data, _ := ioutil.ReadFile(filepath.Join(p.Dir, "zversion.go")) + if p.Standard && p.ImportPath == "runtime/internal/sys" { + data, err := ioutil.ReadFile(filepath.Join(p.Dir, "zversion.go")) + if err != nil { + fatalf("go: %s", err) + } fmt.Fprintf(h, "zversion %q\n", string(data)) } diff --git a/src/cmd/vet/cgo.go b/src/cmd/vet/cgo.go index 8807952b48ab867767e506400b196ab4a90a8cd8..1985a86fe0100146138a674e53620e8dbf4b7a1a 100644 --- a/src/cmd/vet/cgo.go +++ b/src/cmd/vet/cgo.go @@ -72,6 +72,9 @@ break } // Here arg is *f(v). t := f.pkg.types[call.Fun].Type + if t == nil { + break + } ptr, ok := t.Underlying().(*types.Pointer) if !ok { break diff --git a/src/cmd/vet/testdata/cgo2.go b/src/cmd/vet/testdata/cgo2.go new file mode 100644 index 0000000000000000000000000000000000000000..276aea961937dc6d0f5ce3af0105650b14bcfbaf --- /dev/null +++ b/src/cmd/vet/testdata/cgo2.go @@ -0,0 +1,9 @@ +// Copyright 2016 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. + +// Test the cgo checker on a file that doesn't use cgo. + +package testdata + +var _ = C.f(*p(**p)) diff --git a/src/net/http/httputil/reverseproxy.go b/src/net/http/httputil/reverseproxy.go index 4dba352a4fa5110f94c2e3a012533fc2784e639f..54411caeca8f90472cf0aa220d53bf906bee0f79 100644 --- a/src/net/http/httputil/reverseproxy.go +++ b/src/net/http/httputil/reverseproxy.go @@ -106,11 +106,12 @@ // Hop-by-hop headers. These are removed when sent to the backend. // http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html var hopHeaders = []string{ "Connection", + "Proxy-Connection", // non-standard but still sent by libcurl and rejected by e.g. google "Keep-Alive", "Proxy-Authenticate", "Proxy-Authorization", - "Te", // canonicalized version of "TE" - "Trailers", + "Te", // canonicalized version of "TE" + "Trailer", // not Trailers per URL above; http://www.rfc-editor.org/errata_search.php?eid=4522 "Transfer-Encoding", "Upgrade", } diff --git a/src/net/http/httputil/reverseproxy_test.go b/src/net/http/httputil/reverseproxy_test.go index 7f203d878f544ec5d222c6b91447542411296fe5..0849427b85cce40f6e7a262d0db2806c2bb8f209 100644 --- a/src/net/http/httputil/reverseproxy_test.go +++ b/src/net/http/httputil/reverseproxy_test.go @@ -45,9 +45,13 @@ } if c := r.Header.Get("Upgrade"); c != "" { t.Errorf("handler got Upgrade header value %q", c) } + if c := r.Header.Get("Proxy-Connection"); c != "" { + t.Errorf("handler got Proxy-Connection header value %q", c) + } if g, e := r.Host, "some-name"; g != e { t.Errorf("backend got Host header %q, want %q", g, e) } + w.Header().Set("Trailers", "not a special header field name") w.Header().Set("Trailer", "X-Trailer") w.Header().Set("X-Foo", "bar") w.Header().Set("Upgrade", "foo") @@ -71,6 +75,7 @@ getReq, _ := http.NewRequest("GET", frontend.URL, nil) getReq.Host = "some-name" getReq.Header.Set("Connection", "close") + getReq.Header.Set("Proxy-Connection", "should be deleted") getReq.Header.Set("Upgrade", "foo") getReq.Close = true res, err := http.DefaultClient.Do(getReq) @@ -85,6 +90,9 @@ t.Errorf("got X-Foo %q; expected %q", g, e) } if c := res.Header.Get(fakeHopHeader); c != "" { t.Errorf("got %s header value %q", fakeHopHeader, c) + } + if g, e := res.Header.Get("Trailers"), "not a special header field name"; g != e { + t.Errorf("header Trailers = %q; want %q", g, e) } if g, e := len(res.Header["X-Multi-Value"]), 2; g != e { t.Errorf("got %d X-Multi-Value header values; expected %d", g, e) diff --git a/src/net/http/transport_test.go b/src/net/http/transport_test.go index 3b2a5f978e263557feca946c0f1af4eed838cf86..8cb89a4220b7ca554cca0b5f1cd95863d1cb79c9 100644 --- a/src/net/http/transport_test.go +++ b/src/net/http/transport_test.go @@ -2208,9 +2208,8 @@ // Trying to repro golang.org/issue/3514 func TestTLSServerClosesConnection(t *testing.T) { defer afterTest(t) - if runtime.GOOS == "windows" { - t.Skip("skipping flaky test on Windows; golang.org/issue/7634") - } + setFlaky(t, 7634) + closedc := make(chan bool, 1) ts := httptest.NewTLSServer(HandlerFunc(func(w ResponseWriter, r *Request) { if strings.Contains(r.URL.Path, "/keep-alive-then-die") { diff --git a/src/runtime/pprof/pprof_test.go b/src/runtime/pprof/pprof_test.go index 621d21d3272faa36b527dd52ea501c142f36fee3..ab6b1835c570d66ef43e84a319a40237595ea2a5 100644 --- a/src/runtime/pprof/pprof_test.go +++ b/src/runtime/pprof/pprof_test.go @@ -96,7 +96,7 @@ // 5 for the header, 3 for the trailer. if l < 5+3 { t.Logf("profile too short: %#x", val) if badOS[runtime.GOOS] { - t.Skipf("ignoring failure on %s; see golang.org/issue/6047", runtime.GOOS) + t.Skipf("ignoring failure on %s; see golang.org/issue/13841", runtime.GOOS) return } t.FailNow() @@ -171,7 +171,7 @@ } } if badOS[runtime.GOOS] { - t.Skipf("ignoring failure on %s; see golang.org/issue/6047", runtime.GOOS) + t.Skipf("ignoring failure on %s; see golang.org/issue/13841", runtime.GOOS) return } // Ignore the failure if the tests are running in a QEMU-based emulator, @@ -420,11 +420,13 @@ x = make([]byte, 1024) return deepStack(depth-1) + 1 } -// Operating systems that are expected to fail the tests. See issue 6047. +// Operating systems that are expected to fail the tests. See issue 13841. var badOS = map[string]bool{ - "darwin": true, - "netbsd": true, - "plan9": true, + "darwin": true, + "netbsd": true, + "plan9": true, + "dragonfly": true, + "solaris": true, } func TestBlockProfile(t *testing.T) { diff --git a/src/sync/waitgroup_test.go b/src/sync/waitgroup_test.go index a5816609408d9b3a2aa654a9a356844c8ec31a6e..8ec34fd343bee1332934b676c9b33a598b9c6afa 100644 --- a/src/sync/waitgroup_test.go +++ b/src/sync/waitgroup_test.go @@ -128,13 +128,16 @@ t.Fatalf("Unexpected panic: %#v", err) } }() defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(4)) - done := make(chan interface{}, 1) + done := make(chan interface{}, 2) // The detection is opportunistically, so we want it to panic // at least in one run out of a million. for i := 0; i < 1e6; i++ { var wg WaitGroup wg.Add(1) go func() { + defer func() { + done <- recover() + }() wg.Done() }() go func() { @@ -150,8 +153,10 @@ }() wg.Wait() }() wg.Wait() - if err := <-done; err != nil { - panic(err) + for j := 0; j < 2; j++ { + if err := <-done; err != nil { + panic(err) + } } } t.Fatal("Should panic")