]> Cypherpunks repositories - gostls13.git/log
gostls13.git
9 years agoencoding/json: document Indent's preservation of trailing spaces
Russ Cox [Tue, 8 Dec 2015 19:09:59 +0000 (14:09 -0500)]
encoding/json: document Indent's preservation of trailing spaces

Fixes #13520.

Change-Id: Ia70cc44be3912167b369d7f74d3436331975c300
Reviewed-on: https://go-review.googlesource.com/17561
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocrypto/elliptic: resample private keys if out of range.
Adam Langley [Fri, 4 Dec 2015 22:17:03 +0000 (14:17 -0800)]
crypto/elliptic: resample private keys if out of range.

The orders of the curves in crypto/elliptic are all very close to a
power of two. None the less, there is a tiny bias in the private key
selection.

This change makes the distribution uniform by resampling in the case
that a private key is >= to the order of the curve. (It also switches
from using BitSize to Params().N.BitLen() because, although they're the
same value here, the latter is technically the correct thing to do.)

The private key sampling and nonce sampling in crypto/ecdsa don't have
this issue.

Fixes #11082.

Change-Id: Ie2aad563209a529fa1cab522abaf5fd505c7269a
Reviewed-on: https://go-review.googlesource.com/17460
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodoc: add heading IDs to Code of Conduct
Chris Broadfoot [Mon, 7 Dec 2015 21:45:06 +0000 (13:45 -0800)]
doc: add heading IDs to Code of Conduct

Fixes #13514

Change-Id: I3903d3926ed4f5d54cfb77209d93c950b832b933
Reviewed-on: https://go-review.googlesource.com/17511
Reviewed-by: Francesc Campoy Flores <campoy@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agogo/parser, go/types: report invalid else branch in if statements
Robert Griesemer [Fri, 4 Dec 2015 01:28:46 +0000 (17:28 -0800)]
go/parser, go/types: report invalid else branch in if statements

- Only accept valid if statement syntax in go/parser.

- Check AST again in go/types since it may have been modified and the
  AST doesn't preclude other statements in the else branch of an if
  statement.

- Removed a test from gofmt which verified that old-style if statements
  permitting any statement in the else branch were correctly reformatted.
  It's been years since we switched to the current syntax; no need to
  support this anymore.

- Added a comment to go/printer.

Fixes #13475.

Change-Id: Id2c8fbcc68b719cd511027d0412a37266cceed6b
Reviewed-on: https://go-review.googlesource.com/17408
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/go: fix bad shared lib name with buildmode=shared
Aleksandr Demakin [Tue, 25 Aug 2015 16:54:57 +0000 (19:54 +0300)]
cmd/go: fix bad shared lib name with buildmode=shared

Use import paths of packages to build a shared lib name.
Use arguments for meta-packages 'std', 'cmd', and 'all'.

Fixes #12236

Change-Id: If274d63301686ef34e198287eb012f9062541ea0
Reviewed-on: https://go-review.googlesource.com/13921
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 agoencoding/gob: document behavior of zero-valued arrays, slices, and maps
Rob Pike [Thu, 3 Dec 2015 21:06:04 +0000 (13:06 -0800)]
encoding/gob: document behavior of zero-valued arrays, slices, and maps

The documentation was inconsistent. It said zero values were not sent, but
that zero-valued elements of arrays and arrays were sent. But which rule
applies if the array is all zero elements, and is therefore itself a zero value?

The answer is: the array is transmitted. In principle the other choice could
be made, but there would be considerable expense and complexity required
to implement this behavior now, not to mention worries about changes of
behavior.

Therefore we just document the situation: Arrays, slices, and maps are
always encoded. It would perhaps be nice to have sorted this out earlier,
but it was a missed opportunity.

Fixes #13378

Change-Id: I8fae345edfa707fcfa7a3e0160d87ff1ac5cc5a2
Reviewed-on: https://go-review.googlesource.com/17394
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/compile/internal/gc: fix internal compiler error on invalid declaration
Didier Spezia [Sun, 4 Oct 2015 20:33:02 +0000 (20:33 +0000)]
cmd/compile/internal/gc: fix internal compiler error on invalid declaration

Following an empty import, a declaration involving a ? symbol
generates an internal compiler error when the name of the
symbol (in newname function).

package a
import""
var?

go.go:2: import path is empty
go.go:3: internal compiler error: newname nil

Make sure dclname is not called when the symbol is nil.
The error message is now:

go.go:2: import path is empty
go.go:3: invalid declaration
go.go:4: syntax error: unexpected EOF

This CL was initially meant to be applied to the old parser,
and has been updated to apply to the new parser.

Fixes #11610

Change-Id: I75e07622fb3af1d104e3a38c89d9e128e3b94522
Reviewed-on: https://go-review.googlesource.com/15268
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/compile: avoid converting huge floats to integers
Robert Griesemer [Thu, 3 Dec 2015 23:51:03 +0000 (15:51 -0800)]
cmd/compile: avoid converting huge floats to integers

Fixes #13471.

Change-Id: I232ad1729343d020254e313cfff182695ad6fc54
Reviewed-on: https://go-review.googlesource.com/17401
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: best-effort detection of concurrent misuse of maps
Russ Cox [Mon, 7 Dec 2015 19:22:08 +0000 (14:22 -0500)]
runtime: best-effort detection of concurrent misuse of maps

If reports like #13062 are really concurrent misuse of maps,
we can detect that, at least some of the time, with a cheap check.

There is an extra pair of memory writes for writing to a map,
but to the same cache line as h.count, which is often being modified anyway,
and there is an extra memory read for reading from a map,
but to the same cache line as h.count, which is always being read anyway.
So the check should be basically invisible and may help reduce the
number of "mysterious runtime crash due to map misuse" reports.

Change-Id: I0e71b0d92eaa3b7bef48bf41b0f5ab790092487e
Reviewed-on: https://go-review.googlesource.com/17501
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/compile/internal/gc: fix panic in Type Stringer
Didier Spezia [Sat, 29 Aug 2015 11:30:10 +0000 (11:30 +0000)]
cmd/compile/internal/gc: fix panic in Type Stringer

The following code:

func n() {(interface{int})}

generates:

3: interface contains embedded non-interface int
3: type %!v(PANIC=runtime error: invalid memory address or nil pointer dereference) is not an expression

It is because the corresponding symbol (Sym field in Type object)
is nil, resulting in a panic in typefmt.

Just skip the symbol if it is nil, so that the error message becomes:

3: interface contains embedded non-interface int
3: type interface { int } is not an expression

Fixes #11614

Change-Id: I219ae7eb01edca264fad1d4a1bd261d026294b00
Reviewed-on: https://go-review.googlesource.com/14015
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>

9 years agocmd/compile: base mapaccess optimizations on algtype
Matthew Dempsky [Mon, 7 Dec 2015 10:12:12 +0000 (02:12 -0800)]
cmd/compile: base mapaccess optimizations on algtype

