1
0
mirror of https://github.com/golang/go synced 2024-10-05 07:11:22 -06:00
Commit Graph

18781 Commits

Author SHA1 Message Date
Ian Lance Taylor
1a040c9230 cmd/cgo: static variables in the preamble may not be referenced
This is a documentation fix that reflects the current reality.

Fixes #9673.

Change-Id: Ie436b277dfd1b68b13c67813d29c238d2c23b820
Reviewed-on: https://go-review.googlesource.com/11221
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-19 01:08:43 +00:00
Ian Lance Taylor
679fd5b447 cmd/go: do not permit importing a main package
Fixes #4210.

Change-Id: Id981814a6e55a57403ce7a8ac45ab3ba081a3a86
Reviewed-on: https://go-review.googlesource.com/10925
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-19 01:06:36 +00:00
Ian Lance Taylor
18d9a8d05f cmd/go: format temporary Go files in testsuite
Indent the temporary file source code embedded in go_test.go, so that
we don't have temporary Go code in the first column.

No real changes to the tests, just formatting.

Change-Id: I416b4a812c8db452ea61afe63a00989ec598c228
Reviewed-on: https://go-review.googlesource.com/10926
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-19 00:53:56 +00:00
Andrey Petrov
9f3a2d5f9a doc: clarify duplicate symbol condition in cgo
Spell out what will happen if a declaration and definition is included
in the same file, should help people who run into duplicate symbol
errors and search for relevant keywords.

This edit is based on opening issue #11263 erroneously.

Change-Id: I0645a9433b8668d2ede9b9a3f6550d802c26388b
Reviewed-on: https://go-review.googlesource.com/11247
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-19 00:48:42 +00:00
Mikio Hara
2f3d103f55 os: fix nits found by vet
Change-Id: I97812575ff9c69301a5ce2e1c814b40e1da32a55
Reviewed-on: https://go-review.googlesource.com/11271
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-19 00:44:13 +00:00
Mikio Hara
3269683250 os: skip TestStartProcess and TestHostname on android
Updates #11268.

Change-Id: Ib0cabd1c1806e884df9e40f6a9a1cdecf2f76823
Reviewed-on: https://go-review.googlesource.com/11223
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-19 00:32:01 +00:00
Jeff R. Allen
82020f8659 image/gif: return an error on missing palette
A frame that tries to use the global palette when it has
not been given should result in an error, not an image
with no palette at all.

Fixes #11150.

Change-Id: If0c3a201a0ac977eee2b7a5dc68930c0c5787f40
Reviewed-on: https://go-review.googlesource.com/11064
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-06-18 22:44:26 +00:00
Nigel Tao
682ecea9a0 image/gif: (temporarily) disable broken tests.
The compress/lzw encoder now rejects too-large input bytes, as of
https://go-review.googlesource.com/#/c/11227/, so we can't generate bad
GIFs programatically.

Change-Id: I0b32ce8e1f1776cd6997869db61e687430464e45
Reviewed-on: https://go-review.googlesource.com/11270
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-06-18 22:39:09 +00:00
Nigel Tao
ccec934814 compress/lzw: reject writing bytes that don't fit into litWidth.
Fixes #11142.

Change-Id: Id772c4364c47776d6afe86b0939b9c6281e85edc
Reviewed-on: https://go-review.googlesource.com/11227
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-18 22:17:11 +00:00
Andrew Gerrand
0c247bf41b math/big: refine Fibonacci example
Change-Id: Id9e8c3f89e021b9f389ab3c8403e6a8450fa9f5f
Reviewed-on: https://go-review.googlesource.com/11231
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-18 22:16:16 +00:00
Jeff R. Allen
2a5745d81e compress/lzw: mention relation between litWidth and input bytes
Add sentences to the docs explaining the limit on input
bytes implicit in the choice of litWidth, and the fact that
compress and decompress litWidth must match.

Fixes #11142.

Change-Id: I20cfb4df35739f7bfeb50b92c78249df3d47942c
Reviewed-on: https://go-review.googlesource.com/11063
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-06-18 22:09:37 +00:00
Rick Hudson
90a19961f2 runtime: reduce latency by aggressively ending mark phase
Some latency regressions have crept into our system over the past few
weeks. This CL fixes those by having the mark phase more aggressively
blacken objects so that the mark termination phase, a STW phase, has less
work to do. Three approaches were taken when the mark phase believes
it has no more work to do, ie all the work buffers are empty.
If things have gone well the mark phase is correct and there is
in fact little or no work. In that case the following items will
take very little time. If the mark phase is wrong this CL will
ferret that work out and give the mark phase a chance to deal with
it concurrently before mark termination begins.

When the mark phase first appears to be out of work, it does three things:
1) It switches from allocating white to allocating black to reduce the
number of unmarked objects reachable only from stacks.
2) It flushes and disables per-P GC work caches so all work must be in
globally visible work buffers.
3) It rescans the global roots---the BSS and data segments---so there
are fewer objects to blacken during mark termination. We do not rescan
stacks at this point, though that could be done in a later CL.
After these steps, it again drains the global work buffers.

On a lightly loaded machine the garbage benchmark has reduced the
number of GC cycles with latency > 10 ms from 83 out of 4083 cycles
down to 2 out of 3995 cycles. Maximum latency was reduced from
60+ msecs down to 20 ms.

Change-Id: I152285b48a7e56c5083a02e8e4485dd39c990492
Reviewed-on: https://go-review.googlesource.com/10590
Reviewed-by: Austin Clements <austin@google.com>
2015-06-18 21:38:46 +00:00
Andrew Gerrand
e6d2112ba9 internal/testenv: skip network tests only when -short is specified
Change-Id: I157879f5204d543eb3fc81c212d563b146473ba8
Reviewed-on: https://go-review.googlesource.com/11232
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-18 21:10:44 +00:00
ALTree
ee1ef8fe67 math/big: Add small complete example of big.Float usage
Updates #11241

Change-Id: I573be85d0cfcf410f6125ecd2be8a3d292c40bbb
Reviewed-on: https://go-review.googlesource.com/11245
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-06-18 21:08:41 +00:00
Robert Griesemer
2e7831a1d1 go/parser: document that parser accepts a wider language than specified
See also issue #11271.

