1
0
mirror of https://github.com/golang/go synced 2024-11-20 06:44:40 -07:00
Commit Graph

30446 Commits

Author SHA1 Message Date
Brad Fitzpatrick
dd1e7b3be0 crypto/x509: update __MAC_OS_X_VERSION_MAX_ALLOWED on Mac
Reportedly, -mmacosx-version-min=10.6 -D__MAC_OS_X_VERSION_MAX_ALLOWED=1060
is problematic.

It means min 10.6 and max 10.6, thus exactly 10.6. But we only support
10.8+.

It never caused us problems, because we build on Macs, but apparently
if you cross-compile from Linux with some Mac compiler SDK thing, then
things break?

This was added in https://golang.org/cl/5700083 for #3131, and the
intent at the time was to pin to exactly 10.6. So it wasn't a mistake,
but it is definitely outdated.

Given that we now support 10.8 as the min, update it to 1080.

Fixes #17732

Change-Id: I6cc8ab6ac62b8638a5025952b830f23e8822b2a6
Reviewed-on: https://go-review.googlesource.com/32580
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Quentin Smith <quentin@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-04 23:02:39 +00:00
Robert Griesemer
039e60ce4e go/types: revert user-visible changes related to aliases
Reason: Decision to back out current alias implementation.
For #16339 (comment).

Change-Id: Ie04f24e529db2d29c5dd2e36413f5f37f628df39
Reviewed-on: https://go-review.googlesource.com/32819
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-11-04 22:28:07 +00:00
Alan Donovan
2c6949ec89 go/types: avoid redundant call to recordUse for anonymous fields
Anonymous fields are type expressions, and Checker.typexpr already
correctly records uses within them.  There's no need for a second
call, and the second call caused a bug when we implemented aliases.

Change-Id: I1bf2429cd4948d68b085e75dfb1bdc03ad8caffd
Reviewed-on: https://go-review.googlesource.com/32837
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-04 21:44:57 +00:00
Michael Munday
cfd89164bb all: make copyright headers consistent with one space after period
Continuation of CL 20111.

Change-Id: Ie2f62237e6ec316989c021de9b267cc9d6ee6676
Reviewed-on: https://go-review.googlesource.com/32830
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-04 20:46:25 +00:00
Vladimir Stefanovic
7f033933ce cmd/compile/internal/gc: add support for GOARCH=mips{,le}
Change-Id: Ida4cd647525abce3441bfcb9fdee059344fe717f
Reviewed-on: https://go-review.googlesource.com/31477
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-11-04 20:15:23 +00:00
Robert Griesemer
87f4e36ce7 Revert "spec: add new language for alias declarations"
This reverts commit aff37662d1.

Reason: Decision to back out current alias implementation.
https://github.com/golang/go/issues/16339#issuecomment-258527920

Fixes #16339.
Fixes #17746.
Fixes #17784.

Change-Id: I5737b830d7f6fb79cf36f26403b4ad8533ba1dfe
Reviewed-on: https://go-review.googlesource.com/32813
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-11-04 19:57:23 +00:00
Vladimir Stefanovic
585a0b03b2 cmd/link/internal/ld: add support for GOARCH=mips{,le}
Change-Id: Ida214ccc5858969ea60abb0787f4d98bab4336d6
Reviewed-on: https://go-review.googlesource.com/31480
TryBot-Result: Gobot Gobot <gobot@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-11-04 19:27:35 +00:00
Vladimir Stefanovic
5bfafff03f cmd/vet: add support for GOARCH=mips{,le}
Change-Id: Ie7b40cc67e9901e252a4a48225bbd745a66d2673
Reviewed-on: https://go-review.googlesource.com/31511
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-11-04 18:26:49 +00:00
Brad Fitzpatrick
2341631506 all: sprinkle t.Parallel on some slow tests
I used the slowtests.go tool as described in
https://golang.org/cl/32684 on packages that stood out.

go test -short std drops from ~56 to ~52 seconds.

This isn't a huge win, but it was mostly an exercise.

Updates #17751