algtype already controls the behavior of the normal map access code
paths, so it makes sense to base the decision on which optimized paths
are applicable on it too.

Enables use of optimized paths for key types like [8]byte and struct{s
string}.

Fixes #13271.

Change-Id: I48c52d97abaa7259ad5aba9641ea996a967cd359
Reviewed-on: https://go-review.googlesource.com/17464
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
9 years agocmd/go: always show current value for GO15VENDOREXPERIMENT
Daniel Theophanes [Sun, 6 Dec 2015 15:51:30 +0000 (07:51 -0800)]
cmd/go: always show current value for GO15VENDOREXPERIMENT

Prior behavior would show empty string when unset. In go1.5 this
would result in "off". In go1.6 this will result in "on". This
change will make empty or "0" off and "1" on for go1.5 and go1.6.
Vendor tools can then rely on this value.

Discussion:
https://groups.google.com/forum/#!topic/golang-dev/oZzcXrlRrkA

Change-Id: I7e145a32e813dfde02dc262a9186c7af28db7b92
Reviewed-on: https://go-review.googlesource.com/17487
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 agonet/http: sniffWrite test also in http2 mode
Emmanuel Odeke [Sat, 5 Dec 2015 06:22:26 +0000 (23:22 -0700)]
net/http: sniffWrite test also in http2 mode

Change-Id: Ifa9f1ed6a3b8d3f7536f2d315259940335b0ee49
Reviewed-on: https://go-review.googlesource.com/17438
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocrypto/x509: convert ErrInsecureAlgorithm into a type
Brad Fitzpatrick [Thu, 3 Dec 2015 23:23:24 +0000 (15:23 -0800)]
crypto/x509: convert ErrInsecureAlgorithm into a type

Change-Id: I411aeaf0cf75eb8b1c9005b622f664e9f25e4a68
Reviewed-on: https://go-review.googlesource.com/17400
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet/url: accept non-ASCII bytes in URL per RFC 3986
Russ Cox [Fri, 4 Dec 2015 17:15:30 +0000 (12:15 -0500)]
net/url: accept non-ASCII bytes in URL per RFC 3986

Fixes #7991.
Fixes #12719.

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

9 years agogo/doc, syscall: change 'more then' to 'more than'
andrey mirtchovski [Mon, 7 Dec 2015 00:44:44 +0000 (17:44 -0700)]
go/doc, syscall: change 'more then' to 'more than'

This change modifies comments to use the more gramatically correct "more than"
instead of "more then".

Change-Id: Ie3bddcf25eb6b243a21da934f2f3c76a750c083a
Reviewed-on: https://go-review.googlesource.com/17488
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agodoc: go1.6.txt: note windows path/filepath.Join behaviour change
Alex Brainman [Sun, 6 Dec 2015 06:14:50 +0000 (17:14 +1100)]
doc: go1.6.txt: note windows path/filepath.Join behaviour change

Change-Id: I321eba716319bf88695ac49580837b6254f1279e
Reviewed-on: https://go-review.googlesource.com/17474
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
9 years agopath/filepath: handle c: as first parameter in Join properly
Alex Brainman [Sat, 5 Dec 2015 03:29:39 +0000 (14:29 +1100)]
path/filepath: handle c: as first parameter in Join properly

This is CL 11882 brought back to life.

Fixes #11551

Change-Id: I29810183957745442d1e9937f56a66fc9c6cc82a
Reviewed-on: https://go-review.googlesource.com/17470
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agomisc/cgo/stdio: reenable tests
Russ Cox [Sat, 5 Dec 2015 03:51:03 +0000 (22:51 -0500)]
misc/cgo/stdio: reenable tests

The build tags are necessary to keep "go build" in that directory
building only stdio.go, but we have to arrange for test/run.go to
treat them as satisfied.

Fixes #12625.

Change-Id: Iec0cb2fdc2c9b24a4e0530be25e940aa0cc9552e
Reviewed-on: https://go-review.googlesource.com/17454
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: fix integer comparison in signal handling
Russ Cox [Sat, 5 Dec 2015 04:19:02 +0000 (23:19 -0500)]
runtime: fix integer comparison in signal handling

(sig is unsigned, so sig-1 >= 0 is always true.)

Fixes #11281.

Change-Id: I4b9d784da6e3cc80816f2d2f7228d5d8a237e2d5
Reviewed-on: https://go-review.googlesource.com/17457
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

9 years agoruntime: document that NumCPU does not change
Russ Cox [Sat, 5 Dec 2015 04:16:50 +0000 (23:16 -0500)]
runtime: document that NumCPU does not change

Fixes #11609.

Change-Id: I3cf64164fde28ebf739706728b84d8ef5b6dc90e
Reviewed-on: https://go-review.googlesource.com/17456
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agomime: fix parsing of empty string attribute value
Russ Cox [Sat, 5 Dec 2015 03:50:23 +0000 (22:50 -0500)]
mime: fix parsing of empty string attribute value

Fixes #11290.

Change-Id: I312f0731077b78a4bed47062eb7fd1ab52bc3dd1
Reviewed-on: https://go-review.googlesource.com/17453
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoruntime: check and fail early with a message if MMX is not available on 386
Shenghou Ma [Sat, 17 Oct 2015 21:46:25 +0000 (17:46 -0400)]
runtime: check and fail early with a message if MMX is not available on 386

Fixes #12970.

Change-Id: Id0026e8274e071d65d47df63d65a93110abbec5d
Reviewed-on: https://go-review.googlesource.com/15998
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoRevert "syscall: route_freebsd switch routing socket sysctl to use NET_RT_IFLISTL"
Yuval Pavel Zholkover [Sat, 5 Dec 2015 07:28:25 +0000 (07:28 +0000)]
Revert "syscall: route_freebsd switch routing socket sysctl to use NET_RT_IFLISTL"

This reverts commit f25f6eab0cb732d24759b2e166a9a644ae96dffe.

Sorry, this was not meant to go in without the ztypes_freebsd_arm.go and the copyFromV9 function.

Change-Id: I4ac2a8a23809ec1b1b9e42992cd0f3c349848f06
Reviewed-on: https://go-review.googlesource.com/17472
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/vet: move cmd/vet/whitelist to cmd/vet/internal/whitelist
Russ Cox [Sat, 5 Dec 2015 04:03:58 +0000 (23:03 -0500)]
cmd/vet: move cmd/vet/whitelist to cmd/vet/internal/whitelist

This was a mistake made when bringing cmd/vet into the main repo.

Fixes #13416.

Change-Id: I03b512ab944577c56085aea06df8ff5e1acc16d7
Reviewed-on: https://go-review.googlesource.com/17455
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agonet: adjust Lookup API test cases
Mikio Hara [Fri, 4 Dec 2015 08:54:21 +0000 (17:54 +0900)]
net: adjust Lookup API test cases

