]> Cypherpunks repositories - gostls13.git/log
gostls13.git
9 years agoruntime: fix go:nowritebarrier annotation on gcmarkwb_m
Matthew Dempsky [Wed, 15 Jul 2015 20:27:30 +0000 (13:27 -0700)]
runtime: fix go:nowritebarrier annotation on gcmarkwb_m

Change-Id: I945d46d3bb63f1992bce0d0b1e89e75cac9bbd54
Reviewed-on: https://go-review.googlesource.com/12271
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: recognize embedded field in inlined function
Ian Lance Taylor [Wed, 15 Jul 2015 05:17:41 +0000 (22:17 -0700)]
cmd/compile: recognize embedded field in inlined function

There was already special code to recognize "?" in hidden_structdcl,
which is used for inlined types and variables.  This recognizes "?" in
structdcl as well, a case that arises when a struct type appears
within an inlined function body.

Fixes #10219.

Change-Id: Ic5257ae54f817e0d4a189c2294dcd633c9f2101a
Reviewed-on: https://go-review.googlesource.com/12241
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoencoding/json: document and test overwrite of slice, map during Unmarshal
Russ Cox [Wed, 15 Jul 2015 01:32:47 +0000 (21:32 -0400)]
encoding/json: document and test overwrite of slice, map during Unmarshal

Fixes #8837.

Change-Id: Iaaecbb0b324004cb74b16b764126b01315e6a16e
Reviewed-on: https://go-review.googlesource.com/12209
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoasm: fix error messages and comments for "register pair"
Rob Pike [Wed, 15 Jul 2015 02:41:08 +0000 (12:41 +1000)]
asm: fix error messages and comments for "register pair"

The parser treats (R1+R2) on ppc64 the same as (R1,R2) on arm,
but it is not strictly a "register pair". Improve the text.

No semantic change.

Change-Id: Ib8b14881c6467add0d53150a901c01e962afb28b
Reviewed-on: https://go-review.googlesource.com/12212
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: diagnose invalid pointers during GC
Russ Cox [Mon, 8 Jun 2015 03:42:03 +0000 (23:42 -0400)]
runtime: diagnose invalid pointers during GC

For #9880. Let's see what breaks.

Change-Id: Ic8b99a604e60177a448af5f7173595feed607875
Reviewed-on: https://go-review.googlesource.com/10818
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>

9 years agocmd/compile: fix PtrTo(t) for unnamed t with embedded fields
Russ Cox [Wed, 15 Jul 2015 04:01:54 +0000 (00:01 -0400)]
cmd/compile: fix PtrTo(t) for unnamed t with embedded fields

Fixes #8427.

Change-Id: I826a3bc4519845ad30d6dbaf058fe7ed7bee8db0
Reviewed-on: https://go-review.googlesource.com/12233
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agomath: fix Log2 test failures on ppc64 (and s390)
Russ Cox [Wed, 15 Jul 2015 02:42:16 +0000 (22:42 -0400)]
math: fix Log2 test failures on ppc64 (and s390)

- Make Log2 exact for powers of two.
- Fix error tolerance function to make tolerance
  a function of the correct (expected) value.

Fixes #9066.

Change-Id: I0320a93ce4130deed1c7b7685627d51acb7bc56d
Reviewed-on: https://go-review.googlesource.com/12230
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoencoding/json: fix out of phase error unmarshaling non-string into TextUnmarshaler
Russ Cox [Tue, 14 Jul 2015 23:31:44 +0000 (19:31 -0400)]
encoding/json: fix out of phase error unmarshaling non-string into TextUnmarshaler

Fixes #9650.

Change-Id: I45b879124691e485b86c1e99a3227032283850d2
Reviewed-on: https://go-review.googlesource.com/12208
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agonet/smtp: give example addrs in docs
Russ Cox [Wed, 15 Jul 2015 03:33:29 +0000 (23:33 -0400)]
net/smtp: give example addrs in docs

Fixes #9140.

Change-Id: I3b85053262cac3c30358f8e03a5aca65dbc67623
Reviewed-on: https://go-review.googlesource.com/12231
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: print all test flags in "go test -h"
Russ Cox [Tue, 14 Jul 2015 05:08:30 +0000 (01:08 -0400)]
cmd/go: print all test flags in "go test -h"

Originally 'go test -h' printed the output of 'go help test'.
Then issue #6576 was filed, because that output didn't list (for example) -bench.
CL 14502065 changed 'go test -h' to print the output of 'go help testflag'.
Then issue #9209 was filed, because that output didn't list (for example) -c.

To print all the relevant flags, parts of both 'go help test' and 'go help testflag'
are needed. Refactor the help messages to make those parts available
and print them.

Fixes #9209.

Change-Id: Ie8205b8fb37d00c10d25b3fc98f14286ec46c4e3
Reviewed-on: https://go-review.googlesource.com/12173
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/dist: diagnose lack of gcc earlier in build
Russ Cox [Tue, 14 Jul 2015 02:27:10 +0000 (22:27 -0400)]
cmd/dist: diagnose lack of gcc earlier in build

Fixes #10731.

Change-Id: I105629b03fd3323c0a2ca5b6b0fd35ee92b7fd2e
Reviewed-on: https://go-review.googlesource.com/12146
Reviewed-by: Rob Pike <r@golang.org>
9 years agoimage/color: tweak the YCbCr to RGBA conversion formula.
Nigel Tao [Wed, 15 Jul 2015 04:55:02 +0000 (14:55 +1000)]
image/color: tweak the YCbCr to RGBA conversion formula.

Before, calling the RGBA method of YCbCr color would return red values
in the range [0x0080, 0xff80]. After, the range is [0x0000, 0xffff] and
is consistent with what Gray colors' RGBA method returns. In particular,
pure black, pure white and every Gray color in between are now exactly
representable as a YCbCr color.

This fixes a regression from Go 1.4 (where YCbCr{0x00, 0x80, 0x80} was
no longer equivalent to pure black), introduced by golang.org/cl/8073 in
the Go 1.5 development cycle. In Go 1.4, the +0x80 rounding was not
noticable when Cb == 0x80 && Cr == 0x80, because the YCbCr to RGBA
conversion truncated to 8 bits before multiplying by 0x101, so the
output range was [0x0000, 0xffff].

The TestYCbCrRoundtrip fuzzy-match tolerance grows from 1 to 2 because
the YCbCr to RGB conversion now maps to an ever-so-slightly larger
range, along with the usual imprecision of accumulating rounding errors.

Also s/int/int32/ in ycbcr.go. The conversion shouldn't overflow either
way, as int is always at least 32 bits, but it does make it clearer that
the computation doesn't depend on sizeof(int).