Change-Id: I34175f46ce137b14ca483500f673b0f8ee1f2108
Reviewed-on: https://go-review.googlesource.com/11262
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-06-18 20:31:26 +00:00
Michael Matloob
32f2f72c47 cmd/compile: provide better error when method called without receiver
When a method is called using the Type.Method(receiver, args...) syntax
without the receiver, or enough arguments, provide the more helpful
error message "not enough arguments in call to method expression
Type.Method" instead of the old message "not enough arguments in call
to Type.Method".

Fixes #8385

Change-Id: Id5037eb1ee5fa93687d4a6557b4a8233b29e9df2
Reviewed-on: https://go-review.googlesource.com/2193
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-18 19:37:38 +00:00
Shenghou Ma
3925a7c5db all: switch to the new deprecation convention
While we're at it, move some misplaced comment blocks around.

Change-Id: I1847d7f1ca1dbb8e5de737203c4ed6c66e112508
Reviewed-on: https://go-review.googlesource.com/10188
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-18 19:16:23 +00:00
Shenghou Ma
526b501713 time: correct unrepresentable Unix time comment
It's easy for someone who wants a time bigger than any
valid time to reach for time.Unix(1<<63-1, 0), so it
makes sense to explicit say such value is not valid.

Fixes #10906 (again).

Change-Id: If71e32472ae40d86c30e629b982406040a73c4c7
Reviewed-on: https://go-review.googlesource.com/10266
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-18 18:21:59 +00:00
Davies Liu
1e0760354c hash/crc32: speedup crc32 of IEEE using slicingBy8
The Slicing-By-8 [1] algorithm has much performance improvements than
current approach. This patch only uses it for IEEE, which is the most
common case in practice.

There is the benchmark on Mac OS X 10.9:

benchmark                     old MB/s     new MB/s     speedup
BenchmarkIEEECrc1KB           349.40       353.03       1.01x
BenchmarkIEEECrc4KB           351.55       934.35       2.66x
BenchmarkCastagnoliCrc1KB     7037.58      7392.63      1.05x

This algorithm need 8K lookup table, so it's enabled only for block
larger than 4K.

We can see about 2.6x improvement for IEEE.

Change-Id: I7f786d20f0949245e4aa101d7921669f496ed0f7
Reviewed-on: https://go-review.googlesource.com/1863
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-18 18:14:24 +00:00
Josh Bleecher Snyder
d1e7980d1b log: fix flaky test
Fixes #11272.

Change-Id: I78d666c20f4f7cb7116d37fd66b5f8b7d66c53c4
Reviewed-on: https://go-review.googlesource.com/11234
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-18 18:08:17 +00:00
Giulio Iotti
9490fbf755 xml: add check of version in document declaration
Check that if a version is declared, for example
in '<?xml version="XX" ?>', version must be '1.0'.

Change-Id: I16ba9f78873a5f31977dcf75ac8e671fe6c08280
Reviewed-on: https://go-review.googlesource.com/8961
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-18 18:06:01 +00:00
Peter Waldschmidt
a13606e619 encoding/json: Remove extra allocation in scanner.
When the scanner receives a non-whitespace character in stateEndTop,
it creates an error message and caches it to return on the next
transition. nextValue() uses the scanner to sub-scan for a value
inside a larger JSON structure. Since stateEndTop is triggered
*after* the ending byte, whatever character immediately follows the
sub-value gets pulled into the scanner's state machine as well.
Even though it is not used and doesn't cause an error, it does
cause the state machine to allocate an error that will never be used.

The fix is to probe the state machine with whitespace after
scanEndObject or scanEndArray to see if the next character would
result in a scanEnd state transition. If so, we can return right
away without processing the next character and avoid triggering
an allocation.

benchmark                       old ns/op     new ns/op     delta
BenchmarkCodeEncoder            17022194      16611336      -2.41%
BenchmarkCodeMarshal            18443250      18090144      -1.91%
BenchmarkCodeDecoder            61502053      61010936      -0.80%
BenchmarkCodeUnmarshal          61410829      60363605      -1.71%
BenchmarkCodeUnmarshalReuse     59124836      58361772      -1.29%
BenchmarkUnmarshalString        602           603           +0.17%
BenchmarkUnmarshalFloat64       535           537           +0.37%
BenchmarkUnmarshalInt64         482           482           +0.00%
BenchmarkIssue10335             1206          799           -33.75%
BenchmarkSkipValue              17605751      18355391      +4.26%
BenchmarkEncoderEncode          612           604           -1.31%

benchmark                  old MB/s     new MB/s     speedup
BenchmarkCodeEncoder       114.00       116.82       1.02x
BenchmarkCodeMarshal       105.21       107.27       1.02x
BenchmarkCodeDecoder       31.55        31.81        1.01x
BenchmarkCodeUnmarshal     31.60        32.15        1.02x
BenchmarkSkipValue         111.63       107.07       0.96x

benchmark                  old allocs     new allocs     delta
BenchmarkIssue10335        11             4              -63.64%
BenchmarkEncoderEncode     2              2              +0.00%

benchmark                  old bytes     new bytes     delta
BenchmarkIssue10335        376           272           -27.66%
BenchmarkEncoderEncode     40            40            +0.00%

Fixes #10335

Change-Id: I3d4f2b67f7a038adfb33ba48bb6b680f528baf18
Reviewed-on: https://go-review.googlesource.com/9074
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-18 17:59:42 +00:00
Egon Elbre
4f4da07ea0 cmd/go: suggest running 'go help gopath' with problematic GOPATH
Suggest running 'go help gopath' when the running 'go install .'
and the folder is outside of GOPATH.

Added link to 'https://golang.org/doc/code.html' in gopath help
for more information.

Example output:

% go install .
go install: no install location for directory f:\x\badmessage outside GOPATH
        please run 'go help gopath' for more information

% go help gopath
... SNIP ...
See https://golang.org/doc/code.html for an example.

Fixes #8457