This change makes existing Lookup API test cases conform to the new
return value form that all the Lookup APIs except LookupTXT must return
a single or multiple absolute domain names.

Updates #12189.
Fixes #12193.

Change-Id: I03ca09be5bff80e818fbcdc26039daa33d5440a8
Reviewed-on: https://go-review.googlesource.com/17411
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: reject slice/map/func comparisons against converted nil
Matthew Dempsky [Fri, 4 Dec 2015 22:44:27 +0000 (14:44 -0800)]
cmd/compile: reject slice/map/func comparisons against converted nil

Fixes #13480.

Change-Id: Icbf4f83e965e84f7020f56c3f346193f8b91e7bf
Reviewed-on: https://go-review.googlesource.com/17461
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agosyscall: route_freebsd switch routing socket sysctl to use NET_RT_IFLISTL
Yuval Pavel Zholkover [Sat, 19 Sep 2015 13:43:43 +0000 (16:43 +0300)]
syscall: route_freebsd switch routing socket sysctl to use NET_RT_IFLISTL

Switch IfMsghdr and IfaMsghdr to their 'l' variants, make the IfData layout
to be based on FreeBSD-11.0 (freebsdVersion >= 1100011).
Using freebsdVersion, detect the appropriate layout at runtime and decode
routing socket messages into the new IfData layout.

Fixes #11641

Change-Id: Ic7ec550f00c0d15f46a36f560d835e4f138f61e1
Reviewed-on: https://go-review.googlesource.com/14757
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/link: clean up dwarf.go
Didier Spezia [Sat, 10 Oct 2015 10:57:35 +0000 (10:57 +0000)]
cmd/link: clean up dwarf.go

Try to remove the most visible artefacts resulting from the
C to Go translation. It includes:

- refactoring the find function to eliminate goto and variable declarations
- removing useless variables still having a _ = xxx
- decreasing the number of upfront variable declarations

No semantic changes.

Change-Id: I84d981c48b2d9e22e6b9db5f2a703c80c60249ba
Reviewed-on: https://go-review.googlesource.com/15681
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/pprof: exit with non-zero status code on error
Mohit Agarwal [Fri, 6 Nov 2015 17:57:01 +0000 (23:27 +0530)]
cmd/pprof: exit with non-zero status code on error

Set the status code in case of error.

Fixes #11510

Change-Id: If461c30a1f6d2275539f33a2eabd7b19bbfa411d
Reviewed-on: https://go-review.googlesource.com/16718
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/vet: make "-all -shadow" mean all default checks and -shadow
Konstantin Shaposhnikov [Mon, 26 Oct 2015 12:10:54 +0000 (20:10 +0800)]
cmd/vet: make "-all -shadow" mean all default checks and -shadow

Prior to this change "go tool vet -all -shadow" ran only -shadow check.

Also fix godoc package path in the usage text.

Fixes #13020

Change-Id: I87c60d6b06a02106ae8bff56adb79df032cc4646
Reviewed-on: https://go-review.googlesource.com/16325
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/pprof/internal: map/slice literals janitoring
Didier Spezia [Sun, 23 Aug 2015 12:41:07 +0000 (12:41 +0000)]
cmd/pprof/internal: map/slice literals janitoring

Simplify slice/map literal expression.
Caught with gofmt -d -s, fixed with gofmt -w -s

Change-Id: I19723900d0649019bf79b9330d68525a68ed69c4
Reviewed-on: https://go-review.googlesource.com/13835
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet/url: accept empty port after colon in IPv6 literal host
Russ Cox [Fri, 4 Dec 2015 16:39:57 +0000 (11:39 -0500)]
net/url: accept empty port after colon in IPv6 literal host

Fixes #12200.

Change-Id: I89f2a7326bb9182024c44bf815a06fa48639649d
Reviewed-on: https://go-review.googlesource.com/17384
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agomisc/cgo/testcshared: use fd 100 instead of fd 10 for back-channel communication
Russ Cox [Fri, 4 Dec 2015 20:46:22 +0000 (15:46 -0500)]
misc/cgo/testcshared: use fd 100 instead of fd 10 for back-channel communication

There is a report that fd 10 is already in use when run on some OS X machines.
I don't see how, and I can't reproduce the problem on my own OS X machine,
but it's easy enough to fix.

Fixes #12161.

Change-Id: I73511bdd91258ecda181d60d2829add746d1198b
Reviewed-on: https://go-review.googlesource.com/17451
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime/cgo: assume Solaris thread stack is at least 1 MB
Russ Cox [Fri, 4 Dec 2015 21:10:15 +0000 (16:10 -0500)]
runtime/cgo: assume Solaris thread stack is at least 1 MB

When run with "ulimit -s unlimited", the misc/cgo/test test binary
finds a stack size of 0x3000 returned by getcontext, causing the
runtime to try to stay within those bounds and then fault when
called back in the test after 64 kB has been used by C.

I suspect that Solaris is doing something clever like reporting the
current stack size and growing the stack as faults happen.
On all the other systems, getcontext reports the maximum stack size.
And when the ulimit is not unlimited, even Solaris reports the
maximum stack size.

Work around this by assuming that any stack on Solaris must be at least 1 MB.

Fixes #12210.

Change-Id: I0a6ed0afb8a8f50aa1b2486f32b4ae470ab47dbf
Reviewed-on: https://go-review.googlesource.com/17452
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agosyscall: fix ParseRoutingSockaddr name in docs
Yann Kerhervé [Fri, 4 Dec 2015 18:07:44 +0000 (10:07 -0800)]
syscall: fix ParseRoutingSockaddr name in docs

Change-Id: I3870150fc8e713f6164371299c029b31f18f250a
Reviewed-on: https://go-review.googlesource.com/17426
Reviewed-by: Minux Ma <minux@golang.org>
9 years agonet/http: make TestRedirect also test in http2 mode
Emmanuel Odeke [Fri, 4 Dec 2015 23:31:20 +0000 (16:31 -0700)]
net/http: make TestRedirect also test in http2 mode

Change-Id: Idfbe91abc11b2b3b735cd8d11fb1938f9e5c0473
Reviewed-on: https://go-review.googlesource.com/17437
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet/http: sniff tests ported to h2
Emmanuel Odeke [Fri, 4 Dec 2015 23:24:35 +0000 (16:24 -0700)]
net/http: sniff tests ported to h2

Change-Id: Icad6cc130252ac177946b23c12f36d6ba3275bf0
Reviewed-on: https://go-review.googlesource.com/17436
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http: TimeoutHandler test ported to HTTP/2
Emmanuel Odeke [Fri, 4 Dec 2015 22:09:59 +0000 (15:09 -0700)]
net/http: TimeoutHandler test ported to HTTP/2