Fixes #11691

Change-Id: I538ca0adf7e040fa96c5bc8b3aef4454535126b9
Reviewed-on: https://go-review.googlesource.com/12220
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/go: fix nocgo builder
Russ Cox [Wed, 15 Jul 2015 05:16:47 +0000 (01:16 -0400)]
cmd/go: fix nocgo builder

Change-Id: I0f167d9769d9b6b9888c13fcb48e538fc87aa1b7
Reviewed-on: https://go-review.googlesource.com/12240
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agotime: make it clearer how to format a fractional second
Rob Pike [Wed, 15 Jul 2015 05:02:38 +0000 (15:02 +1000)]
time: make it clearer how to format a fractional second

Fixes #10963.

Change-Id: I8d769b4d25b306f2df41f882ec01d97bbd63171d
Reviewed-on: https://go-review.googlesource.com/12221
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoos/exec: document that Cmd.Wait waits for stdin I/O
Russ Cox [Wed, 15 Jul 2015 03:48:34 +0000 (23:48 -0400)]
os/exec: document that Cmd.Wait waits for stdin I/O

Fixes #10338.

Change-Id: Ib86cb9a6c694b1e442a9957153c7ca38a7d11c3e
Reviewed-on: https://go-review.googlesource.com/12232
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoreflect: wait longer before declaring select test stuck
Russ Cox [Wed, 15 Jul 2015 04:04:27 +0000 (00:04 -0400)]
reflect: wait longer before declaring select test stuck

Fixes #9427.

Change-Id: If8094d4d4f6737c03d83e08e177c2a7f0ff9d89f
Reviewed-on: https://go-review.googlesource.com/12234
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/go: add test for issue 3652
Russ Cox [Tue, 14 Jul 2015 19:24:26 +0000 (15:24 -0400)]
cmd/go: add test for issue 3652

Fixes #3652. (Well, already fixed, but tests that it stays fixed.)

Change-Id: I4e17f595ee2ad513de86ac3861e8e66b1230b3be
Reviewed-on: https://go-review.googlesource.com/12195
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: fix build
Russ Cox [Wed, 15 Jul 2015 04:51:24 +0000 (00:51 -0400)]
cmd/go: fix build

Failures noted by dashboard.

Change-Id: I22f90120c6687b64b9efff9df7a7fa8f26d24bac
Reviewed-on: https://go-review.googlesource.com/12207
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/go: accept go get domain.root
Russ Cox [Tue, 14 Jul 2015 19:08:10 +0000 (15:08 -0400)]
cmd/go: accept go get domain.root

Fixes #9357.

Change-Id: I11f0652758c4ea80debec29c3b99a72baca6d745
Reviewed-on: https://go-review.googlesource.com/12193
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: fix go get -u handling of changing dependencies
Russ Cox [Tue, 14 Jul 2015 18:52:04 +0000 (14:52 -0400)]
cmd/go: fix go get -u handling of changing dependencies

Fixes #9224.

Change-Id: Ie0f4f14407099e4fa7ebe361a95b6492012928a2
Reviewed-on: https://go-review.googlesource.com/12192
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: disable password prompt when running git
Russ Cox [Tue, 14 Jul 2015 05:22:53 +0000 (01:22 -0400)]
cmd/go: disable password prompt when running git

This fix only works on Git 2.3.0 and later.

There appears to be no portable way to fix the earlier versions.
We already run git with stdin closed, but on Unix git calls getpass,
which opens /dev/tty itself. We could do package syscall-specific
things to get /dev/tty invalidated during the exec, but I'd really
rather not. And on Windows, Git opens "CONIN$" and "CONOUT$"
itself, and I have no idea how to invalidate those.

Fix the problem for newish Git versions and wait for people to update.
Best we can do.

Fixes #9341.

Change-Id: I576579b106764029853e0f74d411e19108deecf5
Reviewed-on: https://go-review.googlesource.com/12175
Reviewed-by: Rob Pike <r@golang.org>
9 years agodatabase/sql: document closing requirements for Stmts
Russ Cox [Tue, 14 Jul 2015 20:28:28 +0000 (16:28 -0400)]
database/sql: document closing requirements for Stmts

Fixes #8952.

Change-Id: I678f9706eccb5a344eeb0244f45b7b7669830bdc
Reviewed-on: https://go-review.googlesource.com/12204
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocrypto/x509: add /etc/ssl/cacert.pem to OmniOS cert search list
Russ Cox [Tue, 14 Jul 2015 20:20:13 +0000 (16:20 -0400)]
crypto/x509: add /etc/ssl/cacert.pem to OmniOS cert search list

Fixes #9146.

Change-Id: If5cb5ae92a201825b9ff32b3d0edfa032b9a0965
Reviewed-on: https://go-review.googlesource.com/12203
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/pprof: store temporary files in temporary directory
Russ Cox [Tue, 14 Jul 2015 19:43:33 +0000 (15:43 -0400)]
cmd/pprof: store temporary files in temporary directory

Fixes #9180.

Change-Id: Id5adaea0ca9005946fb89c88a10c6f59d8c0943c
Reviewed-on: https://go-review.googlesource.com/12202
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/pprof: run $BROWSER and system browser before Chrome
Russ Cox [Tue, 14 Jul 2015 19:38:46 +0000 (15:38 -0400)]
cmd/pprof: run $BROWSER and system browser before Chrome

Fixes #10259.

Change-Id: Ica6b8301cc8291785a3c496fb513050813b2d8df
Reviewed-on: https://go-review.googlesource.com/12201
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/go: fix TestVendorRun when $GOROOT is inside a symlinked path
Russ Cox [Tue, 14 Jul 2015 19:15:37 +0000 (15:15 -0400)]
cmd/go: fix TestVendorRun when $GOROOT is inside a symlinked path

Fixes #11305.

Change-Id: Icaa3a009aa4ab214c9aaf74f52c3e622fa266a9d
Reviewed-on: https://go-review.googlesource.com/12194
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: reject missing source code in go get -d, same as go get -d -u
Russ Cox [Tue, 14 Jul 2015 06:17:39 +0000 (02:17 -0400)]
cmd/go: reject missing source code in go get -d, same as go get -d -u

Fixes #11090.

Change-Id: I1518df7a48346b175ec80079a07225901fdd51fb
Reviewed-on: https://go-review.googlesource.com/12177
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/go: give full import stack for errors in dependencies of test dependencies
Russ Cox [Tue, 14 Jul 2015 05:56:51 +0000 (01:56 -0400)]
cmd/go: give full import stack for errors in dependencies of test dependencies

Fixes #9558.