Change-Id: I0ef6ee3c65bb12af2168eafeb757258aa3835664
Reviewed-on: https://go-review.googlesource.com/9258
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-18 17:34:26 +00:00
Shenghou Ma
01187f756e build: fix clean scripts
Fixes #10734.

Change-Id: I7a2c580b87749225668fbd7a005412c8eee6824d
Reviewed-on: https://go-review.googlesource.com/9823
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-18 16:13:13 +00:00
Michael Gehring
7733a7cad8 archive/tar: add missing error checks
Check for errors when reading the headers following the pax headers.

Fixes #11169.

Change-Id: Ifec4a949ec8df8b49fa7cb7a67eb826fe2282ad8
Reviewed-on: https://go-review.googlesource.com/11031
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-18 16:02:34 +00:00
Dmitry Vyukov
1b269463a5 cmd/trace: gracefully handle empty profiles
Return a meaningful message when a profile is empty.
Also rename "IO blocking" to "Network blocking",
currently only network blocking is captured.

Fixes #11098

Change-Id: Ib6f1292b8ade4805756fcb6696ba1fca8f9f39a9
Reviewed-on: https://go-review.googlesource.com/11243
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-18 14:46:49 +00:00
Dmitry Vyukov
e72f5f67a1 runtime: fix tracing of syscallexit
There were two issues.
1. Delayed EvGoSysExit could have been emitted during TraceStart,
while it had not yet emitted EvGoInSyscall.
2. Delayed EvGoSysExit could have been emitted during next tracing session.

Fixes #10476
Fixes #11262

Change-Id: Iab68eb31cf38eb6eb6eee427f49c5ca0865a8c64
Reviewed-on: https://go-review.googlesource.com/9132
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-18 13:59:55 +00:00
Nigel Tao
62f169cb38 compress/lzw: be consistent with error message prefixes.
All the other error messages in this package are "lzw: etc".

Change-Id: Ie359a8912d213f92b15f02abc953127380503048
Reviewed-on: https://go-review.googlesource.com/11228
Reviewed-by: David Symonds <dsymonds@golang.org>
2015-06-18 05:31:38 +00:00
Alex Brainman
2858b73843 runtime: remove cgocall and asmcgocall
In preparation for rename of cgocall_errno into cgocall and
asmcgocall_errno into asmcgocall in the fllowinng CL.
rsc requested CL 9387 to be split into two parts. This is first part.

Change-Id: I7434f0e4b44dd37017540695834bfcb1eebf0b2f
Reviewed-on: https://go-review.googlesource.com/11166
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-18 04:42:53 +00:00
Mikio Hara
24db235deb net: fix build on android
Change-Id: Ib6d0b2947748dec98cad2e6abb6812cac46a9897
Reviewed-on: https://go-review.googlesource.com/11220
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-18 00:45:12 +00:00
Robert Griesemer
3cc7b27383 go/internal/gccgoimporter: enable tests on Plan9
Work-around issue #11265 and re-enable tests for Plan9.

Change-Id: I3aabb674a149b8eb936f948dd4cda5fd81454646
Reviewed-on: https://go-review.googlesource.com/11194
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-18 00:19:08 +00:00
Robert Griesemer
8fa1a69f0b go/types: use testenv.MustHaveGoBuild to exclude some builds
Replace custom solution with new (internal) library call.

Change-Id: I53b26a1caf0684b9f5d8d749b10d9f3ba18a3001
Reviewed-on: https://go-review.googlesource.com/11193
Reviewed-by: Damien Neil <dneil@google.com>
2015-06-17 23:24:35 +00:00
Robert Griesemer
bc7a3a62cf go/importer: implement support for gccgo
Change-Id: I0e1aab2fe2340a1fbb7f377dbd7a72ea6f0477d8
Reviewed-on: https://go-review.googlesource.com/11153
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-06-17 23:04:15 +00:00
Robert Griesemer
289e282966 go/internal/gccgoimporter: adjust to std repo libraries (fix build)
Change-Id: Ia9cbe3bfaa3e66c93d568d8beeed624b113d51a2
Reviewed-on: https://go-review.googlesource.com/11152
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-06-17 23:03:57 +00:00
Robert Griesemer
f6ae5f96c7 go/internal/gccgoimporter: unmodified copy of x/tools/go/gccgoimporter
This change will brake the build. The immediately following change
contains the necessary adjustments to make it work again. We're
doing this in two steps to expose the manual changes applied.

Change-Id: I225947da23e190b12e12cbd0c5e6e91628de7f53
Reviewed-on: https://go-review.googlesource.com/11151
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-06-17 23:03:13 +00:00
Robert Griesemer
bbf79575a5 math/big: incorporate feedback by josharian (Example_fibonacci)
Change-Id: I376ff39594b532a5490f13e3985b7a6ff4b6761d
Reviewed-on: https://go-review.googlesource.com/11191
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-17 20:29:35 +00:00
Russ Cox
cfa3eda587 runtime: fix race in scanvalid assertion
Change-Id: I389b2e10fe667eaa55f87b71b1e004994694d4a3
Reviewed-on: https://go-review.googlesource.com/11173
Reviewed-by: Austin Clements <austin@google.com>
2015-06-17 20:12:37 +00:00
ALTree
f0fee976aa math/big: Added small complete example of big.Int usage
Updates #11241

Change-Id: I9639c4f66cf805a57b087c9f648d3918df105d86
Reviewed-on: https://go-review.googlesource.com/11034
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-06-17 19:42:06 +00:00
Mikio Hara
e38bcb58d7 net: fix build on netbsd
Change-Id: Ia5c6d9fb114be65d7c20c7eb97ed696977051031
Reviewed-on: https://go-review.googlesource.com/11167
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-17 18:17:50 +00:00
Russ Cox
3c60e6e8cf runtime: fix races in stack scan
This fixes a hang during runtime.TestTraceStress.
It also fixes double-scan of stacks, which leads to
stack barrier installation failures.

Both of these have shown up as flaky failures on the dashboard.

Fixes #10941.