Change-Id: I69e62199140e5cf203696af17d4816f3a5f13bd1
Reviewed-on: https://go-review.googlesource.com/17434
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http: testHeadResponses port for h2
Emmanuel Odeke [Fri, 4 Dec 2015 22:31:46 +0000 (15:31 -0700)]
net/http: testHeadResponses port for h2

Change-Id: I4cf4596a305510cd25df34ecebd11a19266415f1
Reviewed-on: https://go-review.googlesource.com/17435
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoarchive/tar: properly parse GNU base-256 encoding
Joe Tsai [Wed, 2 Dec 2015 23:41:44 +0000 (15:41 -0800)]
archive/tar: properly parse GNU base-256 encoding

Motivation:
* Previous implementation did not detect integer overflow when
parsing a base-256 encoded field.
* Previous implementation did not treat the integer as a two's
complement value as specified by GNU.

The relevant GNU specification says:
<<<
GNU format uses two's-complement base-256 notation to store values
that do not fit into standard ustar range.
>>>

Fixes #12435

Change-Id: I4639bcffac8d12e1cb040b76bd05c9d7bc6c23a8
Reviewed-on: https://go-review.googlesource.com/17424
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet/http: Connection:close test is h1 specific
Emmanuel Odeke [Fri, 4 Dec 2015 21:49:45 +0000 (14:49 -0700)]
net/http: Connection:close test is h1 specific

Change-Id: I77e4df7ab0bc20d2e251c1eda9ce9026484b8bbc
Reviewed-on: https://go-review.googlesource.com/17433
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoarchive/tar: properly format GNU base-256 encoding
Joe Tsai [Wed, 2 Dec 2015 23:48:06 +0000 (15:48 -0800)]
archive/tar: properly format GNU base-256 encoding

Motivation:
* Previous implementation silently failed when an integer overflow
occurred. Now, we report an ErrFieldTooLong.
* Previous implementation did not encode in two's complement format and was
unable to encode negative numbers.

The relevant GNU specification says:
<<<
GNU format uses two's-complement base-256 notation to store values
that do not fit into standard ustar range.
>>>

Fixes #12436

Change-Id: I09c20602eabf8ae3a7e0db35b79440a64bfaf807
Reviewed-on: https://go-review.googlesource.com/17425
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agosort: improve average quicksort performance
Russ Cox [Fri, 4 Dec 2015 20:03:20 +0000 (20:03 +0000)]
sort: improve average quicksort performance

Revert "Revert "sort: improve average quicksort performance""
This reverts commit 30b87bb9aa0c6658830f3d111920e2f366476644.

See https://golang.org/cl/15688 for the CL being replayed.

Change-Id: I2ba36334003f4971f95a10536adfdd86be9a50de
Reviewed-on: https://go-review.googlesource.com/17389
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agogo/ast: remove many blank lines in SortImports
Sokolov Yura [Fri, 4 Dec 2015 17:54:24 +0000 (20:54 +0300)]
go/ast: remove many blank lines in SortImports

Currently only one blank line is checked to be removed.
Changing sort.Sort may lead to more blank lines.
Let's remove them all.

It fixes a bug found by https://golang.org/cl/15688

Change-Id: I682cc23ecd7b10d9b6feb160da040a155297f578
Reviewed-on: https://go-review.googlesource.com/17440
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet/http: test max request body size against both HTTP/1 and HTTP/2
Burcu Dogan [Fri, 4 Dec 2015 19:12:39 +0000 (11:12 -0800)]
net/http: test max request body size against both HTTP/1 and HTTP/2

Change-Id: I009eaa52d03f1c3af33a6e884332f41c7cf48edd
Reviewed-on: https://go-review.googlesource.com/17427
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet/http: convert TestSetsRemoteAddr to use clientServerTest
Brad Fitzpatrick [Fri, 4 Dec 2015 01:43:10 +0000 (17:43 -0800)]
net/http: convert TestSetsRemoteAddr to use clientServerTest

This is an example of converting an old HTTP/1-only test to test
against both HTTP/1 and HTTP/2.

Please send more of these!

Also, for comparing the http.Transport's responses between HTTP/1 and
HTTP/2, see clientserver_test.go's h12Compare type and tests using
h12Compare. Sometimes that's the more appropriate option.

Change-Id: Iea24d844481efd5849173b60e15dcc561a32b88f
Reviewed-on: https://go-review.googlesource.com/17409
Reviewed-by: Burcu Dogan <jbd@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoRevert "sort: improve average quicksort performance"
Russ Cox [Fri, 4 Dec 2015 17:09:26 +0000 (17:09 +0000)]
Revert "sort: improve average quicksort performance"

Broke the build: http://build.golang.org/log/8159de7e0d6f3832da394c310975ddd4c4c74627
(cmd/gofmt TestRewrite)

This reverts commit 6f6b2f04b5c342edf70944e60c9c9a30eef5a9eb.

Change-Id: Ifd46b0b76c30b0a568521eaaf5ef8968a9549bf5
Reviewed-on: https://go-review.googlesource.com/17383
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoencoding/json: streamline, unexport valid Number checking
Russ Cox [Wed, 25 Nov 2015 16:34:41 +0000 (11:34 -0500)]
encoding/json: streamline, unexport valid Number checking

Followup to CL 12250.

For #10281.

Change-Id: If25d9cac92f10327bb355f2d11b00c625b464661
Reviewed-on: https://go-review.googlesource.com/17199
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet/mail: do not parse RFC 2047 tokens in quoted strings
Russ Cox [Thu, 3 Dec 2015 21:00:04 +0000 (16:00 -0500)]
net/mail: do not parse RFC 2047 tokens in quoted strings

RFC 2047 tokens like =?utf-8?B?whatever?= can only appear
unquoted, but this code was trying to decode them even when
they came out of quoted strings. Quoted strings must be left alone.

Fixes #11294.

Change-Id: I41b371f5b1611f1e56d93623888413d07d4ec878
Reviewed-on: https://go-review.googlesource.com/17381
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agosort: improve average quicksort performance
Sokolov Yura [Mon, 12 Oct 2015 13:06:38 +0000 (16:06 +0300)]
sort: improve average quicksort performance

- change way of protection from O(N^2) on duplicate values.
  Previous algorithm does additional comparisons and swaps
  on every split pass.
  Changed algorithm does one ordinal quicksort split pass,
  and if distribution is skewed, then additional pass to
  separate pivot's duplicates.
  Changed algorithm could be slower on very ununique slice,
  but it is still protected from O(N^2).

- increase small slice size and do simple shell sort pass
  to amortize worst case on small slices.
  Small slice has higher probability to have skewed
  distribution, so lets sort it with simpler algorithm.