Change-Id: I68506af58088155d38d492b49b19c5fc2048b087
Reviewed-on: https://go-review.googlesource.com/12176
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/go: go test -race -i runtime/race must not install race-enabled cmd/cgo
Russ Cox [Tue, 14 Jul 2015 05:14:08 +0000 (01:14 -0400)]
cmd/go: go test -race -i runtime/race must not install race-enabled cmd/cgo

Fix now uses same test as 'go build'.

Fixes #10500.

Change-Id: I2fcf2d95430643370aa29165d89a188988dee446
Reviewed-on: https://go-review.googlesource.com/12174
Reviewed-by: Rob Pike <r@golang.org>
9 years agodoc: add cmd/go's -pkgdir build option
Russ Cox [Tue, 14 Jul 2015 04:34:36 +0000 (00:34 -0400)]
doc: add cmd/go's -pkgdir build option

Also use more consistent language for the new build options.

Change-Id: I88cbe200c13f452713be73d2e00337ddb793b8c6
Reviewed-on: https://go-review.googlesource.com/12172
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/go: add -pkgdir build flag
Russ Cox [Tue, 14 Jul 2015 04:27:59 +0000 (00:27 -0400)]
cmd/go: add -pkgdir build flag

Fixes #10210.

Change-Id: I82ddd665bca31773b1fb1b056338c04818ef68f5
Reviewed-on: https://go-review.googlesource.com/12171
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/go: remove duplication of build flag info in testflag.go
Russ Cox [Tue, 14 Jul 2015 04:04:50 +0000 (00:04 -0400)]
cmd/go: remove duplication of build flag info in testflag.go

Also adds to 'go test' all the build flags that were missing
due to inconsistency in the duplication (for example, -toolexec).

Fixes #10504.

Change-Id: I1935b5caa13d5e551a0483904adffa8877087df7
Reviewed-on: https://go-review.googlesource.com/12170
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/go: fix error for go run with files in different directories
Russ Cox [Tue, 14 Jul 2015 03:31:14 +0000 (23:31 -0400)]
cmd/go: fix error for go run with files in different directories

Fixes #9853.

Change-Id: Ic4803aa499ca20215085a87bad649014984d84c8
Reviewed-on: https://go-review.googlesource.com/12149
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/go: document that <meta> tags should be early in the HTML for go get
Russ Cox [Tue, 14 Jul 2015 02:55:26 +0000 (22:55 -0400)]
cmd/go: document that <meta> tags should be early in the HTML for go get

While we are here, fix a few things not updated for -insecure.

Fixes #8163.

Change-Id: Ib80c9ac00d6b61cce26c3d20bee3d30ab9af1331
Reviewed-on: https://go-review.googlesource.com/12148
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/go: diagnose trivial test import cycle
Russ Cox [Tue, 14 Jul 2015 02:39:17 +0000 (22:39 -0400)]
cmd/go: diagnose trivial test import cycle

Was detecting only non-trivial ones.

Fixes #9690.

Change-Id: I662d81dd4818ddf29592057c090805772c84287b
Reviewed-on: https://go-review.googlesource.com/12147
Reviewed-by: Rob Pike <r@golang.org>
9 years agoRevert "cmd/compile: define func value symbols at declaration"
Russ Cox [Wed, 15 Jul 2015 04:11:26 +0000 (04:11 +0000)]
Revert "cmd/compile: define func value symbols at declaration"

This reverts commit 3b411bf1a1bb08d6868083981cecba8088dc7aea.

Change-Id: I321a43fa378a43b3e4d7aa97e0222775640af64b
Reviewed-on: https://go-review.googlesource.com/12205
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/compile: define func value symbols at declaration
Russ Cox [Tue, 14 Jul 2015 00:50:51 +0000 (20:50 -0400)]
cmd/compile: define func value symbols at declaration

These used to be defined at use, but that breaks when shared libraries
are involved.

For #11480.

Change-Id: I416a848754fb615c0d75f9f0ccc00723d07f7f01
Reviewed-on: https://go-review.googlesource.com/12145
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/internal/obj: fix pc/sp information for prologue
Russ Cox [Tue, 14 Jul 2015 01:21:49 +0000 (21:21 -0400)]
cmd/internal/obj: fix pc/sp information for prologue

When the prologue call to morestack was moved down to the
bottom of the function, the pc/sp tables were not updated.
If a traceback through a call to morestack is needed, it would
get confused at and stop at morestack.

Confirmed the fix by adding //go:systemstack (which calls
morestackc, but same issue) where it did not belong
and inspecting the crash.

Change-Id: Id0294bb9dba51ef1a49154637228fb57f1086a94
Reviewed-on: https://go-review.googlesource.com/12144
Reviewed-by: Rob Pike <r@golang.org>
9 years agonet/http: do not allow space or slash in Host headers
Jeff R. Allen [Thu, 18 Jun 2015 10:37:26 +0000 (12:37 +0200)]
net/http: do not allow space or slash in Host headers

A malformed Host header can result in a malformed HTTP request.
Clean them to avoid this.

Updates #11206. We may come back and make this stricter for 1.6.

Change-Id: I23c7d821cd9dbf66c3c15d26750f305e3672d984
Reviewed-on: https://go-review.googlesource.com/11241
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet: fix setKeepAlivePeriod on Plan 9
David du Colombier [Thu, 2 Jul 2015 06:36:45 +0000 (08:36 +0200)]
net: fix setKeepAlivePeriod on Plan 9

The interface to set TCP keepalive on Plan 9 is
writing the "keepalive n" string to the TCP ctl file,
where n is the milliseconds between keepalives.

Fixes #11266.

Change-Id: Ic96f6c584063665a1ddf921a9a4ddfa13cc7501b
Reviewed-on: https://go-review.googlesource.com/11860
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodoc: add a few more details about arm and ppc64 to asm.html
Rob Pike [Tue, 14 Jul 2015 00:24:40 +0000 (10:24 +1000)]
doc: add a few more details about arm and ppc64 to asm.html

Update #10096

Arm64 and Ppc64 are still pretty sketchy.

Change-Id: Iaf821b0f17bad8c71d338d45de75d4a345cac2dd
Reviewed-on: https://go-review.googlesource.com/12160
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agogo/types: fix internal inInteger operand predicate
Robert Griesemer [Fri, 10 Jul 2015 22:11:06 +0000 (16:11 -0600)]
go/types: fix internal inInteger operand predicate

When testing if a value is an integer, if the value is a constant,
don't ignore the type if it has one.

Fixes #11594.