Change-Id: I9f3402e36a038d71e662d06ce2c1d52f6c4b674d
Reviewed-on: https://go-review.googlesource.com/32751
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-04 16:56:57 +00:00
Vladimir Stefanovic
3f69909851 test: disable unsupported test for GOARCH=mips{,le}
External linking on mips/mipsle is not supported yet (issue #17792).

Change-Id: Ic25f4f8fe9e0ec35c72ca9f85c053b398df4952c
Reviewed-on: https://go-review.googlesource.com/31512
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-04 16:46:38 +00:00
Ian Lance Taylor
04d71354eb runtime: remove useless assignment in test code
Change-Id: I5fecdf52e9e3035ea8feb5768985ed5200dbd6af
Reviewed-on: https://go-review.googlesource.com/32752
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Martin Möhrmann <martisch@uos.de>
2016-11-04 14:09:52 +00:00
Emmanuel Odeke
d62b313863 net/http: move extra redirect logic for 307/308 into redirectBehavior
Follow up of CL https://go-review.googlesource.com/32595.

Change-Id: I2b3ff7e6b2c764bb6bc5e9aa692d0aed79eb5626
Reviewed-on: https://go-review.googlesource.com/32750
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-11-04 04:38:56 +00:00
Brad Fitzpatrick
cd670a61c1 net/http: speed up tests, use t.Parallel when it's safe
Before: 8.9 seconds for go test -short
 After: 2.8 seconds

There are still 250 tests without t.Parallel, but I got the important
onces using a script:

    $ go test -short -v 2>&1 | go run ~/slowtests.go

Where slowtests.go is https://play.golang.org/p/9mh5Wg1nLN

The remaining 250 (the output lines from slowtests.go) all have a
reported duration of 0ms, except one 50ms test which has to be serial.

Where tests can't be parallel, I left a comment at the top saying why,
so people don't add t.Parallel later and get surprised at failures.

Updates #17751

Change-Id: Icbe32cbe2b996e23c89f1af6339287fa22af5115
Reviewed-on: https://go-review.googlesource.com/32684
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2016-11-04 04:28:10 +00:00
Josh Bleecher Snyder
9f5859759e cmd/go: fix minor typo in 'go bug'
Change-Id: I6bb594576e174cb0df8d25d11b84f5a4752ebfd6
Reviewed-on: https://go-review.googlesource.com/32683
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-04 04:02:09 +00:00
Brad Fitzpatrick
b5c0470c8d net/http: fix type name in comment
Change-Id: Ia03f993287d2929f35b4c92d00fe25c7243bd8b3
Reviewed-on: https://go-review.googlesource.com/32685
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2016-11-04 03:37:38 +00:00
Brad Fitzpatrick
3440c7bc4c net/http: tweak the new Client 307/308 redirect behavior a bit
This CL tweaks the new (unreleased) 307/308 support added in
https://golang.org/cl/29852 for #10767.

Change 1: if a 307/308 response doesn't have a Location header in its
response (as observed in the wild in #17773), just do what we used to
do in Go 1.7 and earlier, and don't try to follow that redirect.

Change 2: don't follow a 307/308 if we sent a body on the first
request and the caller's Request.GetBody func is nil so we can't
"rewind" the body to send it again.

Updates #17773 (will be fixed more elsewhere)

Change-Id: I183570f7346917828a4b6f7f1773094122a30406
Reviewed-on: https://go-review.googlesource.com/32595
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-04 03:37:26 +00:00
Josh Bleecher Snyder
6e26925626 cmd/objdump: speed up tests
Rebuild cmd/objdump once instead of twice.
Speeds up standalone 'go test cmd/objdump' on my
machine from ~1.4s to ~1s.

Updates #17751

Change-Id: I15fd79cf18c310f892bc28a9e9ca47ee010c989a
Reviewed-on: https://go-review.googlesource.com/32673
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-04 00:50:53 +00:00
Matthew Dempsky
3797446150 cmd/compile: prevent Noalg from breaking user types
Use a separate symbol for reflect metadata for types with Noalg set.

Fixes #17752.

Change-Id: Icb6cade7e3004fc4108f67df61105dc4085cd7e2
Reviewed-on: https://go-review.googlesource.com/32679
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-11-04 00:11:28 +00:00
Vladimir Stefanovic
fa77001648 runtime/internal/sys: add arch defs for GOARCH=mips{,le}
Change-Id: I6288f1fca1ae4c64b3907af700811ee842053020
Reviewed-on: https://go-review.googlesource.com/31472
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-03 23:28:28 +00:00
Vladimir Stefanovic
66fdf433b0 cmd/internal/sys: add support for GOARCH=mips{,le}
Change-Id: I8c6b8839c68818430510702719dca15b8d748fb8
Reviewed-on: https://go-review.googlesource.com/31473
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-03 23:26:26 +00:00
Vladimir Stefanovic
c408266e28 internal/syscall/unix: add randomTrap const for GOARCH=mips{,le}
Change-Id: I76c62a7b79ea526f59f281e933e4fd431539d2da
Reviewed-on: https://go-review.googlesource.com/31486
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-11-03 23:22:07 +00:00
Vladimir Stefanovic
d3a3b74aa1 runtime: 8-byte align the heap_live field for atomic access
mheap_.heap_live is an atomically accessed uint64. It is currently not 8-byte
aligned on 32-bit platforms, which has been okay because it's only accessed via
Xadd64, which doesn't require alignment on 386 or ARM32. However, Xadd64 on
MIPS32 does require 8-byte alignment.

Add a padding field to force 8-byte alignment of heap_live and prevent an
alignment check crash on MIPS32.

Change-Id: I7eddf7883aec7a0a7e0525af5d58ed4338a401d0
Reviewed-on: https://go-review.googlesource.com/31635
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-03 23:19:31 +00:00
Vladimir Stefanovic
58e3bf11fb syscall: add support for GOARCH=mips{,le}
Change-Id: I39a46b2a9412981db1780b688a86fec791f68b6f
Reviewed-on: https://go-review.googlesource.com/31488
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-11-03 23:02:18 +00:00
Brad Fitzpatrick
ad366fdbe4 cmd/dist: add mips and mipsle as GOARCH values
Change-Id: I7a51d5d96a7cb87c40ade5be276136c465010bb9
Reviewed-on: https://go-review.googlesource.com/32596
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Vladimir Stefanovic <vladimir.stefanovic@imgtec.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-03 23:01:51 +00:00
Vladimir Stefanovic
1a07257777 reflect: add support for GOARCH=mips{,le}
Change-Id: I8b0c4bfe1e4c401d5c36a51b937671e6362c73a4
Reviewed-on: https://go-review.googlesource.com/31485
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-11-03 23:01:05 +00:00
Vladimir Stefanovic
3f2b85a8d1 cmd/cgo: add support for GOARCH=mips{,le}
Change-Id: I47c6867fc653c8388ad32e210a8027baa592eda3
Reviewed-on: https://go-review.googlesource.com/31483
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-03 22:56:37 +00:00
Vladimir Stefanovic
d1e9104fb2 math, math/big: add support for GOARCH=mips{,le}
Change-Id: I54e100cced5b49674937fb87d1e0f585f962aeb7
Reviewed-on: https://go-review.googlesource.com/31484
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-11-03 22:55:06 +00:00
Vladimir Stefanovic
9788e3d4d7 sync/atomic: add support for GOARCH=mips{,le}
Change-Id: I10f36710dd95b9bd31b3b82a3c32edcadb90ffa9
Reviewed-on: https://go-review.googlesource.com/31510
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-11-03 22:48:09 +00:00
Vladimir Stefanovic
b241a06479 runtime/internal/atomic: add GOARCH=mips{,le} support
Change-Id: I99a48f719fd1a8178fc59787084a074e91c89ac6
Reviewed-on: https://go-review.googlesource.com/31489
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-11-03 22:43:50 +00:00
Vladimir Stefanovic
2c39e50995 debug/elf: add support for GOARCH=mips{,le}
Change-Id: Ia6f8ae7e56a49ad66b60a24c4afb606f3cfe5efd
Reviewed-on: https://go-review.googlesource.com/31482
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-11-03 22:38:25 +00:00
Brad Fitzpatrick
26827bc2fe testing: add T.Context method
From the doc comment:

Context returns the context for the current test or benchmark.
The context is cancelled when the test or benchmark finishes.
A goroutine started during a test or benchmark can wait for the
context's Done channel to become readable as a signal that the
test or benchmark is over, so that the goroutine can exit.

Fixes #16221.
Fixes #17552.

Change-Id: I657df946be2c90048cc74615436c77c7d9d1226c
Reviewed-on: https://go-review.googlesource.com/31724
Reviewed-by: Rob Pike <r@golang.org>
2016-11-03 21:14:30 +00:00
Russ Cox
606f81eef3 context: adjust tests to avoid importing "testing" in package context
So that testing can use context in its public API.

For #16221.

Change-Id: I6263fa7266c336c9490f20164ce79336df44a57e
Reviewed-on: https://go-review.googlesource.com/32648
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-03 21:12:21 +00:00
Emmanuel Odeke
2b59b15f6b encoding/json: example on MarshalJSON, UnmarshalJSON
Updates #16360.

Change-Id: I5bf13d3367e68c5d8435f6ef2161d5a74cc747a7
Reviewed-on: https://go-review.googlesource.com/29611
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-11-03 20:18:52 +00:00
Russ Cox
43f954e098 testing: mark tests and benchmarks failed if a race occurs during execution
Before:

$ go test -race -v -run TestRace
=== RUN   TestRace
==================
WARNING: DATA RACE
Write at 0x00c420076420 by goroutine 7:
  _/Users/rsc/go/src/cmd/go/testdata/src/testrace.TestRace.func1()
      /Users/rsc/go/src/cmd/go/testdata/src/testrace/race_test.go:10 +0x3b

Previous write at 0x00c420076420 by goroutine 6:
  _/Users/rsc/go/src/cmd/go/testdata/src/testrace.TestRace()
      /Users/rsc/go/src/cmd/go/testdata/src/testrace/race_test.go:13 +0xcc
  testing.tRunner()
      /Users/rsc/go/src/testing/testing.go:656 +0x104

Goroutine 7 (running) created at:
  _/Users/rsc/go/src/cmd/go/testdata/src/testrace.TestRace()
      /Users/rsc/go/src/cmd/go/testdata/src/testrace/race_test.go:12 +0xbb
  testing.tRunner()
      /Users/rsc/go/src/testing/testing.go:656 +0x104

Goroutine 6 (running) created at:
  testing.(*T).Run()
      /Users/rsc/go/src/testing/testing.go:693 +0x536
  testing.runTests.func1()
      /Users/rsc/go/src/testing/testing.go:877 +0xaa
  testing.tRunner()
      /Users/rsc/go/src/testing/testing.go:656 +0x104
  testing.runTests()
      /Users/rsc/go/src/testing/testing.go:883 +0x4ac
  testing.(*M).Run()
      /Users/rsc/go/src/testing/testing.go:818 +0x1c3
  main.main()
      _/Users/rsc/go/src/cmd/go/testdata/src/testrace/_test/_testmain.go:42 +0x20f
==================
--- PASS: TestRace (0.00s)
PASS
Found 1 data race(s)
FAIL	_/Users/rsc/go/src/cmd/go/testdata/src/testrace	1.026s
$

After:

$ go test -race -v -run TestRace
=== RUN   TestRace
==================
WARNING: DATA RACE
Write at 0x00c420076420 by goroutine 7:
  _/Users/rsc/go/src/cmd/go/testdata/src/testrace.TestRace.func1()
      /Users/rsc/go/src/cmd/go/testdata/src/testrace/race_test.go:10 +0x3b

Previous write at 0x00c420076420 by goroutine 6:
  _/Users/rsc/go/src/cmd/go/testdata/src/testrace.TestRace()
      /Users/rsc/go/src/cmd/go/testdata/src/testrace/race_test.go:13 +0xcc
  testing.tRunner()
      /Users/rsc/go/src/testing/testing.go:656 +0x104

Goroutine 7 (running) created at:
  _/Users/rsc/go/src/cmd/go/testdata/src/testrace.TestRace()
      /Users/rsc/go/src/cmd/go/testdata/src/testrace/race_test.go:12 +0xbb
  testing.tRunner()
      /Users/rsc/go/src/testing/testing.go:656 +0x104

Goroutine 6 (running) created at:
  testing.(*T).Run()
      /Users/rsc/go/src/testing/testing.go:693 +0x536
  testing.runTests.func1()
      /Users/rsc/go/src/testing/testing.go:877 +0xaa
  testing.tRunner()
      /Users/rsc/go/src/testing/testing.go:656 +0x104
  testing.runTests()
      /Users/rsc/go/src/testing/testing.go:883 +0x4ac
  testing.(*M).Run()
      /Users/rsc/go/src/testing/testing.go:818 +0x1c3
  main.main()
      _/Users/rsc/go/src/cmd/go/testdata/src/testrace/_test/_testmain.go:42 +0x20f
==================
--- FAIL: TestRace (0.00s)
	testing.go:609: race detected during execution of test
FAIL
FAIL	_/Users/rsc/go/src/cmd/go/testdata/src/testrace	0.022s
$

Fixes #15972.

Change-Id: Idb15b8ab81d65637bb535c7e275595ca4a6e450e
Reviewed-on: https://go-review.googlesource.com/32615
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-03 18:19:49 +00:00
Dan Harrington
f3862742b6 net/http: support If-Match in ServeContent
- Added support for If-Match and If-Unmodified-Since.
- Precondition checks now more strictly follow RFC 7232 section 6, which
affects precedence when multiple condition headers are present.
- When serving a 304, Last-Modified header is now removed when no ETag is
present (as suggested by RFC 7232 section 4.1).
- If-None-Match supports multiple ETags.
- ETag comparison now correctly handles weak ETags.

Fixes #17572

Change-Id: I35039dea6811480ccf2889f8ed9c6a39ce34bfff
Reviewed-on: https://go-review.googlesource.com/32014
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-03 18:14:56 +00:00
Robert Griesemer
18f0e88103 go/internal/gcimporter: backport changes from x/tools/go/gcimporter15
See https://go-review.googlesource.com/32581.

This makes x/tools/go/gcimporter15/bimport.go a close copy again
and the importer more robust.

Change-Id: If96ad6acd611878b7dfa6a13d005d847ece82ab6
Reviewed-on: https://go-review.googlesource.com/32647
TryBot-Result: Gobot Gobot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-11-03 18:10:35 +00:00
Mohit Agarwal
322436b78c cmd/compile: don't panic if syntax.ReadFile returns an error
Fixes #17772

Change-Id: I0f2094400c454828aa57a8d172dadeac4ddb6d35
Reviewed-on: https://go-review.googlesource.com/32691
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-11-03 18:05:38 +00:00
David Chase
4141054d19 runtime/cgo: correct type declaration for Windows
Newer versions of gcc notice a type mismatch and complain.
Fix code to match documented signature in MSDN.
Trybots say this still compiles with the older (5.1) version
of gcc.

Fixes #17771.

Change-Id: Ib3fe6f71b40751e1146249e31232da5ac69b9e00
Reviewed-on: https://go-review.googlesource.com/32646
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-03 17:42:01 +00:00
Russ Cox
b89135777b crypto/x509: expose UnknownAuthorityError.Cert
This matches exposing CertificateInvalidError.Cert.
and (exposing but not the spelling of) HostnameError.Certificate.

Fixes #13519.

Change-Id: Ifae9a09e063d642c09de3cdee8a728ff06d3a5df
Reviewed-on: https://go-review.googlesource.com/32644
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-03 17:26:23 +00:00
Russ Cox
b2290229c2 cmd/cgo: add #line directives to avoid printing bogus references to Go source files
A bit contrived to come up with an example, but it happened in #15836, somehow.

	$ cat /tmp/x.go
	package main

	/*
	#include <stddef.h>

	int foo(void);

	int foo(void) {
		return 2;
	}

	#define int asdf
	*/
	import "C"

	func main() {
		println(C.foo())
	}

	$ go run /tmp/x.go
	# command-line-arguments
	cgo-builtin-prolog:9:31: error: unknown type name 'asdf'   <<<<<
	_GoString_ GoStringN(char *p, int l);
	                              ^
	/tmp/x.go:12:13: note: expanded from macro 'int'
	#define int asdf
	            ^
	cgo-builtin-prolog:10:28: error: unknown type name 'asdf'  <<<<<
	_GoBytes_ GoBytes(void *p, int n);
	                           ^
	/tmp/x.go:12:13: note: expanded from macro 'int'
	#define int asdf
	            ^
	2 errors generated.

The two marked lines used to refer incorrectly to /tmp/x.go.

Fixes #15836.

Change-Id: I08ef60a53cfd148112fceb651eaf7b75d94a7a8d
Reviewed-on: https://go-review.googlesource.com/32613
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-03 16:35:25 +00:00
Russ Cox
a4a4d43028 cmd/cover: change covered block for switch/select case to exclude expression
Consider a switch like

	switch x {
	case foo:
		f()
		g()
	}

Before, the coverage annotation for the block calling f and g included
in its position span the text for 'case foo:'. This looks nice in the coverage
report, but it breaks the invariant that coverage blocks are disjoint if
you have a more complex expression like:

	switch x {
	case func() int { return foo }():
		f()
		g()
	}

Then the coverage analysis wants to annotate the func literal body,
which overlaps with the case body, because the case body is considered
to begin at the case token.

Change the annotation for a case body to start just after the colon of
the case clause, avoiding any potential conflict with complex case
expressions. Could have started at the colon instead, but it seemed
less weird to start just after it.

Fixes #16540.

Change-Id: I1fec4bc2a53c7092e649dc0d4be1680a697cb79b
Reviewed-on: https://go-review.googlesource.com/32612
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-11-03 16:13:06 +00:00
Russ Cox
95e809f0e5 cmd/go: clear GIT_ALLOW_PROTOCOL during tests
Clear it before any tests begin.
Clear it again after TestIsSecureGitAllowProtocol sets it.

Fixes #17700.

Change-Id: I6ea50d37f8222d8c7c9fee0b1eac3bbdfb5d133e
Reviewed-on: https://go-review.googlesource.com/32640
Reviewed-by: Quentin Smith <quentin@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
2016-11-03 16:08:35 +00:00
Russ Cox
a35decf5a7 cmd/go: fix TestIssue11457
The goal of the test is to provoke a custom import path check error,
which will contain the current repo path, to see that it says ssh:// in it.

But the fix to #16471 made the test no longer provoke that error.
Provoke the error by checking out from rsc.io instead of github.com/rsc.

Fixes #17701.

Change-Id: I750ffda2ff59c2be8e111d26160997214a73fd9a
Reviewed-on: https://go-review.googlesource.com/32641
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-03 16:07:08 +00:00
Russ Cox
5f9fb1ce02 cmd/go: remove .o and .a files in builder.collect
This matches the removal of .so files and makes the processing
of '-L/path/to -lfoo' and plain '/path/to/foo.a' match.

Fixes #16463.

Change-Id: I1464c5390d7eb6a3a33b4b2c951f87ef392ec94a
Reviewed-on: https://go-review.googlesource.com/32642
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-03 16:06:37 +00:00
Russ Cox
23e6e11245 encoding/asn1: document that default:x tag only has meaning with optional tag
Fixes #16712.

Change-Id: Ib216059c6c0c952162c19e080dcf3799f0652a8d
Reviewed-on: https://go-review.googlesource.com/32171
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Quentin Smith <quentin@golang.org>
2016-11-03 16:04:55 +00:00
Russ Cox
ced137fad4 misc/cgo/testsanitizers: skip tests when vm.overcommit_memory=2
Fixes #17689.

Change-Id: I45a14e6bf4b2647431105f3e0b63b7076b6655d2
Reviewed-on: https://go-review.googlesource.com/32635
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-03 16:04:33 +00:00
Russ Cox
3345802e8a time: document that only Jan and January, Mon and Monday are recognized
Not "J", not "JAN", not "jan", etc.

Fixes #17523.

Change-Id: I16b5da97e73d88c6680c36401d30f8a195061527
Reviewed-on: https://go-review.googlesource.com/32636
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-11-03 16:04:14 +00:00
Russ Cox
1c08c728dc cmd/go: fix coverage in xtest of cgo package
Cover-annotated cgo-rebuilt package for xtest was
not linked into package graph and so not being rebuilt.
Link into package graph.

Fixes #13625.

Change-Id: I685f7276f92bbc85fbc4b389111c83d9fe517637
Reviewed-on: https://go-review.googlesource.com/32614
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-03 16:03:30 +00:00
Russ Cox
3ce46e3e9c cmd/go: fix TestGoGetDashTIssue8181
The test case was importing golang.org/x/build/cmd/cl,
which is a package main and cannot be imported.
The test case (stored in a separate repo) has been changed
to import golang.org/x/build/gerrit. Update the test accordingly.

Fixes #17702.

Change-Id: I80e150092111b5a04bb00c992b32edb271edb086
Reviewed-on: https://go-review.googlesource.com/32616
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-03 16:02:19 +00:00
Russ Cox
9efcdd4e69 cmd/go: use new HTTP-only server insecure.go-get-issue-15410.appspot.com instead of wh3rd.net
Fixes #15410.

Change-Id: I9964d0162a3cae690afeb889b1822cf79c80b89a
Reviewed-on: https://go-review.googlesource.com/32639
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-11-03 16:02:07 +00:00