benchmark                 old ns/op      new ns/op      delta
BenchmarkSortString1K     458374         388641         -15.21%
BenchmarkSortInt1K        217851         181796         -16.55%
BenchmarkSortInt64K       20539264       16730340       -18.54%
BenchmarkSort1e2          98668          95554          -3.16%
BenchmarkSort1e4          20278500       18316829       -9.67%
BenchmarkSort1e6          3215724392     2795999911     -13.05%

number of operations:
       Size:         Total:     Swap:     Less:
                          %         %         %
Sort     100  Avg    -5.98%   -18.43%    -1.90%
Sort     100  Max   -14.43%   -16.02%    -4.51%
Sort     300  Avg    -7.50%   -12.76%    -5.96%
Sort     300  Max   -11.29%    -9.60%    -4.30%
Sort    1000  Avg   -12.13%   -11.65%   -12.25%
Sort    1000  Max   -13.81%   -11.77%   -11.89%
Sort    3000  Avg   -14.61%    -9.30%   -15.86%
Sort    3000  Max   -15.81%    -8.66%   -15.19%
Sort   10000  Avg   -16.10%    -8.47%   -17.80%
Sort   10000  Max   -17.13%    -7.63%   -16.97%
Sort   30000  Avg   -17.46%    -7.56%   -19.57%
Sort   30000  Max   -18.24%    -7.62%   -17.68%
Sort  100000  Avg   -18.83%    -6.64%   -21.33%
Sort  100000  Max   -19.72%    -6.70%   -20.96%
Sort  300000  Avg   -19.61%    -6.16%   -22.30%
Sort  300000  Max   -20.69%    -6.15%   -21.81%
Sort 1000000  Avg   -20.42%    -5.58%   -23.31%
Sort 1000000  Max   -21.54%    -5.56%   -23.61%

Change-Id: I23868e8b52b5841b358cd5403967c9a97871e4d5
Reviewed-on: https://go-review.googlesource.com/15688
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet: fix parsing literal IPv6 address with zone identifier when using cgo
Mikio Hara [Fri, 27 Nov 2015 03:06:11 +0000 (12:06 +0900)]
net: fix parsing literal IPv6 address with zone identifier when using cgo

Parsing literal IPv6 address with zone identifier is already supported
when not using cgo. This change enables it when using cgo too.

Fixes #12241.

Change-Id: I3ed78c9e750e75eff0dae76ba8608df39503cf85
Reviewed-on: https://go-review.googlesource.com/17215
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agonet/mail: gofmt
Mikio Hara [Fri, 4 Dec 2015 01:58:13 +0000 (10:58 +0900)]
net/mail: gofmt

Change-Id: Ic704a2614e310bc7aa3bdee89a020c27f4292efa
Reviewed-on: https://go-review.googlesource.com/17410
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 agonet: return rooted DNS names on Plan 9
David du Colombier [Thu, 8 Oct 2015 20:33:38 +0000 (22:33 +0200)]
net: return rooted DNS names on Plan 9

This change returns rooted DNS names on Plan 9,
for consistency with other operating systems.

Updates #12193.

Change-Id: If983920c5b9a8f67d4ccb51bb295fac8dfb87e88
Reviewed-on: https://go-review.googlesource.com/15581
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
9 years agodoc: correct ordering of go1.5 minor revisions
Chris Broadfoot [Fri, 4 Dec 2015 00:47:22 +0000 (16:47 -0800)]
doc: correct ordering of go1.5 minor revisions

Fixes #13474

Change-Id: Ic86e54f6bc67db46504f7d43a0666647af308177
Reviewed-on: https://go-review.googlesource.com/17404
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoencoding/asn1: export tag and class constants
Brad Fitzpatrick [Tue, 1 Dec 2015 22:39:48 +0000 (22:39 +0000)]
encoding/asn1: export tag and class constants

Fixes #9236

Change-Id: I744d7f071e945ea6e6e50203d931f4678c8b545d
Reviewed-on: https://go-review.googlesource.com/17311
Reviewed-by: Adam Langley <agl@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet/http: deflake a non-short test, clean up export_test.go
Brad Fitzpatrick [Thu, 3 Dec 2015 18:32:15 +0000 (18:32 +0000)]
net/http: deflake a non-short test, clean up export_test.go

This makes TestTransportResponseCloseRace much faster and no longer
flaky.

In the process it also cleans up test hooks in net/http which were
inconsistent and scattered.

Change-Id: Ifd0b11dbc7e8915c24eb5bdc36731ed6751dd7ec
Reviewed-on: https://go-review.googlesource.com/17316
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

9 years agocmd/compile: fix live variable reuse in orderstmt
Matthew Dempsky [Thu, 3 Dec 2015 20:14:07 +0000 (12:14 -0800)]
cmd/compile: fix live variable reuse in orderstmt

The call "poptemp(t, order)" at line 906 should match up with the
assignment "t := marktemp(order)" at line 770, so use a new temporary
variable for stripping the ODCL nodes from a "case x := <-ch" node's
Ninit list.

Fixes #13469.
Passes toolstash/buildall.

Change-Id: Ia7eabd40c79cfdcb83df00b6fbd0954e0c44c5c7
Reviewed-on: https://go-review.googlesource.com/17393
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>

9 years agomisc/cgo/testsanitizers: check linux major/minor versions
Mohit Agarwal [Thu, 3 Dec 2015 19:11:44 +0000 (00:41 +0530)]
misc/cgo/testsanitizers: check linux major/minor versions

Fix a typo in de5b386; using `$ver` to determine linux major/minor
versions would produce those for clang, use `$linuxver` instead.

Updates #12898.

Change-Id: I2c8e84ad02749fceaa958afd65e558bb0b08dddb
Reviewed-on: https://go-review.googlesource.com/17323
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 agodoc: add note about cgo pointer passing rules to go1.6.txt
Ian Lance Taylor [Thu, 3 Dec 2015 21:20:49 +0000 (13:20 -0800)]
doc: add note about cgo pointer passing rules to go1.6.txt

Change-Id: I988d1b230ce516bf2997ec0932a854323b2bab7c
Reviewed-on: https://go-review.googlesource.com/17395
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agodebug/elf: transparently decompress compressed sections
Austin Clements [Wed, 2 Dec 2015 17:20:29 +0000 (12:20 -0500)]
debug/elf: transparently decompress compressed sections

This adds support for compressed ELF sections. This compression is
treated as a framing issue and hence the package APIs all
transparently decompress compressed sections. This requires some
subtlety for (*Section).Open, which returns an io.ReadSeeker: since
the decompressed data comes from an io.Reader, this commit introduces
a Reader-to-ReadSeeker adapter that is efficient for common uses of
Seek and does what it can otherwise.

Fixes #11773.

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

9 years agodwbug/elf: support old-style compressed DWARF
Austin Clements [Wed, 2 Dec 2015 03:55:28 +0000 (22:55 -0500)]
dwbug/elf: support old-style compressed DWARF