Change-Id: I2ff387e4f9e8ab7cae35c4838350e0a1fce2e625
Reviewed-on: https://go-review.googlesource.com/12045
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agoencoding/xml: improve marshaller sanity checks of directives
Didier Spezia [Sat, 27 Jun 2015 13:07:22 +0000 (13:07 +0000)]
encoding/xml: improve marshaller sanity checks of directives

When building a directive, the current sanity check prevents
a '>' to be used, which makes a DOCTYPE directive with an
internal subset be rejected. It is accepted by the parser
though, so what can be parsed cannot be encoded.

Improved the corresponding sanity check to mirror the behavior
of the parser (in the way it handles angle brackets, quotes,
and comments).

Fixes #10158

Change-Id: Ieffea9f870f2694548e12897f8f47babc0ea4414
Reviewed-on: https://go-review.googlesource.com/11630
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodoc/go1.5.html: fix and expand crypto/tls changes
Jonathan Rudenberg [Tue, 14 Jul 2015 23:16:01 +0000 (19:16 -0400)]
doc/go1.5.html: fix and expand crypto/tls changes

- Fix incomplete description of minimum protocol version.
- Add mention of the new ConnectionState.OCSPResponse field.
- Clarify session ticket key rotation description.

Change-Id: I6b62d30a4d0e0f84fd2c0e70e8f66ec14e6a5a90
Reviewed-on: https://go-review.googlesource.com/12197
Reviewed-by: Rob Pike <r@golang.org>
9 years agoA+C: more updates before release
Brad Fitzpatrick [Wed, 15 Jul 2015 01:29:49 +0000 (18:29 -0700)]
A+C: more updates before release

Includes subrepos and some special cases.

Updates #10639

Change-Id: I3c9ad4f6ec689903f88ccf5599d93a338e3eec4d
Reviewed-on: https://go-review.googlesource.com/12211
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoencoding/json: Only allow string option for valid types
Larz Conwell [Sun, 17 May 2015 03:01:39 +0000 (23:01 -0400)]
encoding/json: Only allow string option for valid types

The "string" option only applies for strings, floats, integers, and
booleans as per the documentation. So when decoding ignore the "string"
option if the value is not of one of the types mentioned. This matches
the Marshal step which also ignores the "string" option for invalid
types.

Fixes #9812

Change-Id: I0fb2b43d0668bc0e2985886d989abbf2252070e2
Reviewed-on: https://go-review.googlesource.com/10183
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoA+C: update for release
Brad Fitzpatrick [Wed, 15 Jul 2015 00:35:58 +0000 (17:35 -0700)]
A+C: update for release

This is an automated update for the main branch of the main repo.
Some special cases and other repos will follow.

Updates #10639

Change-Id: I4b149c037e9292b7e323a9f4c009092ce6b70ce5
Reviewed-on: https://go-review.googlesource.com/12159
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agodoc/go1.5.html: fix typo
Jonathan Rudenberg [Tue, 14 Jul 2015 23:22:24 +0000 (19:22 -0400)]
doc/go1.5.html: fix typo

This is the first mention of the fmt package in the changes list.

Change-Id: I5d378d8707e6735e0e590527db4196b517fefd72
Reviewed-on: https://go-review.googlesource.com/12198
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agodoc/go1.5.html: fix typo
Jonathan Rudenberg [Tue, 14 Jul 2015 22:53:13 +0000 (18:53 -0400)]
doc/go1.5.html: fix typo

Change-Id: I8bbdf6c769e089fca8458166dffff5aea0f74675
Reviewed-on: https://go-review.googlesource.com/12196
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocrypto: add SHA-512/224 and SHA-512/256 as described in FIPS 180-4
Nevins Bartolomeo [Wed, 3 Jun 2015 20:55:41 +0000 (16:55 -0400)]
crypto: add SHA-512/224 and SHA-512/256 as described in FIPS 180-4

Change-Id: Ifbab8203dea1eb0df4c834df22e12cb7c37c14fd
Reviewed-on: https://go-review.googlesource.com/10683
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>

9 years agocmd/go: do not create subdirs of $GOBIN
David Crawshaw [Sat, 11 Jul 2015 15:28:16 +0000 (11:28 -0400)]
cmd/go: do not create subdirs of $GOBIN

Fixes #9769.

Change-Id: I2959906c71d0ce62cdb750dab78eab631a26f229
Reviewed-on: https://go-review.googlesource.com/12080
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/go: warn on get from code.google.com that it is shutting down
Ian Lance Taylor [Sat, 11 Jul 2015 13:42:48 +0000 (06:42 -0700)]
cmd/go: warn on get from code.google.com that it is shutting down

Fixes #10193.

Change-Id: Ibbb747babb697a66b943e5da76b0ada41f1fb14f
Reviewed-on: https://go-review.googlesource.com/12070
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodoc/go1.5.html: fix typo.
Ian Lance Taylor [Tue, 14 Jul 2015 15:14:03 +0000 (08:14 -0700)]
doc/go1.5.html: fix typo.

Fixes #11704.

Change-Id: If103f8eca7e53b0120885e2ec086db12176ea078
Reviewed-on: https://go-review.googlesource.com/12155
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoimage/jpeg: don't unread a byte if we've already taken bits from it.
Nigel Tao [Tue, 14 Jul 2015 05:46:18 +0000 (15:46 +1000)]
image/jpeg: don't unread a byte if we've already taken bits from it.

This rolls back most of golang.org/cl/8841, aka 2f98bac310, and makes a
different fix. It keeps the TestTruncatedSOSDataDoesntPanic test
introduced by that other CL, which obviously still passes after this CL.

Fixes #11650, a regression (introduced by cl/8841) from Go 1.4.

The original cl/8841 changed the image/jpeg not to panic on an input
given in #10387. We still do not panic on that input, after this CL.

I have a corpus of over 160,000 JPEG images, a sample of a web crawl.
The image/jpeg code ran happily over that whole corpus both before and
after this CL, although that corpus clearly didn't catch the regression
in the first place.

This code was otherwise tested manually. I don't think that it's trivial
to synthesize a JPEG input that happens to run out of Huffman data at
just the right place. The test image attached to #11650 obviously has
that property, but I don't think we can simply add that test image to
the repository: it's 227KiB, and I don't know its copyright status.

I also looked back over the issue tracker for problematic JPEGs that
people have filed. The Go code, after this CL, is still happy on these
files in my directory:
issue2362a.jpeg
issue3916.jpeg
issue3976.jpeg
issue4084.jpeg
issue4259.jpeg
issue4291.jpeg
issue4337.jpeg
issue4500.jpeg
issue4705.jpeg
issue4975.jpeg
issue5112.jpeg
issue6767.jpeg
issue9888.jpeg
issue10133.jpeg
issue10357.jpeg
issue10447.jpeg
issue11648.jpeg
issue11650.jpeg