Change-Id: Ia2a5991ce2c9f43ba06ae1c7032f7c898dc990e0
Reviewed-on: https://go-review.googlesource.com/11089
Reviewed-by: Austin Clements <austin@google.com>
2015-06-17 17:56:26 +00:00
Russ Cox
1fc114c797 cmd/addr2line: simplify windows test
Change-Id: I0fcc35f43bc6059e6203af6134319cfc060c4b9a
Reviewed-on: https://go-review.googlesource.com/11085
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-17 14:23:20 +00:00
Russ Cox
08e25fc1ba cmd/compile: introduce //go:systemstack annotation
//go:systemstack means that the function must run on the system stack.

Add one use in runtime as a demonstration.

Fixes #9174.

Change-Id: I8d4a509cb313541426157da703f1c022e964ace4
Reviewed-on: https://go-review.googlesource.com/10840
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
2015-06-17 14:23:00 +00:00
Yongjian Xu
e3dc59f33d runtime: fix typos in os_linux_arm.go
Change-Id: I750900e0aed9ec528fea3f442c35196773e3ba5e
Reviewed-on: https://go-review.googlesource.com/11163
Reviewed-by: Minux Ma <minux@golang.org>
2015-06-17 08:51:59 +00:00
Jeremy Jackins
7354978950 doc: replace references to {5..9}{g,l} with go tool compile and go tool link
I updated some references to 6g, 6l and friends that I came across, as those
programs don't exist anymore. I also fixed some echos in make.rc to match other make.* scripts while I was there.

Change-Id: Ib84532cd4688cf65174dd9869e5d42af98a20a48
Reviewed-on: https://go-review.googlesource.com/11162
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-17 04:05:50 +00:00
Joe Tsai
b03129aa27 compress/flate: make library RFC1951 compliant
Corrected several issues:
 * RFC1951 section 3.2.7 dictates that it is okay for the HDist tree to have a
single code of zero bits. Furthermore, the behavior of the C zlib library
permits empty trees even when there are more than one codes.
 * RFC1951 section 3.2.5 shows that HLit codes 286 and 287 are invalid. Thus,
Go's implementation should choke on inputs using these codes.
 * RFC1951 section 3.2.5 and 3.2.7 are ambiguous about whether the number of
HDist codes can be greater than 30. The C zlib library (which is the canonical
reference implementation) performs this check here:
62d6112a79/inflate.c (L906)

In addition, a number of test cases were added to the unit tests that exercises
these edge cases. The test cases listed in TestStreams will either fail or
succeed in a manner matching the behaviour of the C zlib version. Given that the
C zlib implementation is the reference for the world, Go's implementation should
match C zlib behaviour.

Fixes #11030

Change-Id: Ic24e4e40ce5832c7e1930249246e86d34bfedaa6
Reviewed-on: https://go-review.googlesource.com/11000
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-06-17 03:21:49 +00:00
David Chase
5be61b18d4 cmd/compile: run escape analysis after method wrapper generation
Also modified test/run.go to ignore messages prefixed <autogenerated>
because those cannot be described with "// ERROR ...", and backed out
patch from issue #9537 because it is no longer necessary.  The reasons
described in the 9537 discussion for why escape analysis cannot run
late no longer hold, happily.

Fixes #11053.

Change-Id: Icb14eccdf2e8cde3d0f8fb8a216b765400a96385
Reviewed-on: https://go-review.googlesource.com/11088
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: David Chase <drchase@google.com>
2015-06-17 02:36:45 +00:00
Alex Brainman
6428a8b437 cmd/dist: add new misc/cgo/testsovar test
This change reintroduces CL 8523. CL 8523 was reverted because
it broke darwin and netbsd builds. Now that this test is part
of "go tool dist test" command we could skip OSes that fail.

Updates #10360

Change-Id: Iaaeb5b800126492f36415a439c333a218fe4ab67
Reviewed-on: https://go-review.googlesource.com/11119
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-17 02:33:40 +00:00
Alex Brainman
8e723109de cmd/go: vary executable names in tests
So the tests don't interfere with each other on windows.

Fixes #11217

Change-Id: I4b3936bc64c95c7274298d6f137b24a28876b625
Reviewed-on: https://go-review.googlesource.com/11138
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-17 01:26:40 +00:00
Mikio Hara
99f5f796d9 net: allow LookupAddr to use getnameinfo when cgo is enabled
This change allows LookupAddr to use getnameinfo through cgo for working
together with various name services other than DNS.

Fixes #7855.

Change-Id: I5b3b4aefe3d1b904541c3350865734d8cbb1c1c4
Reviewed-on: https://go-review.googlesource.com/3420
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-17 00:28:31 +00:00
Robert Griesemer
d3e8a3614c go/types: don't export gcCompatibilityMode flag
This flag is not needed in the std repo because we don't have
tests requiring it. Remove it before it's frozen into the API.

Change-Id: I18b861eea146ad67e7a3c26ee8be681d8065ef12
Reviewed-on: https://go-review.googlesource.com/11150
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-06-16 22:35:08 +00:00
Michael Hudson-Doyle
a5f57d7950 cmd/link: when reading symbols from a shared library, allow duplicates when they are both in bss
This makes the behaviour match what happens when duplicate symbols are read
from regular object files and fixes errors about cgoAlwaysFalse when linking
an executable that uses cgo against a shared library.

Change-Id: Ibb8cd8fe3f7813cde504b7483f1e857868d7e063
Reviewed-on: https://go-review.googlesource.com/11117
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-16 22:33:36 +00:00
David du Colombier
b1be121791 os: skip TestHostname on Plan 9
TestHostname was re-enabled in CL 10753.
However, on Plan 9 the hostname is not obtained
by executing a "hostname" command, but by reading
the #c/sysname file.

Change-Id: I80c0e303f4983fe39ceb300ad64e2c4a8392b695
Reviewed-on: https://go-review.googlesource.com/11033
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-16 22:07:01 +00:00
Austin Clements
7387121ddb runtime: account for stack guard when shrinking the stack
Currently, when shrinkstack computes whether the halved stack
allocation will have enough room for the stack, it accounts for the
stack space that's actively in use but fails to leave extra room for
the stack guard space. As a result, *if* the minimum stack size is
small enough or the guard large enough, it may shrink the stack and
leave less than enough room to run nosplit functions. If the next
function called after the stack shrink is a nosplit function, it may
overflow the stack without noticing and overwrite non-stack memory.