GCC and LLVM support zlib-compressing DWARF debug sections (and
there's some evidence that this may be happening by default in some
circumstances now).

Add support for reading compressed DWARF sections. Since ELF
relocations apply to the decompressed data, decompression is done
before applying relocations. Since relcations are applied by
debug/elf, decompression must also be handled there.

Note that this is different from compressed ELF sections, which is a
more general mechanism used by very recent versions of GCC.

Updates #11773.

Change-Id: I3f4bf1b04d0802cc1e8fcb7c2a5fcf6c467c5089
Reviewed-on: https://go-review.googlesource.com/17340
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocrypto/x509: introduce ErrInsecureAlgorithm for insecure algorithms
Russ Cox [Thu, 3 Dec 2015 19:36:45 +0000 (14:36 -0500)]
crypto/x509: introduce ErrInsecureAlgorithm for insecure algorithms

Until now we've used ErrUnknownAlgorithm but that's a bit confusing
when it is returned for obviously-known things like MD5.

Fixes #10431.

Change-Id: Ief8a8ef46e5b99bd4fd18e1acd7ae398a484bac3
Reviewed-on: https://go-review.googlesource.com/17380
Reviewed-by: Adam Langley <agl@golang.org>
9 years agonet/http: make Client follow redirects even if Request.Method is empty
Brad Fitzpatrick [Thu, 3 Dec 2015 18:58:05 +0000 (18:58 +0000)]
net/http: make Client follow redirects even if Request.Method is empty

Fixes #12705

Change-Id: I69639d2b03777835b2697ff349a00ccab410aa49
Reviewed-on: https://go-review.googlesource.com/17318
Reviewed-by: Burcu Dogan <jbd@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet: fix failing TestGoLookupIPOrderFallbackToFile
Benjamin Prosnitz [Wed, 2 Dec 2015 03:02:04 +0000 (11:02 +0800)]
net: fix failing TestGoLookupIPOrderFallbackToFile

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

9 years agodoc: remove shallow clone mention from go1.6.txt
Brad Fitzpatrick [Thu, 3 Dec 2015 18:47:37 +0000 (18:47 +0000)]
doc: remove shallow clone mention from go1.6.txt

It was reverted.

Change-Id: Ie30d8df9f2e5b14ff823fe81f5e538ee47064662
Reviewed-on: https://go-review.googlesource.com/17317
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoos: be more specific on what flags are used for
Volker Dobler [Thu, 3 Dec 2015 16:00:31 +0000 (17:00 +0100)]
os: be more specific on what flags are used for

The flags are used in OpenFile, not Open.

Change-Id: I45c1639e36694529cb29c2b580c43a22e6fd10ac
Reviewed-on: https://go-review.googlesource.com/17352
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoencoding/json: revise docs for Unmarshal into map, slice, array
Russ Cox [Wed, 25 Nov 2015 16:45:16 +0000 (11:45 -0500)]
encoding/json: revise docs for Unmarshal into map, slice, array

Fixes #12972.

Change-Id: Id0611667e6149753c351c0c5e01211340a87d3fd
Reviewed-on: https://go-review.googlesource.com/17230
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agomisc/cgo/testsanitizers: do not run with clang < 3.8 and Linux ≥ 4.1
Russ Cox [Mon, 30 Nov 2015 19:50:21 +0000 (14:50 -0500)]
misc/cgo/testsanitizers: do not run with clang < 3.8 and Linux ≥ 4.1

These are simply incompatible. Clang fixed the bug but not in older versions.

Fixes #12898.

Change-Id: I74a3fd9134dadab6d0f074f8fd09e00d64558d7a
Reviewed-on: https://go-review.googlesource.com/17254
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoencoding/xml: document new chardata tag
Russ Cox [Wed, 25 Nov 2015 17:06:06 +0000 (12:06 -0500)]
encoding/xml: document new chardata tag

Followup to CL 16047.
For #12963.

Change-Id: I596cd5109b25a4079b966427411860fde8b9b54a
Reviewed-on: https://go-review.googlesource.com/17232
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agoruntime: fix sanity check in stackBarrier
Austin Clements [Wed, 18 Nov 2015 21:48:22 +0000 (16:48 -0500)]
runtime: fix sanity check in stackBarrier

stackBarrier on amd64 sanity checks that it's unwinding the correct
entry in the stack barrier array. However, this check is wrong in two
ways that make it unlikely to catch anything, right or wrong:

1) It checks that savedLRPtr == SP, but, in fact, it should be that
   savedLRPtr+8 == SP because the RET that returned to stackBarrier
   popped the saved LR. However, we didn't notice this check was wrong
   because,

2) the sense of the conditional branch is also wrong.

Fix both of these.

Change-Id: I38ba1f652b0168b5b2c11b81637656241262af7c
Reviewed-on: https://go-review.googlesource.com/17039
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: note interactions between GC and MemProfile
Shenghou Ma [Thu, 12 Nov 2015 22:33:15 +0000 (17:33 -0500)]
runtime: note interactions between GC and MemProfile

Change-Id: Icce28fc4937cc73c0712c054161222f034381c2f
Reviewed-on: https://go-review.googlesource.com/16876
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
9 years agonet: return rooted DNS names on windows
Alex Brainman [Tue, 25 Aug 2015 07:01:49 +0000 (17:01 +1000)]
net: return rooted DNS names on windows

This CL also changes windows LookupSRV to return
_xmpp-server._tcp.google.com. as cname instead of google.com
similar to linux. Otherwise TestLookupDots still fails.

Updates #12193 (with plan9 still to do)

Change-Id: Id225e15bee95037cdb4226803506cce690c5d341
Reviewed-on: https://go-review.googlesource.com/13887
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoos: skip TestHardLink on Android.
Rahul Chaudhry [Thu, 3 Dec 2015 00:42:17 +0000 (16:42 -0800)]
os: skip TestHardLink on Android.

From Android release M (Marshmallow), hard linking files is blocked
and an attempt to call link() on a file will return EACCES.
- https://code.google.com/p/android-developer-preview/issues/detail?id=3150

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

9 years agodoc: correct release date for go1.5.2
Chris Broadfoot [Thu, 3 Dec 2015 00:22:53 +0000 (16:22 -0800)]
doc: correct release date for go1.5.2

Change-Id: I6bee207db7485f96a499f51b2d1346c35e086d41
Reviewed-on: https://go-review.googlesource.com/17337
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodoc: document go1.5.2
Chris Broadfoot [Tue, 24 Nov 2015 00:07:20 +0000 (16:07 -0800)]
doc: document go1.5.2

Change-Id: Ib6a9e131113523e6b1e5b7604480028b9ffbfa93
Reviewed-on: https://go-review.googlesource.com/17178
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agonet/mail: add test index to error messages in a recent test
Alexandre Cesaro [Wed, 2 Dec 2015 22:28:49 +0000 (23:28 +0100)]
net/mail: add test index to error messages in a recent test