There were other images attached in the issue tracker that aren't
actually valid JPEGs. They failed both before and after this CL:
broken-issue2362b.jpeg
broken-issue6450.jpeg
broken-issue8693.jpeg
broken-issue10154.jpeg
broken-issue10387.jpeg
broken-issue10388.jpeg
broken-issue10389.jpeg
broken-issue10413.jpeg

In summary, this CL fixes #11650 and, after some automated and manual
testing, I don't think introduces new regressions.

Change-Id: I30b67036e9b087f3051d57dac7ea05fb4fa36f66
Reviewed-on: https://go-review.googlesource.com/12163
Reviewed-by: Rob Pike <r@golang.org>
9 years agodoc: document behavior change in image/color in release notes
Rob Pike [Tue, 14 Jul 2015 05:20:19 +0000 (15:20 +1000)]
doc: document behavior change in image/color in release notes

Change-Id: I7ad90ab78abb8a39d56c837610d5c311a96b7039
Reviewed-on: https://go-review.googlesource.com/12162
Reviewed-by: Nigel Tao <nigeltao@golang.org>
9 years agoos/exec: fix plan9 build
Brad Fitzpatrick [Tue, 14 Jul 2015 05:13:32 +0000 (22:13 -0700)]
os/exec: fix plan9 build

Fixes build from https://golang.org/cl/12152