We don't think this is happening under normal conditions right now.
The minimum stack allocation is 2K and the guard is 640 bytes. The
"worst case" stack shrink is from 4K (4048 bytes after stack barrier
array reservation) to 2K (2016 bytes after stack barrier array
reservation), which means the largest "used" size that will qualify
for shrinking is 4048/4 - 8 = 1004 bytes. After copying, that leaves
2016 - 1004 = 1012 bytes of available stack, which is significantly
more than the guard space.

If we were to reduce the minimum stack size to 1K or raise the guard
space above 1012 bytes, the logic in shrinkstack would no longer leave
enough space.

It's also possible to trigger this problem by setting
firstStackBarrierOffset to 0, which puts stack barriers in a debug
mode that steals away *half* of the stack for the stack barrier array
reservation. Then, the largest "used" size that qualifies for
shrinking is (4096/2)/4 - 8 = 504 bytes. After copying, that leaves
(2096/2) - 504 = 8 bytes of available stack; much less than the
required guard space. This causes failures like those in issue #11027
because func gc() shrinks its own stack and then immediately calls
casgstatus (a nosplit function), which overflows the stack and
overwrites a free list pointer in the neighboring span. However, since
this seems to require the special debug mode, we don't think it's
responsible for issue #11027.

To forestall all of these subtle issues, this commit modifies
shrinkstack to correctly account for the guard space when considering
whether to halve the stack allocation.

Change-Id: I7312584addc63b5bfe55cc384a1012f6181f1b9d
Reviewed-on: https://go-review.googlesource.com/10714
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-16 21:17:53 +00:00
Austin Clements
5250279eb9 runtime: detect and print corrupted free lists
Issues #10240, #10541, #10941, #11023, #11027 and possibly others are
indicating memory corruption in the runtime. One of the easiest places
to both get corruption and detect it is in the allocator's free lists
since they appear throughout memory and follow strict invariants. This
commit adds a check when sweeping a span that its free list is sane
and, if not, it prints the corrupted free list and panics. Hopefully
this will help us collect more information on these failures.

Change-Id: I6d417bcaeedf654943a5e068bd76b58bb02d4a64
Reviewed-on: https://go-review.googlesource.com/10713
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
2015-06-16 21:17:47 +00:00
Russ Cox
142e434006 runtime: implement GOTRACEBACK=crash for linux/386
Change-Id: I401ce8d612160a4f4ee617bddca6827fa544763a
Reviewed-on: https://go-review.googlesource.com/11087
Reviewed-by: Austin Clements <austin@google.com>
2015-06-16 20:47:47 +00:00
Mikio Hara
0266bc8494 cmd/go: fix build
Change-Id: I2cd58a665d9df26583128c633c443325dcc3f288
Reviewed-on: https://go-review.googlesource.com/11131
Reviewed-by: Minux Ma <minux@golang.org>
2015-06-16 19:26:07 +00:00
Russ Cox
7bc3e58806 all: extract "can I exec?" check from tests into internal/testenv
Change-Id: I7b54be9d8b50b39e01c6be21f310ae9a10404e9d
Reviewed-on: https://go-review.googlesource.com/10753
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-16 18:07:36 +00:00
Mikio Hara
047f07a285 net: remove obsolete TestLookupHost
The motivation of TestLookupHost was to test codepaths on LookupHost,
LookupIP when we set CGO_ENABLED=1. Now we have serveral tests on those
APIs and their codepaths such as TestLookupGooglePublicDNSAddr,
TestCgoLookupIP, TestGoLookupIP, and the test using the ambiguous source
"localhost" is unnecessary.

Fixes #11182.

Change-Id: I397c823e1648114d91a229b316477bff2948b4f9
Reviewed-on: https://go-review.googlesource.com/11057
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-16 17:37:29 +00:00
David Crawshaw
9585bb29c8 go/types: disable example on darwin/arm
Sadly examples cannot use the new internal/testenv, so this is
extends the crude build tag restriction in this file.

Change-Id: I49646ca71e45074a917813ae8e612cc715c78be8
Reviewed-on: https://go-review.googlesource.com/11086
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-06-16 17:36:14 +00:00
Mikio Hara
515e53a051 net: skip TestProtocolDialError on solaris
Unfortunately there's no simple, easy way to make Dial{TCP,UDP} fail
consistently across all platforms. Fow now we skip the test on Solaris.

Change-Id: Ib3c55f670ac6a174fe9ea682dac7aab96b1e9dfb
Reviewed-on: https://go-review.googlesource.com/11058
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-16 17:35:46 +00:00
Shenghou Ma
d00e7ad640 cmd/compile: show compiler panics when -d panic=1
Fixes #10683.

Change-Id: I4cce3f298b787c736dbabe544a11a9215bcd3671
Reviewed-on: https://go-review.googlesource.com/10336
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-16 16:50:21 +00:00
Paul Marks
0d8366e2d6 net: add sequential and RFC 6555-compliant TCP dialing.
dialSerial connects to a list of addresses in sequence.  If a
timeout is specified, then each address gets an equal fraction of the
remaining time, with a magic constant (2 seconds) to prevent
"dial a million addresses" from allotting zero time to each.

Normally, net.Dial passes the DNS stub resolver's output to dialSerial.
If an error occurs (like destination/port unreachable), it quickly skips
to the next address, but a blackhole in the network will cause the
connection to hang until the timeout elapses.  This is how UNIXy clients
traditionally behave, and is usually sufficient for non-broken networks.

The DualStack flag enables dialParallel, which implements Happy Eyeballs
by racing two dialSerial goroutines, giving the preferred family a
head start (300ms by default).  This allows clients to avoid long
timeouts when the network blackholes IPv4 xor IPv6.

Fixes #8453
Fixes #8455
Fixes #8847