Add the test index so it is easier to find which test case failed.

Change-Id: Ic04682651b26b137355950ff0c51bdbdb1d85a9c
Reviewed-on: https://go-review.googlesource.com/17351
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/go: allow buildmode=c-shared for android/arm64.
Rahul Chaudhry [Wed, 2 Dec 2015 21:27:44 +0000 (13:27 -0800)]
cmd/go: allow buildmode=c-shared for android/arm64.

Also, enable test misc/cgo/testcshared for android/arm64.
c/17245 and c/17246 provide the missing pieces for making
this test work.

"androidtest.bash" now passes on a Nexus 9 (volantis)
device running Android build "LMY48T".

Change-Id: Icb9fd2d17d97e0f04cb18d0cd91640c80fbd3fb4
Reviewed-on: https://go-review.googlesource.com/17333
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: set TLSG_IS_VARIABLE for android/arm64.
Rahul Chaudhry [Thu, 26 Nov 2015 01:35:44 +0000 (17:35 -0800)]
runtime: set TLSG_IS_VARIABLE for android/arm64.

On android, runtime.tls_g is a normal variable.
TLS offset is computed in x_cgo_inittls.

Change-Id: I18bc9a736d5fb2a89d0f798956c754e3c10d10e2
Reviewed-on: https://go-review.googlesource.com/17246
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agoruntime/cgo: define x_cgo_inittls() for android/arm64.
Rahul Chaudhry [Thu, 26 Nov 2015 01:31:57 +0000 (17:31 -0800)]
runtime/cgo: define x_cgo_inittls() for android/arm64.

On android, runtime.tls_g is a normal variable.
TLS offset is computed in x_cgo_inittls.

Change-Id: I64cfd3543040776dcdf73cad8dba54fc6aaf6f35
Reviewed-on: https://go-review.googlesource.com/17245
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agocmd/internal/obj: fix stack barriers in ppc64le shared libs
Michael Hudson-Doyle [Tue, 1 Dec 2015 02:39:41 +0000 (15:39 +1300)]
cmd/internal/obj: fix stack barriers in ppc64le shared libs

runtime.stackBarrier is a strange function: it is only ever "called" by
smashing its address into a LR slot on the stack. Calling it like this
certainly does not adhere to the rule that r12 is set to the global entry point
before calling it and the prologue instrutions that compute r2 from r12 in fact
just corrupt r2, which is bad because the function that stackBarrier returns to
probably uses r2 to access global data.

Fortunately stackBarrier itself does not access any global data and so does not
depend on the value of r2, meaning we can ignore the ABI rules and simply skip
inserting the prologue instructions into this specific function.

Fixes 64bit.go, append.go and fixedbugs/issue13169.go from "cd test; go run
run.go -linkshared".

Change-Id: I606864133a83935899398e2d42edd08a946aab24
Reviewed-on: https://go-review.googlesource.com/17281
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/cgo: error, not panic, if not enough arguments to function
Ian Lance Taylor [Wed, 2 Dec 2015 20:07:57 +0000 (12:07 -0800)]
cmd/cgo: error, not panic, if not enough arguments to function

Fixes #13423.

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

9 years agocmd/compile: don't allow blank method declarations on builtins
Håvard Haugen [Sun, 15 Nov 2015 22:32:30 +0000 (23:32 +0100)]
cmd/compile: don't allow blank method declarations on builtins

Move test for isblank into addmethod so that most of the type checking
for methods is also performed for blank methods.

Fixes #11366.

Change-Id: I13d554723bf96d906d0b3ff390d7b7c87c1a5020
Reviewed-on: https://go-review.googlesource.com/16866
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agodatabase/sql: Add DB.SetConnMaxLifetime
INADA Naoki [Tue, 3 Mar 2015 12:27:07 +0000 (21:27 +0900)]
database/sql: Add DB.SetConnMaxLifetime

Long lived connections may make some DB operation difficult.
(e.g. retiring load balanced DB server.)
So SetConnMaxLifetime closes long lived connections.

It can be used to limit maximum idle time, too.
Closing idle connections reduces active connections while application is idle
and avoids connections are closed by server side (cause errBadConn while querying).

fixes #9851

Change-Id: I2e8e824219c1bee7f4b885d38ed96d11b7202b56
Reviewed-on: https://go-review.googlesource.com/6580
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/mail: use base64 encoding when needed in Address.String()
Alexandre Cesaro [Tue, 20 Oct 2015 15:30:21 +0000 (17:30 +0200)]
net/mail: use base64 encoding when needed in Address.String()

When the name of an Address contains non-ASCII characters,
Address.String() used mime.QEncoding to encode the name.

However certain characters are forbidden when an encoded-word is
in a phrase context (see RFC 2047 section 5.3) and these
characters are not encoded by mime.QEncoding.

In this case we now use mime.BEncoding (base64 encoding) so that
forbidden characters are also encoded.

Fixes #11292

Change-Id: I52db98b41ece439295e97d7e94c8190426f499c2
Reviewed-on: https://go-review.googlesource.com/16012
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/go: fix reading PT_NOTE segment with multiple notes
Ian Lance Taylor [Wed, 2 Dec 2015 05:16:29 +0000 (21:16 -0800)]
cmd/go: fix reading PT_NOTE segment with multiple notes

The old code was assuming that a PT_NOTE segment never had more than one
note, but there is no such requirement.

Fixes #13364.

Change-Id: I3f6b3716130bf7af6abe81b8e10571a8c7cd943c
Reviewed-on: https://go-review.googlesource.com/17331
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocompress/bzip2/testdata: make Mark.Twain-Tom.Sawyer.txt free
Joe Tsai [Mon, 30 Nov 2015 22:43:33 +0000 (14:43 -0800)]
compress/bzip2/testdata: make Mark.Twain-Tom.Sawyer.txt free

Commit 7a1fb95d50b7a8302445ebc1296010695151ce7b strips non-free license
from Mark.Twain-Tom.Sawyer.txt, but forgot to remove it from the compressed
version of the file.

Update #13216

Change-Id: I60f53275d56ba5baa6898db47b1d41f85e985c00
Reviewed-on: https://go-review.googlesource.com/17264
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoarchive/tar: convert Reader.Next to be loop based
Joe Tsai [Wed, 16 Sep 2015 07:58:56 +0000 (00:58 -0700)]
archive/tar: convert Reader.Next to be loop based

Motivation for change:
* Recursive logic is hard to follow, since it tends to apply
things in reverse. On the other hand, the tar formats tend to
describe meta headers as affecting the next entry.
* Recursion also applies changes in the wrong order. Two test
files are attached that use multiple headers. The previous Go
behavior differs from what GNU and BSD tar do.