Plan 9 lacks syscall.EPIPE. I was misled by api/go1.txt and also
forgot to use the trybots. :(

Change-Id: I4982fe969ad4a8724090cb03009bfb21780d8aa7
Reviewed-on: https://go-review.googlesource.com/12153
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/go: mark ssh:// URLs as secure
Ross Light [Thu, 25 Jun 2015 20:14:28 +0000 (13:14 -0700)]
cmd/go: mark ssh:// URLs as secure

Add tests for isSecure function.

Change-Id: I49de9d2846b75d4c7be745484f85d351a6fd851d
Reviewed-on: https://go-review.googlesource.com/11514
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: fix build on non-x86 machines
Russ Cox [Tue, 14 Jul 2015 04:41:18 +0000 (00:41 -0400)]
runtime: fix build on non-x86 machines

Fixes #11656 (again).

Change-Id: I170ff10bfbdb0f34e57c11de42b6ee5291837813
Reviewed-on: https://go-review.googlesource.com/12142
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoos/exec: ignore pipe write errors when command completes successfully
Brad Fitzpatrick [Tue, 14 Jul 2015 00:17:24 +0000 (18:17 -0600)]
os/exec: ignore pipe write errors when command completes successfully

Fixes #9173

Change-Id: I83530533db84b07cb88dbf6ec690be48a06a9d7d
Reviewed-on: https://go-review.googlesource.com/12152
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agodoc: update the architecture-specific information in asm.html
Rob Pike [Mon, 13 Jul 2015 05:22:35 +0000 (15:22 +1000)]
doc: update the architecture-specific information in asm.html

Still to do: ARM64 and PPC64. These architectures are woefully underdocumented.

Change-Id: Iedcf767a7e0e1c931812351940bc08f0c3821212
Reviewed-on: https://go-review.googlesource.com/12110
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/internal/obj: rename *.out.go to a.out.go
Rob Pike [Mon, 13 Jul 2015 03:44:01 +0000 (13:44 +1000)]
cmd/internal/obj: rename *.out.go to a.out.go

The old numerical names like 6.out.go are a relic from the old tools.
Easier to rename than explain.

The anames.go files were modified by go generate; no changes
beyond the explanatory comment at the top.

Change-Id: I84742c75c60e47724baa9d49a91fef1f8581f021
Reviewed-on: https://go-review.googlesource.com/12069
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: fix MemStats.{PauseNS,PauseEnd,PauseTotalNS,LastGC}
Austin Clements [Wed, 1 Jul 2015 15:04:19 +0000 (11:04 -0400)]
runtime: fix MemStats.{PauseNS,PauseEnd,PauseTotalNS,LastGC}

These memstats are currently being computed by gcMark, which was
appropriate in Go 1.4, but gcMark is now just one part of a bigger
picture. In particular, it can't account for the sweep termination
pause time, it can't account for all of the mark termination pause
time, and the reported "pause end" and "last GC" times will be
slightly earlier than they really are.

Lift computing of these statistics into func gc, which has the
appropriate visibility into the process to compute them correctly.

Fixes one of the issues in #10323. This does not add new statistics
appropriate to the concurrent collector; it simply fixes existing
statistics that are being misreported.

Change-Id: I670cb16594a8641f6b27acf4472db15b6e8e086e
Reviewed-on: https://go-review.googlesource.com/11794
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: report MemStats.PauseEnd in UNIX time
Austin Clements [Tue, 30 Jun 2015 22:20:13 +0000 (18:20 -0400)]
runtime: report MemStats.PauseEnd in UNIX time

Currently we report MemStats.PauseEnd in nanoseconds, but with no
particular 0 time. On Linux, the 0 time is when the host started. On
Darwin, it's the UNIX epoch. This is also inconsistent with the other
absolute time in MemStats, LastGC, which is always reported in
nanoseconds since 1970.

Fix PauseEnd so it's always reported in nanoseconds since 1970, like
LastGC.

Fixes one of the issues raised in #10323.

Change-Id: Ie2fe3169d45113992363a03b764f4e6c47e5c6a8
Reviewed-on: https://go-review.googlesource.com/11801
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: fix x86 stack trace for call to heap memory
Russ Cox [Fri, 10 Jul 2015 16:32:03 +0000 (12:32 -0400)]
runtime: fix x86 stack trace for call to heap memory

Fixes #11656.

Change-Id: Ib81d583e4b004e67dc9d2f898fd798112434e7a9
Reviewed-on: https://go-review.googlesource.com/12026
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>

9 years agoruntime: fix race in TestChanSendBarrier
Russ Cox [Mon, 13 Jul 2015 19:23:59 +0000 (15:23 -0400)]
runtime: fix race in TestChanSendBarrier

Fixes race detector build.

Change-Id: I8bdc78d57487580e6b5b8c415df4653a1ba69e37
Reviewed-on: https://go-review.googlesource.com/12087
Reviewed-by: Austin Clements <austin@google.com>
9 years agonet: clean up builtin DNS stub resolver, fix tests
Mikio Hara [Thu, 11 Jun 2015 03:46:01 +0000 (12:46 +0900)]
net: clean up builtin DNS stub resolver, fix tests

This change does clean up as preparation for fixing #11081.

- renames cfg to resolvConf for clarification
- adds a new type resolverConfig and its methods: init, update,
  tryAcquireSema, releaseSema for mutual exclusion of resolv.conf data
- deflakes, simplifies tests for resolv.conf data; previously the tests
  sometimes left some garbage in the data

Change-Id: I277ced853fddc3791dde40ab54dbd5c78114b78c
Reviewed-on: https://go-review.googlesource.com/10931
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

9 years agocmd/go: fix go get -u with internal
Russ Cox [Fri, 10 Jul 2015 17:05:02 +0000 (13:05 -0400)]
cmd/go: fix go get -u with internal

Fixes #11307.
Fixes #11055.

Change-Id: I8d6b04cb509e62e27d6935b91ffe35fdaea4ebcd
Reviewed-on: https://go-review.googlesource.com/12028
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoruntime: add memory barrier for sync send in select
Russ Cox [Sat, 11 Jul 2015 15:53:58 +0000 (11:53 -0400)]
runtime: add memory barrier for sync send in select

Missed select case when adding the barrier last time.
All the more reason to refactor this code in Go 1.6.

Fixes #11643.

Change-Id: Ib0d19d6e0939296c0a3e06dda5e9b76f813bbc7e
Reviewed-on: https://go-review.googlesource.com/12086
Reviewed-by: Austin Clements <austin@google.com>
9 years agogo/internal/gcimporter: populate (*types.Package).Imports
Alan Donovan [Tue, 21 Apr 2015 19:05:18 +0000 (15:05 -0400)]
go/internal/gcimporter: populate (*types.Package).Imports

This is a copy of an upstream change to the tools repo:
https://go-review.googlesource.com/#/c/8924/

This is a second attempt at CL 8954, with the necessary change to
go/build's deps test.

Change-Id: Ib798498cf85fea0baec5667e9324d11f6ae8ad64
Reviewed-on: https://go-review.googlesource.com/9173
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoimage/png: don't read filter bytes for empty interlace passes.
Nigel Tao [Sun, 12 Jul 2015 11:02:13 +0000 (21:02 +1000)]
image/png: don't read filter bytes for empty interlace passes.

Fixes #11604

The gray-gradient.png image was created by a Go program:

----
package main

import (
"image"
"image/color"
"image/png"
"log"
"os"
)

func main() {
f, err := os.Create("a.png")
if err != nil {
log.Fatal(err)
}
defer f.Close()
m := image.NewGray(image.Rect(0, 0, 1, 16))
for i := 0; i < 16; i++ {
m.SetGray(0, i, color.Gray{uint8(i * 0x11)})
}
err = png.Encode(f, m)
if err != nil {
log.Fatal(err)
}
}
----

The equivalent gray-gradient.interlaced.png image was created via ImageMagick:
$ convert -interlace PNG gray-gradient.png gray-gradient.interlaced.png

As a sanity check:
$ file gray-gradient.*
gray-gradient.interlaced.png: PNG image data, 1 x 16, 4-bit grayscale, interlaced
gray-gradient.png:            PNG image data, 1 x 16, 8-bit grayscale, non-interlaced

Change-Id: I7700284f74d1ea30073aede3bce4d7651787bdbc
Reviewed-on: https://go-review.googlesource.com/12064
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/dist: actually disable testso and testsovar on ppc64
Michael Hudson-Doyle [Mon, 13 Jul 2015 03:20:12 +0000 (15:20 +1200)]
cmd/dist: actually disable testso and testsovar on ppc64

This is clearly what was intended all along. ./all.bash passes with this
change.

Change-Id: I16996da11cf1e4d2dc2a4434b7611a724691e8dc
Reviewed-on: https://go-review.googlesource.com/12068
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agodoc: add section about standard library to the FAQ
Brad Fitzpatrick [Sun, 5 Jul 2015 17:00:14 +0000 (10:00 -0700)]
doc: add section about standard library to the FAQ

Fixes #10246

Change-Id: Ifa698232a09e1c37f3a9340ffdc1f2650c06fe4c
Reviewed-on: https://go-review.googlesource.com/11900
Reviewed-by: Rob Pike <r@golang.org>
9 years agotime: document that time.Tick creates an unrecoverable resource
Rob Pike [Mon, 13 Jul 2015 01:13:15 +0000 (11:13 +1000)]
time: document that time.Tick creates an unrecoverable resource

Fixes #11662.

Change-Id: I8839b48a1cd3da4c29b6def03cb0c74c1c12942e
Reviewed-on: https://go-review.googlesource.com/12066
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agomisc/cgo/testshared: unset GOBIN during test
Ian Lance Taylor [Sun, 12 Jul 2015 17:18:32 +0000 (10:18 -0700)]
misc/cgo/testshared: unset GOBIN during test

Fixes #11273.

Change-Id: I409b6c4168711913076439036d65e8639ca3b06f
Reviewed-on: https://go-review.googlesource.com/12073
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/dist: disable misc/scgo/testsovar on netbsd
Alex Brainman [Sat, 11 Jul 2015 07:19:39 +0000 (17:19 +1000)]
cmd/dist: disable misc/scgo/testsovar on netbsd

Update #11654

Change-Id: Ia199b8dd349542ad8b92b463dd2f3734dd7e66a4
Reviewed-on: https://go-review.googlesource.com/12060
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoall: link to https for golang subdomains too
Brad Fitzpatrick [Sat, 11 Jul 2015 14:51:20 +0000 (08:51 -0600)]
all: link to https for golang subdomains too

The previous commit (git 2ae77376) just did golang.org.  This one
includes golang.org subdomains like blog, play, and build.

Change-Id: I4469f7b307ae2a12ea89323422044e604c5133ae
Reviewed-on: https://go-review.googlesource.com/12071
Reviewed-by: Rob Pike <r@golang.org>
9 years agoflag: Clarifies docs for Arg(int) and FlagSet.Arg(int)
Hariharan Srinath [Sat, 11 Jul 2015 08:50:14 +0000 (14:20 +0530)]
flag: Clarifies docs for Arg(int) and FlagSet.Arg(int)

Adds the clarification that these functions return empty
string if the requested element is not available

Added fullstops

Fixes #11664

Change-Id: I84173862bc785240f7d3ee75a5023673264d172b
Reviewed-on: https://go-review.googlesource.com/12061
Reviewed-by: Rob Pike <r@golang.org>
9 years agoall: link to https instead of http
Brad Fitzpatrick [Fri, 10 Jul 2015 23:17:11 +0000 (17:17 -0600)]
all: link to https instead of http

The one in misc/makerelease/makerelease.go is particularly bad and
probably warrants rotating our keys.

I didn't update old weekly notes, and reverted some changes involving
test code for now, since we're late in the Go 1.5 freeze. Otherwise,
the rest are all auto-generated changes, and all manually reviewed.

Change-Id: Ia2753576ab5d64826a167d259f48a2f50508792d
Reviewed-on: https://go-review.googlesource.com/12048
Reviewed-by: Rob Pike <r@golang.org>
9 years agonet/http/fcgi: fix race between serveRequest and cleanUp
Brad Fitzpatrick [Fri, 3 Jul 2015 19:32:40 +0000 (12:32 -0700)]
net/http/fcgi: fix race between serveRequest and cleanUp

Fixes #11552

Change-Id: I87904e9e3fb4bd1fb4c7075a4e2d0151e5bd37df
Reviewed-on: https://go-review.googlesource.com/11890
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agoruntime: abort on fatal errors and panics in c-shared and c-archive modes
Elias Naur [Sat, 11 Jul 2015 10:59:00 +0000 (12:59 +0200)]
runtime: abort on fatal errors and panics in c-shared and c-archive modes

The default behaviour for fatal errors and runtime panics is to dump
the goroutine stack traces and exit with code 2. However, when the process is
owned by foreign code, it is suprising and inappropriate to suddenly exit
the whole process, even on fatal errors. Instead, re-use the crash behaviour
from GOTRACEBACK=crash and abort.

The motivating use case is issue #11382, where an Android crash reporter
is confused by an exiting process, but I believe the aborting behaviour
is appropriate for all cases where Go does not own the process.

The change is simple and contained and will enable reliable crash reporting
for Android apps in Go 1.5, but I'll leave it to others to judge whether it
is too late for Go 1.5.

Fixes #11382

Change-Id: I477328e1092f483591c99da1fbb8bc4411911785
Reviewed-on: https://go-review.googlesource.com/12032
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoruntime: use AddVectoredContinueHandler on Windows XP amd64
Alex Brainman [Mon, 6 Jul 2015 00:34:01 +0000 (10:34 +1000)]
runtime: use AddVectoredContinueHandler on Windows XP amd64

Recent change (CL 10370) unexpectedly broke TestRaiseException on
Windows XP amd64. I still do not know why. But reverting old
CL 8165 fixes the problem.

This effectively makes Windows XP amd64 use AddVectoredContinueHandler
instead of SetUnhandledExceptionFilter for exception handling. That is
what we do for all recent Windows versions too.

Fixes #11481

Change-Id: If2e8037711f05bf97e3c69f5a8d86af67c58f6fc
Reviewed-on: https://go-review.googlesource.com/11888
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agomath: Expm1 returns -1 with large negative argument.
Charlie Dorian [Wed, 1 Jul 2015 00:14:30 +0000 (20:14 -0400)]
math: Expm1 returns -1 with large negative argument.

Fixes #11442

Change-Id: I2053fe752c6a122924d28565f1338f73e00ed417
Reviewed-on: https://go-review.googlesource.com/11791
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/link/internal/ld: stricter object file decoding
Matthew Dempsky [Fri, 10 Jul 2015 21:38:35 +0000 (14:38 -0700)]
cmd/link/internal/ld: stricter object file decoding

Instead of silently truncating integers to their expected range, check
that they're within range and emit errors if not.  Intended to help
narrow down the cause of issue #11617.

Change-Id: Ia7b577270f8438ca7479262702371e26277f1ea7
Reviewed-on: https://go-review.googlesource.com/12050
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime, cmd/go: fix tests to work when GOROOT_FINAL is set
Ian Lance Taylor [Fri, 10 Jul 2015 12:20:20 +0000 (05:20 -0700)]
runtime, cmd/go: fix tests to work when GOROOT_FINAL is set

When GOROOT_FINAL is set when running all.bash, the tests are run
before the files are copied to GOROOT_FINAL.  The tests are run with
GOROOT set, so most work fine.  This fixes two cases that do not.

In cmd/go/go_test.go we were explicitly removing GOROOT from the
environment, causing tests that did not themselves explicitly set
GOROOT to fail.  There was no need to explicitly remove GOROOT, so
don't do it.  If people choose to run "go test cmd/go" with a bad
GOROOT, that is their own lookout.

In the runtime GDB test, the linker has told gdb to find the support
script in GOROOT_FINAL, which will fail.  Check for that case, and
skip the test when we see it.

Fixes #11652.

Change-Id: I4d3a32311e3973c30fd8a79551aaeab6789d0451
Reviewed-on: https://go-review.googlesource.com/12021
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: clarify that NumCPU returns only available CPUs
Ian Lance Taylor [Fri, 10 Jul 2015 13:20:51 +0000 (06:20 -0700)]
runtime: clarify that NumCPU returns only available CPUs

Update #11609.

Change-Id: Ie363facf13f5e62f1af4a8bdc42a18fb36e16ebf
Reviewed-on: https://go-review.googlesource.com/12022
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet: fix misidentification of link-local, global unicast IP addresses
Mikio Hara [Sat, 4 Jul 2015 04:49:47 +0000 (13:49 +0900)]
net: fix misidentification of link-local, global unicast IP addresses

Don't treat IPv4-mapped link-local IP addresses as IPv6 link-local
addresses, an IPv4 broadcast address as a global unicast IP address.

Fixes #11585.

Change-Id: I6a7a0c0601f18638f5c624ab63e12ee40f77b182
Reviewed-on: https://go-review.googlesource.com/11883
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet: ensure that ResolveIPAddr(addr.String()) reproduces addr
Mikio Hara [Tue, 7 Jul 2015 03:10:15 +0000 (12:10 +0900)]
net: ensure that ResolveIPAddr(addr.String()) reproduces addr

Updates #6465.

Change-Id: I5babbcf4c92dae47c823a41628b01e4ceb2332eb
Reviewed-on: https://go-review.googlesource.com/11951
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/doc: submit to the punched card tyranny
Rob Pike [Fri, 10 Jul 2015 01:52:39 +0000 (11:52 +1000)]
cmd/doc: submit to the punched card tyranny

People use 80-column terminals because their grandparents used
punched cards. When I last used a punched card, in 1978, it seemed
antiquated even then. But today, people still set their terminal
widths to 80 to honor the struggles their fallen ancestors made to
endure this painful technology.

We must all stand and salute the 80 column flag, or risk the opprobium
of our peers.

For Pete's sake, I don't even use a fixed-width font. I don't even
believe in columns.

Fixes #11639 with extreme reluctance.

P.S. To avoid the horror of an automatically folded line of text, this commit message has been formatted to fit on an 80-column line, except for this postscript.

Change-Id: Ia2eb2dcf293dabe804c22ee5abb4bbb703f45c33
Reviewed-on: https://go-review.googlesource.com/12011
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agodebug/pe: truncate pe sections to their size in memory
Alex Brainman [Mon, 6 Jul 2015 05:52:33 +0000 (15:52 +1000)]
debug/pe: truncate pe sections to their size in memory

Section.Data returns disk section data, but those are rounded up to
some predefined value. Processing these as is confuses dwarf parser
because of garbage at the end. Truncate Section.Data as per memory
section description.

Sometimes dwarf sections have memory section size of 0
(for pe object files). Keep those to their disk size.

Fixes #11608

Change-Id: I8de0a2271201a24aa9ac8dac44f1e9c8a9285183
Reviewed-on: https://go-review.googlesource.com/11950
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet: add mechanisms to force go or cgo lookup, and to debug default strategy
Brad Fitzpatrick [Thu, 25 Jun 2015 10:52:54 +0000 (12:52 +0200)]
net: add mechanisms to force go or cgo lookup, and to debug default strategy

GODEBUG=netdns=1 prints a one-time strategy decision. (cgo or go DNS lookups)
GODEBUG=netdns=2 prints the per-lookup strategy as a function of the hostname.

The new "netcgo" build tag forces cgo DNS lookups.

GODEBUG=netdns=go (or existing build tag "netgo") forces Go DNS resolution.
GODEBUG=netdns=cgo (or new build tag "netcgo") forces libc DNS resolution.

Options can be combined with e.g. GODEBUG=netdns=go+1 or GODEBUG=netdns=2+cgo.

Fixes #11322
Fixes #11450

Change-Id: I7a67e9f759fd0a02320e7803f9ded1638b19e861
Reviewed-on: https://go-review.googlesource.com/11584
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

9 years agoCONTRIBUTORS: add Ross Light's google.com email
Ross Light [Thu, 9 Jul 2015 17:13:09 +0000 (10:13 -0700)]
CONTRIBUTORS: add Ross Light's google.com email

Change-Id: Ide5b0c81405fbf6b83a6f02527d629898e0fcf02
Reviewed-on: https://go-review.googlesource.com/12000
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: make sysmon-triggered GC concurrent
Austin Clements [Wed, 8 Jul 2015 21:18:33 +0000 (14:18 -0700)]
runtime: make sysmon-triggered GC concurrent

sysmon triggers a GC if there has been no GC for two minutes.
Currently, this is a STW GC. There is no reason for this to be STW, so
make it concurrent.

Fixes #10261.

Change-Id: I92f3ac37272d5c2a31480ff1fa897ebad08775a9
Reviewed-on: https://go-review.googlesource.com/11955
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodoc: document the machine-independent changes to the assembler
Rob Pike [Wed, 8 Jul 2015 05:53:47 +0000 (15:53 +1000)]
doc: document the machine-independent changes to the assembler

The architecture-specific details will be updated and expanded in
a subsequent CL (or series thereof).

Update #10096

Change-Id: I59c6be1fcc123fe8626ce2130e6ffe71152c87af
Reviewed-on: https://go-review.googlesource.com/11954
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodoc: R13 is stack pointer on ARM, not 386
Rob Pike [Thu, 9 Jul 2015 05:06:15 +0000 (15:06 +1000)]
doc: R13 is stack pointer on ARM, not 386

Fix typo.

TBR=rsc

Change-Id: I85d1b46744a9a4524e7949e452cdebb53afe0740
Reviewed-on: https://go-review.googlesource.com/11959
Reviewed-by: Rob Pike <r@golang.org>
9 years agodoc: add -test.count and get -insecure to go1.5.html
Rob Pike [Thu, 9 Jul 2015 00:10:12 +0000 (10:10 +1000)]
doc: add -test.count and get -insecure to go1.5.html

Change-Id: Ie3d603a95826b9b6a7acd4825991f24c3c61408b
Reviewed-on: https://go-review.googlesource.com/11956
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/doc: suppress symbols for commands when showing package docs
Rob Pike [Wed, 8 Jul 2015 01:17:01 +0000 (11:17 +1000)]
cmd/doc: suppress symbols for commands when showing package docs

Change the default behavior when showing the package docs
for a command to elide the symbols. This makes

go doc somecommand

show the top-level package docs only and hide the symbols,
which are probably irrelevant to the user. This has no effect
on explicit requests for internals, such as

go doc somecommand.sometype

The new -cmd flag restores the old behavior.

Fixes #10733.

Change-Id: I4d363081fe7dabf76ec8e5315770ac3609592f80
Reviewed-on: https://go-review.googlesource.com/11953
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/asm: add copyright notices to tests
Rob Pike [Thu, 9 Jul 2015 02:49:01 +0000 (12:49 +1000)]
cmd/asm: add copyright notices to tests

They were missing from the inputs.
Unfortunately this means the .out files all have wrong line numbers,
but they are easy to update.

Change-Id: I254742f24ab803421f34d52d13b9afa93674edd6
Reviewed-on: https://go-review.googlesource.com/11958
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodoc/go1.5: mention net/http.Request.Cancel
Aaron Jacobs [Wed, 8 Jul 2015 00:05:39 +0000 (10:05 +1000)]
doc/go1.5: mention net/http.Request.Cancel

This was added in commit 8b4278ffb75e79c277bfa90c5e473bfad9f7c1bd.

Change-Id: I95279f2779c2bab2767e34389fb4324900c01e6c
Reviewed-on: https://go-review.googlesource.com/11952
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/go: disable vendoredImportPath for code outside $GOPATH go1.5beta1
Russ Cox [Tue, 7 Jul 2015 21:51:20 +0000 (17:51 -0400)]
cmd/go: disable vendoredImportPath for code outside $GOPATH

It was crashing.
This fixes the build for
GO15VENDOREXPERIMENT=1 go test -short runtime

Fixes #11416.

Change-Id: I74a9114cdd8ebafcc9d2a6f40bf500db19c6e825
Reviewed-on: https://go-review.googlesource.com/11964
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/compile: allow static init for unsafe.Pointer(&x) where x is global
Russ Cox [Mon, 29 Jun 2015 16:49:25 +0000 (12:49 -0400)]
cmd/compile: allow static init for unsafe.Pointer(&x) where x is global

This avoids both a write barrier and then dynamic initialization
globals of the form

var x something
var xp = unsafe.Pointer(&x)

Using static initialization avoids emitting a relocation for &x,
which helps cgo.

Fixes #9411.

Change-Id: I0dbf480859cce6ab57ab805d1b8609c45b48f156
Reviewed-on: https://go-review.googlesource.com/11693
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>