Change-Id: Ie415809c9226a1f7342b0217dcdd8f224ae19058
Reviewed-on: https://go-review.googlesource.com/8768
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-16 02:38:21 +00:00
Michael Hudson-Doyle
12b05bf8fd cmd/go: support -buildmode=shared with gccgo
Change-Id: Id93b8ab42fa311ce32209734ec9a0813f8736e25
Reviewed-on: https://go-review.googlesource.com/9914
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2015-06-16 01:43:29 +00:00
Robert Griesemer
7322ef5d2a go/types: fix Eval to use correct file set when evaluating an expression
This is https://go-review.googlesource.com/10999 which we could not apply
in x/tools/go/types because we must not rely on 1.5 features in that repo
yet.

Change-Id: I9a57cdb7ad4051df278d1fbed90c736df50f426f
Reviewed-on: https://go-review.googlesource.com/11125
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-06-15 20:11:58 +00:00
Robert Griesemer
d63c42df25 go/types: port recent x/tools/go/types fixes
The main change is:

golang.org/cl/10800  add pos parameter to Eval; remove New, EvalNode

followed by several cleanups/follow-up fixes:

golang.org/cl/10992  remove global vars in test
golang.org/cl/10994  remove unused scope parameter from NewSignature
golang.org/cl/10995  provide full source file extent to file scope
golang.org/cl/10996  comment fix in resolver.go
golang.org/cl/11004  updated cmd/vet
golang.org/cl/11042  be robust in the presence of incorrect/missing position info

Fixes #9980.

Change-Id: Id4aff688f6a399f76bf92b84c7e793b8da8baa48
Reviewed-on: https://go-review.googlesource.com/11122
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-06-15 20:11:37 +00:00
Brad Fitzpatrick
4965a77f1d cmd/go: fix typo
Change-Id: I171a1125e25b13c934c2cd545bd03f49f642910d
Reviewed-on: https://go-review.googlesource.com/11113
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-15 20:08:24 +00:00
Ian Lance Taylor
6f0e427298 syscall: fix TestCloneNEWUSERAndRemapNoRootDisableSetgroups the right way
The problem was not the kernel version as I thought before, it was
that the test used the same number for both the UID and the GID.
Thanks to Chris Siebenmann for debugging this.

Fixes #11220.

Change-Id: Ib5077e182497155e84044683209590ee0f7c9dde
Reviewed-on: https://go-review.googlesource.com/11124
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2015-06-15 19:55:22 +00:00
Russ Cox
4dab6d01f1 cmd/go: make -a apply to the standard library, like in Go 1.3
This CL adds a very long comment explaining how isStale and
the new build IDs work. As part of writing the comment I realized:

// When the go command makes the wrong build decision and does not
// rebuild something it should, users fall back to adding the -a flag.
// Any common use of the -a flag should be considered prima facie evidence
// that isStale is returning an incorrect false result in some important case.
// Bugs reported in the behavior of -a itself should prompt the question
// ``Why is -a being used at all? What bug does that indicate?''

The two uses of -a that are most commonly mentioned in bugs filed
against the go command are:

	go install -a ./...
	go build -tags netgo -a myprog

Both of these commands now do the right thing without needing -a.

The -a exception we introduced in Go 1.4 was for the first form, and
it broke the second form. Again, neither needs -a anymore, so restore
the old, simpler, easier to explain, less surprising meaning used in Go 1.3:
if -a is given, rebuild EVERYTHING.

See the comment for more justification and history.

Summary of recent CLs (to link bugs to this one):

Fixes #3036. Now 'go install ./...' works.
Fixes #6534. Now 'go install ./...' works.
Fixes #8290. Now 'go install ./...' works.
Fixes #9369. Now 'go build -tags netgo myprog' works.
Fixes #10702. Now using one GOPATH with Go 1.5 and Go 1.6 works.
  (Each time you switch, everything needed gets rebuilt.
  Switching from Go 1.4 to Go 1.5 will rebuild properly.
  Switching from Go 1.5 back to Go 1.4 still needs -a when
  invoking the Go 1.4 go command.)

Change-Id: I19f9eb5286efaa50de7c8326602e94604ab572eb
Reviewed-on: https://go-review.googlesource.com/10761
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-15 19:38:11 +00:00
Russ Cox
3ab9ff1107 cmd/go: include Go toolchain information in build ID
This causes packages and binaries built by Go 1.5 to look
out of date to Go 1.6 and vice versa, so that when you flip
between different Go versions but keep the same GOPATH,
the right rebuilding happens at each flip.