Change-Id: Ic1557256fc1363c5cb26570e5d0b9f65a9e57341
Reviewed-on: https://go-review.googlesource.com/14624
Run-TryBot: Joe Tsai <joetsai@digital-static.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http: enable HTTP/2 on all Transports, not just the DefaultTransport
Brad Fitzpatrick [Tue, 1 Dec 2015 19:19:55 +0000 (19:19 +0000)]
net/http: enable HTTP/2 on all Transports, not just the DefaultTransport

This mirrors the same behavior and API from the server code to the
client side: if TLSNextProto is nil, HTTP/2 is on by default for
both. If it's non-nil, the user was trying to do something fancy and
step out of their way.

Updates #6891

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

9 years agotime: fix handling of -07, handle Z07
Ian Lance Taylor [Mon, 30 Nov 2015 17:21:34 +0000 (09:21 -0800)]
time: fix handling of -07, handle Z07

The existing code has partial support for -07 (just the hours of a time
zone offset).  Complete the support, add support for Z07, and add a few
tests.

Fixes #13426.

Change-Id: Ic6377bbf3e65b4bb761b9779f7e80c07ce4f57e8
Reviewed-on: https://go-review.googlesource.com/17260
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoarchive/tar: move parse/format methods to standalone receiver
Joe Tsai [Mon, 28 Sep 2015 20:49:35 +0000 (13:49 -0700)]
archive/tar: move parse/format methods to standalone receiver

Motivations for this change:
* It allows these functions to be used outside of Reader/Writer.
* It allows these functions to be more easily unit tested.

Change-Id: Iebe2b70bdb8744371c9ffa87c24316cbbf025b59
Reviewed-on: https://go-review.googlesource.com/15113
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Joe Tsai <joetsai@digital-static.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/mail: better errors on non-ascii characters
Ingo Oeser [Fri, 4 Sep 2015 16:22:56 +0000 (18:22 +0200)]
net/mail: better errors on non-ascii characters

Fixes #12492

Change-Id: I8bb512027639301e2f2c41aab84e6d06ae88b137
Reviewed-on: https://go-review.googlesource.com/14312
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet: fall back to hosts file if DNS lookup fails, despite order
Benjamin Prosnitz [Mon, 30 Nov 2015 05:08:46 +0000 (13:08 +0800)]
net: fall back to hosts file if DNS lookup fails, despite order

Fixes #13090

Change-Id: I5612d792dabdff89bd0cec57dc2cacf9be7ebf64
Reviewed-on: https://go-review.googlesource.com/16341
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoencoding/base64: add package-level example
Russ Cox [Wed, 25 Nov 2015 16:58:06 +0000 (11:58 -0500)]
encoding/base64: add package-level example

Fixes #13011.

Change-Id: Ia4c67880fca83f4298ff6bb1b217ec26c8c83427
Reviewed-on: https://go-review.googlesource.com/17231
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

9 years agoregexp/syntax: fix handling of \Q...\E
Russ Cox [Wed, 25 Nov 2015 17:32:34 +0000 (12:32 -0500)]
regexp/syntax: fix handling of \Q...\E

It's not a group: must handle the inside as a sequence of literal chars,
not a single literal string.

That is, \Qab\E+ is the same as ab+, not (ab)+.

Fixes #11187.

Change-Id: I5406d05ccf7efff3a7f15395bdb0cfb2bd23a8ed
Reviewed-on: https://go-review.googlesource.com/17233
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet/http/httputil: add package level examples
Carlos Cirello [Tue, 1 Dec 2015 18:17:49 +0000 (19:17 +0100)]
net/http/httputil: add package level examples

Change-Id: I5be18b68602a7ebb740cf05924236ce17e386e55
Reviewed-on: https://go-review.googlesource.com/17295
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agotesting: document that T and B are safe for concurrent calls
Russ Cox [Wed, 25 Nov 2015 21:15:45 +0000 (16:15 -0500)]
testing: document that T and B are safe for concurrent calls

Fixes #13108.

Change-Id: I474cc2a3b7ced1c9eb978fc815f9c6bae9fb3ecc
Reviewed-on: https://go-review.googlesource.com/17235
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet/http: retry idempotent HTTP reqs on dead reused conns
Blake Gentry [Thu, 22 Jan 2015 23:58:25 +0000 (15:58 -0800)]
net/http: retry idempotent HTTP reqs on dead reused conns

If we try to reuse a connection that the server is in the process of
closing, we may end up successfully writing out our request (or a
portion of our request) only to find a connection error when we try to
read from (or finish writing to) the socket. This manifests as an EOF
returned from the Transport's RoundTrip.

The issue, among others, is described in #4677.

This change follows some of the Chromium guidelines for retrying
idempotent requests only when the connection has been already been used
successfully and no header data has yet been received for the response.

As part of this change, an unexported error was defined for
errMissingHost, which was previously defined inline. errMissingHost is
the only non-network error returned from a Request's Write() method.

Additionally, this breaks TestLinuxSendfile because its test server
explicitly triggers the type of scenario this change is meant to retry
on. Because that test server stops accepting conns on the test listener
before the retry, the test would time out. To fix this, the test was
altered to use a non-idempotent test type (POST).

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

9 years agoencoding/asn1: Reject invalid INTEGERs.
David Benjamin [Wed, 18 Nov 2015 04:24:36 +0000 (23:24 -0500)]
encoding/asn1: Reject invalid INTEGERs.

The empty string is not a valid DER integer. DER also requires that values be
minimally-encoded, so excess padding with leading 0s (0xff for negative
numbers) is forbidden. (These rules also apply to BER, incidentally.)

Fixes #12622.

Change-Id: I041f94e34a8afa29dbf94dd8fc450944bc91c9c3
Reviewed-on: https://go-review.googlesource.com/17008
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoarchive/tar: fix issues with readGNUSparseMap1x0
Joe Tsai [Thu, 1 Oct 2015 08:35:15 +0000 (01:35 -0700)]
archive/tar: fix issues with readGNUSparseMap1x0

Motivations:
* Use of strconv.ParseInt does not properly treat integers as 64bit,
preventing this function from working properly on 32bit machines.
* Use of io.ReadFull does not properly detect truncated streams
when the file suddenly ends on a block boundary.
* The function blindly trusts user input for numEntries and allocates
memory accordingly.
* The function does not validate that numEntries is not negative,
allowing a malicious sparse file to cause a panic during make.

In general, this function was overly complicated for what it was
accomplishing and it was hard to reason that it was free from
bounds errors. Instead, it has been rewritten and relies on
bytes.Buffer.ReadString to do the main work. So long as invariants
about the number of '\n' in the buffer are maintained, it is much
easier to see why this approach is correct.

Change-Id: Ibb12c4126c26e0ea460ea063cd17af68e3cf609e
Reviewed-on: https://go-review.googlesource.com/15174
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>