Go 1.4 binaries will also look out of date to Go 1.5,
but Go 1.5 binaries will not look out of date to Go 1.4
(since Go 1.4 doesn't have anything like this).
People flipping between Go 1.4 and Go 1.5 will still
need to use go install -a every time to flip to Go 1.4,
but not when they flip back to Go 1.5.

Fixes #6534.
Fixes #10702.

Change-Id: I0ae7f268f822d483059a938a4f22846ff9275b4c
Reviewed-on: https://go-review.googlesource.com/10760
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-15 18:57:35 +00:00
Russ Cox
43aac4f9e7 runtime: raise maxmem to 512 GB
A workaround for #10460.

Change-Id: I607a556561d509db6de047892f886fb565513895
Reviewed-on: https://go-review.googlesource.com/10819
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2015-06-15 18:31:25 +00:00
Srdjan Petrovic
85b333dbf8 cmd/go: force-overwrite destination files when installing cgo headers
Fixes #11131

When running 'go install -buildmode=c-shared', under the circumstances
described in issue #11131, the install command would fail trying to
install cgo headers if they have already been installed (by a previous
call to 'go install -buildmode=c-shared').

Since it's safe to overwrite said headers (according to iant@), this CL
introduces a parameter to builder's 'copy' and 'move' functions that,
if set to 'true', would force the overwriting of already installed
files.

This parameter value is set to 'true' only when installing cgo headers,
for now.

Change-Id: I5bda17ee757066a8e5d2b39f2e8f3a389eb1e4a2
Reviewed-on: https://go-review.googlesource.com/10870
Run-TryBot: Srdjan Petrovic <spetrovic@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-15 18:29:39 +00:00
Rob Pike
1f9026c0bd testing: don't print CPU count for tests, only benchmarks
The number of CPUs is of value when benchmarking but mostly
noise when testing. The recent change to default to the number
of CPUs available has made the tests noisier and confusing.

Fixes #11200

Change-Id: Ifc87d9ccb4177d73e304fb7ffcef4367bd163c9e
Reviewed-on: https://go-review.googlesource.com/11121
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-15 18:11:06 +00:00
Russ Cox
2c2770c3d4 cmd/cgo: make sure pointers passed to C escape to heap
Fixes #10303.

Change-Id: Ia68d3566ba3ebeea6e18e388446bd9b8c431e156
Reviewed-on: https://go-review.googlesource.com/10814
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-15 17:39:53 +00:00
Russ Cox
a3b9797baa runtime: gofmt
Change-Id: I539bdc438f694610a7cd373f7e1451171737cfb3
Reviewed-on: https://go-review.googlesource.com/11084
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-15 17:36:34 +00:00
Russ Cox
d5b40b6ac2 runtime: add GODEBUG gcshrinkstackoff, gcstackbarrieroff, and gcstoptheworld variables
While we're here, update the documentation and delete variables with no effect.

Change-Id: I4df0d266dff880df61b488ed547c2870205862f0
Reviewed-on: https://go-review.googlesource.com/10790
Reviewed-by: Austin Clements <austin@google.com>
2015-06-15 17:31:04 +00:00
Russ Cox
80ec711755 runtime: use type-based write barrier for remote stack write during chansend
A send on an unbuffered channel to a blocked receiver is the only
case in the runtime where one goroutine writes directly to the stack
of another. The garbage collector assumes that if a goroutine is
blocked, its stack contains no new pointers since the last time it ran.
The send on an unbuffered channel violates this, so it needs an
explicit write barrier. It has an explicit write barrier, but not one that
can handle a write to another stack. Use one that can (based on type bitmap
instead of heap bitmap).

To make this work, raise the limit for type bitmaps so that they are
used for all types up to 64 kB in size (256 bytes of bitmap).
(The runtime already imposes a limit of 64 kB for a channel element size.)

I have been unable to reproduce this problem in a simple test program.

Could help #11035.

Change-Id: I06ad994032d8cff3438c9b3eaa8d853915128af5
Reviewed-on: https://go-review.googlesource.com/10815
Reviewed-by: Austin Clements <austin@google.com>
2015-06-15 16:50:30 +00:00
Andrew Gerrand
d14e9e6323 cmd/go: stop early in disallowInternal on erroneous packages
Fixes #11201

Change-Id: I80d8fcfcb5c856aaf9d0e73d756d86018e2bec3b
Reviewed-on: https://go-review.googlesource.com/11110
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-15 04:27:27 +00:00
Ian Lance Taylor
0ee92cf9c5 syscall: correct comment on where compileCallback is defined
Fixes #11216.

Change-Id: Iad1f4894c2258909484eaf975b08e0f47a82788e
Reviewed-on: https://go-review.googlesource.com/11098
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-15 03:10:52 +00:00
Dmitry Vyukov
202de394f2 cmd/trace: fix panic in goroutine profile
In generateTrace we check that event timestamp is within the interesting range.
Then later in traceContext.time we double check event time.
However, for some events (e.g. emitSlice) we convert time of ev.Link (slice end) rather than ev itself (slice begin).
Slice end can be outside of the interesting time range, and so traceContext.time crashes.
Remove the check in traceContext.time, check in generateTrace loop is sufficient.

Change-Id: If94e93b5653c5816c0a8dcdd920f15df97616835
Reviewed-on: https://go-review.googlesource.com/11100
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-14 21:57:24 +00:00
Dmitry Vyukov
9a8750b276 misc/trace: update trace viewer
Update to tip to fix #11003 (not possible to select events in chromium).
Fixed #11003

Change-Id: Ibba5d39ca809cfd5cb79c9e6d152b00899d49e08
Reviewed-on: https://go-review.googlesource.com/11062
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-14 20:58:23 +00:00
Michael Gehring
48d865ace1 archive/zip: fix returned error on truncated data descriptor
Return io.ErrUnexpectedEOF instead of io.EOF when reading a truncated
data descriptor.

Fixes #11146.

Change-Id: Ia1905955165fd38af3c557d1fa1703ed8be893e2
Reviewed-on: https://go-review.googlesource.com/11070
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-14 20:54:01 +00:00
Adam Langley
6a34206ca9 crypto/tls: fix parsing of SNI extension.
The previous code had a brain fart: it took one of the length prefixes
as an element count, not a length. This didn't actually affect anything
because the loop stops as soon as it finds a hostname element, and the
hostname element is always the first and only element. (No other element
types have ever been defined.)

This change fixes the parsing in case SNI is ever changed in the future.

Fixes #10793.

Change-Id: Iafdf3381942bc22b1f33595315c53dc6cc2e9f0f
Reviewed-on: https://go-review.googlesource.com/11059
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-14 17:55:53 +00:00
Michael Matloob
71e83b8855 regexp: small correction to test comment
s/Backtrace/Backtrack/

Change-Id: I062aab18f23f2bc2110cf7210c2e7264747e02cf
Reviewed-on: https://go-review.googlesource.com/11091
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-14 17:09:13 +00:00
Ian Lance Taylor
6b24da6ae8 syscall: skip TestCloneNEWUSERAndRemapNoRootDisableSetgroups before 3.19
The test fails on Ubuntu Trusty for some reason, probably because of
some set of kernel patches.

Change-Id: I52f7ca50b96fea5725817c9e9198860d419f9313
Reviewed-on: https://go-review.googlesource.com/11055
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2015-06-14 01:52:54 +00:00
Robert Griesemer
a84ac5b507 go/types: exclude some example tests for arm64, nacl (fix build)
TBR: bradfitz, adonovan

Change-Id: Ifc8574494848503c979d11e2766ba8da0f374068
Reviewed-on: https://go-review.googlesource.com/11043
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-06-14 00:11:38 +00:00
Mikio Hara
22829bd766 net: don't return non-nil interface values as Source, Addr in OpError
Fixes #10992.

Change-Id: Ia376e4de118993b43e5813da57ab25fea8122048
Reviewed-on: https://go-review.googlesource.com/10476
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-13 23:39:03 +00:00
Kyle Isom
38e3427b2f encoding/asn1: check bounds when parsing tag and length
This was found while fuzzing another program, triggering a panic in
x509.ParseECPrivateKey.

Fixes #11154

Change-Id: Ief35ead38adf14caec4d37b9eacf8a92e67cd1e6
Reviewed-on: https://go-review.googlesource.com/10712
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
2015-06-13 19:59:16 +00:00
Rob Pike
a1fe3b5046 fmt: scanning widths apply after leading spaces
When scanning with a width, as in %5s, C skips leading spaces
brefore counting the 5 characters. We should do the same.

Reword the documentation about widths to make this clear.

Fixes #9444

Change-Id: I443a6441adcf1c834057ef3977f9116a987a79cd
Reviewed-on: https://go-review.googlesource.com/10997
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-13 04:33:26 +00:00
Josh Bleecher Snyder
ff8f3f0fa1 cmd/vet: extend copylocks to anonymous functions
Running -copylocks over a large corpus generates 1507 warnings.
Of those, only 3 are from the new anonymous function check,
but they are all bugs.

Fixes #10927.

Change-Id: I2672f6871036bed711beec5f88bc39aa8b3b6a94
Reviewed-on: https://go-review.googlesource.com/11051
Reviewed-by: Rob Pike <r@golang.org>
2015-06-13 03:07:43 +00:00
Robert Griesemer
cb2d02c803 go/parser: add ParseExprFrom function
This is needed for code that relies on having the correct file set
when parsing an expression only. There's currently no other way to
get to the file set otherwise or to invoke the parser correctly to
work on an expression only with a given file set.

Change-Id: I325f174cb34b69284e627f59fe8334efa4eaa45c
Reviewed-on: https://go-review.googlesource.com/10998
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-06-12 23:46:32 +00:00
Alexander Morozov
f5c60ff2da syscall: add GidMappingsEnableSetgroups to Linux SysProcAttr
Linux 3.19 made a change in the handling of setgroups and the 'gid_map' file to
address a security issue.
The upshot of the 3.19 changes is that in order to update the 'gid_maps' file,
use of the setgroups() system call in this user namespace must first be disabled
by writing "deny" to one of the /proc/PID/setgroups files for this namespace.

Also added tests for remapping uid_map and gid_map inside new user
namespace.

Fixes #10626

Change-Id: I4d2539acbab741a37092d277e10f31fc39a8feb7
Reviewed-on: https://go-review.googlesource.com/10670
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-12 23:38:59 +00:00
Alan Donovan
368f0ee6c4 go/types: add Example of API usage
Change-Id: I9d3253b80508d733053789d6cb9645e029bf52e4
Reviewed-on: https://go-review.googlesource.com/10927
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-06-12 22:34:24 +00:00
Michael Gehring
5acba80aa2 archive/tar: fix slice bounds out of range
Sanity check the pax-header size field before using it.

Fixes #11167.

Change-Id: I9d5d0210c3990e6fb9434c3fe333be0d507d5962
Reviewed-on: https://go-review.googlesource.com/10954
Reviewed-by: David Symonds <dsymonds@golang.org>
2015-06-12 21:35:47 +00:00
Rob Pike
57f4b43078 fmt: require newlines to match when scanning with a format
The documentation says that newlines behave like this:

Scan etc.: newlines are spaces.
Scanln etc.: newlines terminate the scan.
Scanf etc.: newlines must match in input and format.

The code did not implement this behavior in all cases,
especially for Scanf. Make it behave:

- Fix the handling of spaces and newlines in ss.Advance.
The code is longer but now behaves as it should.

- Delete the reuse of the current ss in newScanState.
There is really no need, since it's only used in recursive
calls to Scan etc., and the flags are likely wrong. Simpler
just to allocate a new one every time, and likelier to
be correct.

Fixes #10862.

Change-Id: If060ac021017346723b0d62de4e5a305da898f68
Reviewed-on: https://go-review.googlesource.com/10991
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-12 20:14:14 +00:00
Damien Neil
ab89378cb7 encoding/csv: skip blank lines when FieldsPerRecord >= 0
Fixes #11050.

Change-Id: Ie5d16960a1f829af947d82a63fe414924cd02ff6
Reviewed-on: https://go-review.googlesource.com/10666
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-12 18:21:12 +00:00
Michael Gehring
4105265c66 mime: add mime.types paths for BSDs
Change-Id: I22ac23e7e180071de4443291e0a644675200d642
Reviewed-on: https://go-review.googlesource.com/10950
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-12 15:51:21 +00:00
Alexandre Cesaro
0d0ce8a2af cmd/go: fix documentation
The command "go tool pprof help" does not work:

    $ go tool pprof help
    open help: no such file or directory

The right command is "go tool pprof -h".

Change-Id: Icef5d4ab76774905854e46665ac1166d26d35f46
Reviewed-on: https://go-review.googlesource.com/10970
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-12 13:23:14 +00:00
Alex Brainman
202ef487fe cmd/dist: convert testso test into Go
I would like to re-apply reverted http://golang.org/cl/8523.
Reverted tests still fail in some environments (see issue #10360).
It is easier to run tests selectively when in Go.
This CL prepares for the changes.

Updates #10360

Change-Id: Iefeb1d71cb3d1cfa653a6ccd9f6e35686c0c5b24
Reviewed-on: https://go-review.googlesource.com/10608
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-12 04:33:50 +00:00
Alex Brainman
117506aab6 cmd/go: clean up after 'go build' even on windows
This CL makes CL 10682 work on windows.

Fixes #9645 (again)

Change-Id: Ie9b9af8b041c483a236b46adad4a50aa6e598c92
Reviewed-on: https://go-review.googlesource.com/10930
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-12 02:15:43 +00:00
Ian Lance Taylor
06ef022ba3 cmd/go: add some parallelism to the testsuite
As these tests were originally in bash, they are not designed to be
particularly hermetic.  This CL adds various protective mechanisms to
try to catch cases where the tests can not run in parallel.

Change-Id: I983bf7b6ffba04eda58b4939eb89b0bdfcda8eff
Reviewed-on: https://go-review.googlesource.com/10911
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-11 18:39:14 +00:00