]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
8 years agoreadme: emphasize issue tracker is for bugs/proposals
Robert Griesemer [Fri, 2 Oct 2015 17:55:27 +0000 (10:55 -0700)]
readme: emphasize issue tracker is for bugs/proposals

Removed direct link to issue tracker in the README - it makes it too
easy to use it for a question - and it's abused multiple times a day
for questions. It's easy enough to find it if there's a real issue
to report.

Added sentence to point people at golang-nuts and the new forum.

Change-Id: If75bab888cda064aceeefc49ef672fbb964f8f54
Reviewed-on: https://go-review.googlesource.com/15284
Reviewed-by: Jason Buberel <jbuberel@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agodatabase/sql: fix case where Stmt.Close discards error
Ian Gudger [Thu, 1 Oct 2015 10:29:27 +0000 (03:29 -0700)]
database/sql: fix case where Stmt.Close discards error

Fixes a case where the Stmt.Close() function in database/sql discards any error generated by the Close() function of the contained driverStmt.

Fixes #12798

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

8 years agomisc/cgo/testsanitizers: skip test for version of clang before 3.6
Ian Lance Taylor [Fri, 2 Oct 2015 14:04:34 +0000 (07:04 -0700)]
misc/cgo/testsanitizers: skip test for version of clang before 3.6

I've tested with clang 3.6.  The builder is running 3.5, and fails.

Fixes #12814.

Change-Id: I087fb75c3a24bed7f7fa5e9d7a1444590a316d63
Reviewed-on: https://go-review.googlesource.com/15259
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoruntime: darwin/386 entrypoint for c-archive
David Crawshaw [Mon, 20 Jul 2015 16:33:39 +0000 (12:33 -0400)]
runtime: darwin/386 entrypoint for c-archive

Change-Id: Ic22597b5e2824cffe9598cb9b506af3426c285fd
Reviewed-on: https://go-review.googlesource.com/12412
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoruntime: adjust the ppc64x memmove and memclr to copy by word as much as it can
Michael Hudson-Doyle [Tue, 22 Sep 2015 10:35:52 +0000 (22:35 +1200)]
runtime: adjust the ppc64x memmove and memclr to copy by word as much as it can

Issue #12552 can happen on ppc64 too, although much less frequently in my
testing. I'm fairly sure this fixes it (2 out of 200 runs of oracle.test failed
without this change and 0 of 200 failed with it). It's also a lot faster for
large moves/clears:

name           old speed      new speed       delta
Memmove1-6      157MB/s ± 9%    144MB/s ± 0%    -8.20%         (p=0.004 n=10+9)
Memmove2-6      281MB/s ± 1%    249MB/s ± 1%   -11.53%        (p=0.000 n=10+10)
Memmove3-6      376MB/s ± 1%    328MB/s ± 1%   -12.64%        (p=0.000 n=10+10)
Memmove4-6      475MB/s ± 4%    345MB/s ± 1%   -27.28%         (p=0.000 n=10+8)
Memmove5-6      540MB/s ± 1%    393MB/s ± 0%   -27.21%        (p=0.000 n=10+10)
Memmove6-6      609MB/s ± 0%    423MB/s ± 0%   -30.56%         (p=0.000 n=9+10)
Memmove7-6      659MB/s ± 0%    468MB/s ± 0%   -28.99%         (p=0.000 n=8+10)
Memmove8-6      705MB/s ± 0%   1295MB/s ± 1%   +83.73%          (p=0.000 n=9+9)
Memmove9-6      740MB/s ± 1%   1241MB/s ± 1%   +67.61%         (p=0.000 n=10+8)
Memmove10-6     780MB/s ± 0%   1162MB/s ± 1%   +48.95%         (p=0.000 n=10+9)
Memmove11-6     811MB/s ± 0%   1180MB/s ± 0%   +45.58%          (p=0.000 n=8+9)
Memmove12-6     820MB/s ± 1%   1073MB/s ± 1%   +30.83%         (p=0.000 n=10+9)
Memmove13-6     849MB/s ± 0%   1068MB/s ± 1%   +25.87%        (p=0.000 n=10+10)
Memmove14-6     877MB/s ± 0%    911MB/s ± 0%    +3.83%        (p=0.000 n=10+10)
Memmove15-6     893MB/s ± 0%    922MB/s ± 0%    +3.25%         (p=0.000 n=10+9)
Memmove16-6     897MB/s ± 1%   2418MB/s ± 1%  +169.67%         (p=0.000 n=10+9)
Memmove32-6     908MB/s ± 0%   3927MB/s ± 2%  +332.64%         (p=0.000 n=10+8)
Memmove64-6    1.11GB/s ± 0%   5.59GB/s ± 0%  +404.64%          (p=0.000 n=9+9)
Memmove128-6   1.25GB/s ± 0%   6.71GB/s ± 2%  +437.49%         (p=0.000 n=9+10)
Memmove256-6   1.33GB/s ± 0%   7.25GB/s ± 1%  +445.06%        (p=0.000 n=10+10)
Memmove512-6   1.38GB/s ± 0%   8.87GB/s ± 0%  +544.43%        (p=0.000 n=10+10)
Memmove1024-6  1.40GB/s ± 0%  10.00GB/s ± 0%  +613.80%        (p=0.000 n=10+10)
Memmove2048-6  1.41GB/s ± 0%  10.65GB/s ± 0%  +652.95%         (p=0.000 n=9+10)
Memmove4096-6  1.42GB/s ± 0%  11.01GB/s ± 0%  +675.37%         (p=0.000 n=8+10)
Memclr5-6       269MB/s ± 1%    264MB/s ± 0%    -1.80%        (p=0.000 n=10+10)
Memclr16-6      600MB/s ± 0%    887MB/s ± 1%   +47.83%        (p=0.000 n=10+10)
Memclr64-6     1.06GB/s ± 0%   2.91GB/s ± 1%  +174.58%         (p=0.000 n=8+10)
Memclr256-6    1.32GB/s ± 0%   6.58GB/s ± 0%  +399.86%         (p=0.000 n=9+10)
Memclr4096-6   1.42GB/s ± 0%  10.90GB/s ± 0%  +668.03%         (p=0.000 n=8+10)
Memclr65536-6  1.43GB/s ± 0%  11.37GB/s ± 0%  +697.83%          (p=0.000 n=9+8)
GoMemclr5-6     359MB/s ± 0%    360MB/s ± 0%    +0.46%        (p=0.000 n=10+10)
GoMemclr16-6    750MB/s ± 0%   1264MB/s ± 1%   +68.45%        (p=0.000 n=10+10)
GoMemclr64-6   1.17GB/s ± 0%   3.78GB/s ± 1%  +223.58%         (p=0.000 n=10+9)
GoMemclr256-6  1.35GB/s ± 0%   7.47GB/s ± 0%  +452.44%        (p=0.000 n=10+10)

Update #12552

Change-Id: I7192e9deb9684a843aed37f58a16a4e29970e893
Reviewed-on: https://go-review.googlesource.com/14840
Reviewed-by: Minux Ma <minux@golang.org>
8 years agoruntime: drop sigfwd from signal forwarding unsupported platforms
Mikio Hara [Sun, 12 Jul 2015 00:23:37 +0000 (09:23 +0900)]
runtime: drop sigfwd from signal forwarding unsupported platforms

This change splits signal_unix.go into signal_unix.go and
signal2_unix.go and removes the fake symbol sigfwd from signal
forwarding unsupported platforms for clarification purpose.

Change-Id: I205eab5cf1930fda8a68659b35cfa9f3a0e67ca6
Reviewed-on: https://go-review.googlesource.com/12062
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoarchive/tar: make Reader.Read errors persistent
Joe Tsai [Thu, 1 Oct 2015 10:08:18 +0000 (03:08 -0700)]
archive/tar: make Reader.Read errors persistent

If the stream is in an inconsistent state, it does not make sense
that Reader.Read can be called and possibly succeed.

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

8 years agonet: make /etc/hosts lookups case-insensitive
Burcu Dogan [Thu, 1 Oct 2015 19:01:50 +0000 (15:01 -0400)]
net: make /etc/hosts lookups case-insensitive

The native Go host resolver was behaving differently than libc
and the entries in the /etc/hosts were handled in a case sensitive
way. In order to be compatible with libc's resolver, /etc/hosts
lookups must be case-insensitive.

Fixes #12806.

Change-Id: I3c14001abffadf7458fd1a027c91e6438a87f285
Reviewed-on: https://go-review.googlesource.com/15321
Run-TryBot: Burcu Dogan <jbd@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agogo/types: fix incorrect comment at Info.Implicits.
Alan Donovan [Thu, 1 Oct 2015 19:06:20 +0000 (15:06 -0400)]
go/types: fix incorrect comment at Info.Implicits.

Change-Id: Ibd24e1567cb03f7f00f3cbe381bedd6c5215af35
Reviewed-on: https://go-review.googlesource.com/15320
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
8 years agocmd/compile: repair escape analysis of range &fixedArray
David Chase [Mon, 28 Sep 2015 20:13:57 +0000 (16:13 -0400)]
cmd/compile: repair escape analysis of range &fixedArray

The existing test did not take into account the implicit
dereference of &fixedArray and thus heap-escaped when it
was not necessary.

Also added a detailed test for this and related cases.

Fixes #12588

Change-Id: I951e9684a093082ccdca47710f69f4366bd6b3cf
Reviewed-on: https://go-review.googlesource.com/15130
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
8 years agoruntime/trace: reduce memory usage for trace stress tests on openbsd/arm
Joel Sing [Thu, 1 Oct 2015 12:34:48 +0000 (22:34 +1000)]
runtime/trace: reduce memory usage for trace stress tests on openbsd/arm

Reduce allocation to avoid running out of memory on the openbsd/arm builder,
until issue/12032 is resolved.

Update issue #12032

Change-Id: Ibd513829ffdbd0db6cd86a0a5409934336131156
Reviewed-on: https://go-review.googlesource.com/15242
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
8 years agoruntime: handle sysReserve failure in mHeap_SysAlloc
Joel Sing [Sat, 26 Sep 2015 17:56:05 +0000 (03:56 +1000)]
runtime: handle sysReserve failure in mHeap_SysAlloc

sysReserve will return nil on failure - correctly handle this case and return
nil to the caller. Currently, a failure will result in h.arena_end being set
to psize, h.arena_used being set to zero and fun times ensue.

On the openbsd/arm builder this has resulted in:

  runtime: address space conflict: map(0x0) = 0x40946000
  fatal error: runtime: address space conflict

When it should be reporting out of memory instead.

Change-Id: Iba828d5ee48ee1946de75eba409e0cfb04f089d4
Reviewed-on: https://go-review.googlesource.com/15056
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
8 years agoruntime: update comment to match function name
Jeremy Schlatter [Thu, 1 Oct 2015 07:55:51 +0000 (07:55 +0000)]
runtime: update comment to match function name

Change-Id: I8f22434ade576cc7e3e6d9f357bba12c1296e3d1
Reviewed-on: https://go-review.googlesource.com/15250
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agotext/template: change IsTrue to take interface{} instead of reflect.Value.
David Symonds [Thu, 1 Oct 2015 04:21:37 +0000 (14:21 +1000)]
text/template: change IsTrue to take interface{} instead of reflect.Value.

This is a follow-up to a326c3e to avoid reflect being in the API.

Fixes #12801.

Change-Id: Ic4c2e592e2c35b5911f75d88f1d9c44787c80f30
Reviewed-on: https://go-review.googlesource.com/15240
Run-TryBot: David Symonds <dsymonds@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agoarchive/tar: fix bugs with sparseFileReader
Joe Tsai [Mon, 28 Sep 2015 23:38:16 +0000 (16:38 -0700)]
archive/tar: fix bugs with sparseFileReader

The sparseFileReader is prone to two different forms of
denial-of-service attacks:
* A malicious tar file can cause an infinite loop
* A malicious tar file can cause arbitrary panics

This results because of poor error checking/handling, which this
CL fixes. While we are at it, add a plethora of unit tests to
test for possible malicious inputs.

Change-Id: I2f9446539d189f3c1738a1608b0ad4859c1be929
Reviewed-on: https://go-review.googlesource.com/15115
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocompress/zlib: detect truncated streams
Joe Tsai [Tue, 22 Sep 2015 08:17:01 +0000 (01:17 -0700)]
compress/zlib: detect truncated streams

Reader failed to detect truncated streams since calls to
io.ReadFull did not check if the error is io.EOF.

Change-Id: I86c497519daaaccefc6eb5617ddcd8fd3b99f51b
Reviewed-on: https://go-review.googlesource.com/14835
Reviewed-by: Nigel Tao <nigeltao@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoruntime, runtime/cgo: support using msan on cgo code
Ian Lance Taylor [Wed, 30 Sep 2015 04:24:13 +0000 (21:24 -0700)]
runtime, runtime/cgo: support using msan on cgo code

The memory sanitizer (msan) is a nice compiler feature that can
dynamically check for memory errors in C code.  It's not useful for Go
code, since Go is memory safe.  But it is useful to be able to use the
memory sanitizer on C code that is linked into a Go program via cgo.
Without this change it does not work, as msan considers memory passed
from Go to C as uninitialized.

To make this work, change the runtime to call the C mmap function when
using cgo.  When using msan the mmap call will be intercepted and marked
as returning initialized memory.

Work around what appears to be an msan bug by calling malloc before we
call mmap.

Change-Id: I8ab7286d7595ae84782f68a98bef6d3688b946f9
Reviewed-on: https://go-review.googlesource.com/15170
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
8 years agoencoding/binary: document that Read returns io.EOF iff zero bytes are read
Joe Tsai [Wed, 30 Sep 2015 20:35:03 +0000 (13:35 -0700)]
encoding/binary: document that Read returns io.EOF iff zero bytes are read

Also add a unit test to lock this behavior into the API.

Fixes #12016

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

8 years agoruntime: test that periodic GC works
Austin Clements [Wed, 5 Aug 2015 15:35:28 +0000 (11:35 -0400)]
runtime: test that periodic GC works

We've broken periodic GC a few times without noticing because there's
no test for it, partly because you have to wait two minutes to see if
it happens. This exposes control of the periodic GC timeout to runtime
tests and adds a test that cranks it down to zero and sleeps for a bit
to make sure periodic GCs happen.

Change-Id: I3ec44e967e99f4eda752f85c329eebd18b87709e
Reviewed-on: https://go-review.googlesource.com/13169
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>

8 years agogo/format: handle whitespace-only input correctly
Robert Griesemer [Wed, 30 Sep 2015 00:34:32 +0000 (17:34 -0700)]
go/format: handle whitespace-only input correctly

Applied identical change to cmd/gofmt/internal.go.

Fixes #11275.

Change-Id: Icb4bf0460c94c9e2830dd0d62c69376774cbda30
Reviewed-on: https://go-review.googlesource.com/15154
Reviewed-by: Alan Donovan <adonovan@google.com>
8 years agogo/format, cmd/gofmt: avoid dependency on internal package format
Robert Griesemer [Mon, 28 Sep 2015 21:42:21 +0000 (14:42 -0700)]
go/format, cmd/gofmt: avoid dependency on internal package format

Fixes #11844.

Change-Id: I32edd39e79f7c9bdc132c49bd06081f35dac245d
Reviewed-on: https://go-review.googlesource.com/15114
Reviewed-by: Alan Donovan <adonovan@google.com>
8 years agocrypto/x509: parse CSRs with a critical flag in the requested extensions.
Adam Langley [Mon, 27 Jul 2015 23:54:30 +0000 (16:54 -0700)]
crypto/x509: parse CSRs with a critical flag in the requested extensions.

The format for a CSR is horribly underspecified and we had a mistake.
The code was parsing the attributes from the CSR as a
pkix.AttributeTypeAndValueSET, which is only almost correct: it works so
long as the requested extensions don't contain the optional “critical”
flag.

Unfortunately this mistake is exported somewhat in the API and the
Attributes field of a CSR actually has the wrong type. I've moved this
field to the bottom of the structure and updated the comment to reflect
this.

The Extensions and other fields of the CSR structure can be saved
however and this change does that.

Fixes #11897.

Change-Id: If8e2f5c21934800b72b041e38691efc3e897ecf1
Reviewed-on: https://go-review.googlesource.com/12717
Reviewed-by: Rob Pike <r@golang.org>
8 years agocrypto/x509: make verification of an empty certificate consistent across platforms.
Adam Langley [Sun, 30 Aug 2015 16:45:26 +0000 (09:45 -0700)]
crypto/x509: make verification of an empty certificate consistent across platforms.

Platform-specific verification needs the ASN.1 contents of a certificate
but that might not be provided if the Certificate was not created by
ParseCertificate. In order to avoid a panic on Windows, and to make
behaviour consistent across platforms, this change causes verification
to fail when the ASN.1 contents of a certificate are not available.

Fixes #12184

Change-Id: I4395d74934e675c179eaf4cded1094a756e478bb
Reviewed-on: https://go-review.googlesource.com/14053
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agomath/big: correct documentation for ProbablyPrime.
Adam Langley [Sun, 30 Aug 2015 16:21:35 +0000 (09:21 -0700)]
math/big: correct documentation for ProbablyPrime.

As akalin points out in the bug, the comment previously claimed that the
probability that the input is prime given that the function returned
true is 1 - ¼ⁿ. But that's wrong: the correct statement is that the
probability of the function returning false given a composite input is
1 - ¼ⁿ.

This is not nearly as helpful, but at least it's truthful. A number of
other (correct) expressions are suggested on the bug, but I think that
the simplier one is preferable.

This change also notes that the function is not suitable for
adversarial inputs since it's deterministic.

Fixes #12274.

Change-Id: I6a0871d103b126ee5a5a922a8c6993055cb7b1ed
Reviewed-on: https://go-review.googlesource.com/14052
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocrypto/tls: better error messages when PEM inputs are switched.
Adam Langley [Sun, 30 Aug 2015 17:23:30 +0000 (10:23 -0700)]
crypto/tls: better error messages when PEM inputs are switched.

This change causes the types of skipped PEM blocks to be recorded when
no certificate or private-key data is found in a PEM input. This allows
for better error messages to be return in the case of common errors like
switching the certifiate and key inputs to X509KeyPair.

Fixes #11092

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

8 years agogo/types: move gotype command into this directory
Robert Griesemer [Tue, 29 Sep 2015 22:34:29 +0000 (15:34 -0700)]
go/types: move gotype command into this directory

This is a copy of x/tools/cmd/gotype/gotype.go with the corresponding
x/tools/cmd/gotype/doc.go prepended and including a build tag (ignore).

This way, go/types can be built unaffected. If we need the gotype command,
it is trivially built in the go/types directory with: go build gotype.go .

Fixes #12303.

Change-Id: I2d792fcb39719cc5cc300f657e4735901cd20faa
Reviewed-on: https://go-review.googlesource.com/15152
Reviewed-by: Rob Pike <r@golang.org>
8 years agogo/types: clarify doc string for types.Check
Robert Griesemer [Tue, 29 Sep 2015 20:17:39 +0000 (13:17 -0700)]
go/types: clarify doc string for types.Check

For #12787.

Change-Id: I921d01c8d7d97f3453b25e6d2241a43c5d64f53b
Reviewed-on: https://go-review.googlesource.com/15150
Reviewed-by: Alan Donovan <adonovan@google.com>
8 years agocmd/dist: build packages in parallel, make code more Go-like
Russ Cox [Fri, 28 Aug 2015 21:08:51 +0000 (17:08 -0400)]
cmd/dist: build packages in parallel, make code more Go-like

(Changed modified by bradfitz from original rsc version)

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

8 years agocmd/compile/internal/gc: remove stringsCompare
Håvard Haugen [Wed, 23 Sep 2015 21:31:17 +0000 (23:31 +0200)]
cmd/compile/internal/gc: remove stringsCompare

Inlined the last occurrence of stringsCompare into exprcmp.

Passes go build -a -toolexec 'toolstash -cmp' std cmd.

Change-Id: I8fd99e3fbffc84283cc269368595cba950533066
Reviewed-on: https://go-review.googlesource.com/14872
Reviewed-by: Dave Cheney <dave@cheney.net>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocmd/doc: fix pretty printing of paths
Rob Pike [Mon, 28 Sep 2015 20:45:57 +0000 (13:45 -0700)]
cmd/doc: fix pretty printing of paths

The code to strip GOROOT and GOPATH had a bug: it assumed there
were bytes after the GOROOT prefix but there might not be.
Fix this and other issues by taking care the prefix is really a
file name prefix for the path, not just a string prefix, and
handle the case where GOROOT==path.

Change-Id: I8066865fd05f938bb6dbf3bb8ab1fc58e5cf6bb5
Reviewed-on: https://go-review.googlesource.com/15112
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agomath/big: more documentation
Robert Griesemer [Mon, 28 Sep 2015 20:39:04 +0000 (13:39 -0700)]
math/big: more documentation

Good enough for now.

Fixes #11241.

Change-Id: Ieb50809f104d20bcbe14daecac503f72486bec92
Reviewed-on: https://go-review.googlesource.com/15111
Reviewed-by: Alan Donovan <adonovan@google.com>
8 years agomath/big: clean up *Int encoding tests
Robert Griesemer [Mon, 28 Sep 2015 18:31:53 +0000 (11:31 -0700)]
math/big: clean up *Int encoding tests

- more uniform naming
- test sign more deliberately
- remove superfluous test (JSON encoder always uses the JSON marshaler if present)

Change-Id: I37b1e367c01fc8bae1e06adbdb72dd366c08d5ce
Reviewed-on: https://go-review.googlesource.com/15110
Reviewed-by: Alan Donovan <adonovan@google.com>
8 years agomath/big: implement Float.Text(Un)Marshaler
Robert Griesemer [Fri, 25 Sep 2015 23:35:54 +0000 (16:35 -0700)]
math/big: implement Float.Text(Un)Marshaler

Fixes #12256.

Change-Id: Ie4a3337996da5c060b27530b076048ffead85f3b
Reviewed-on: https://go-review.googlesource.com/15040
Reviewed-by: Alan Donovan <adonovan@google.com>
8 years agotext/template, html/template: fix block example name
Andrew Gerrand [Tue, 29 Sep 2015 00:16:09 +0000 (10:16 +1000)]
text/template, html/template: fix block example name

Change-Id: I004a43842430201296363a9745480bee94920041
Reviewed-on: https://go-review.googlesource.com/15084
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agodoc: add text/template blocks and redefinition to go1.6.txt
Andrew Gerrand [Mon, 28 Sep 2015 22:43:07 +0000 (08:43 +1000)]
doc: add text/template blocks and redefinition to go1.6.txt

Change-Id: Ide82ac98dc7cb1035ceb9d461ed95af899f8f983
Reviewed-on: https://go-review.googlesource.com/15081
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agoencoding/json: document that encoding.TextMarshaler is used if no (json) Marshaler...
Robert Griesemer [Mon, 28 Sep 2015 17:47:39 +0000 (10:47 -0700)]
encoding/json: document that encoding.TextMarshaler is used if no (json) Marshaler is present

Change-Id: I63da54832548c325e47dc54aaa5b5112e1f3b3ba
Reviewed-on: https://go-review.googlesource.com/15048
Reviewed-by: Rob Pike <r@golang.org>
8 years agomath/big: improved documentation
Robert Griesemer [Sat, 26 Sep 2015 05:26:52 +0000 (22:26 -0700)]
math/big: improved documentation

- moved existing package documentation from nat.go to doc.go
- expanded on it

For #11241.

Change-Id: Ie75a2b0178a8904a4154307a1f5080d7efc5489a
Reviewed-on: https://go-review.googlesource.com/15042
Reviewed-by: Alan Donovan <adonovan@google.com>
8 years agocmd/doc: rearrange the newlines to group better
Rob Pike [Fri, 25 Sep 2015 23:04:30 +0000 (16:04 -0700)]
cmd/doc: rearrange the newlines to group better

Main change is that the comment for an item no longer has a blank line
before it, so it looks bound to the item it's about.

Motivating example: go doc.io.read changes from

<
func (l *LimitedReader) Read(p []byte) (n int, err error)
func (r *PipeReader) Read(data []byte) (n int, err error)

    Read implements the standard Read interface: it reads data from the pipe,
    blocking until a writer arrives or the write end is closed. If the write end
    is closed with an error, that error is returned as err; otherwise err is
    EOF.
func (s *SectionReader) Read(p []byte) (n int, err error)
>

to

<
func (l *LimitedReader) Read(p []byte) (n int, err error)
func (r *PipeReader) Read(data []byte) (n int, err error)
    Read implements the standard Read interface: it reads data from the pipe,
    blocking until a writer arrives or the write end is closed. If the write end
    is closed with an error, that error is returned as err; otherwise err is
    EOF.

func (s *SectionReader) Read(p []byte) (n int, err error)
>

Now the comment about PipeReader.Read doesn't look like it's about
SectionReader.

Based on a suggestion by dsnet@, a slight tweak from a CL he suggested
and abandoned.

Fixes #12756,

Change-Id: Iaf60ee9ae7f644c83c32d5e130acab0312b0c926
Reviewed-on: https://go-review.googlesource.com/14999
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agotext/template, html/template: add block keyword and permit template redefinition
Andrew Gerrand [Fri, 28 Aug 2015 05:31:51 +0000 (15:31 +1000)]
text/template, html/template: add block keyword and permit template redefinition

This change adds a new "block" keyword that permits the definition
of templates inline inside existing templates, and loosens the
restriction on template redefinition. Templates may now be redefined,
but in the html/template package they may only be redefined before
the template is executed (and therefore escaped).

The intention is that such inline templates can be redefined by
subsequent template definitions, permitting a kind of template
"inheritance" or "overlay". (See the example for details.)

Fixes #3812

Change-Id: I733cb5332c1c201c235f759cc64333462e70dc27
Reviewed-on: https://go-review.googlesource.com/14005
Reviewed-by: Rob Pike <r@golang.org>
8 years agocmd/cgo: only declare real function in gccgo exported header file
Ian Lance Taylor [Sun, 27 Sep 2015 01:37:06 +0000 (18:37 -0700)]
cmd/cgo: only declare real function in gccgo exported header file

When exporting a function using gccgo, we generate two functions: a Go
function with a leading Cgoexp_ prefix, and a C function that calls the
Go function.  The Go function has a name that can not be represented in
C, so the C code needs a declaration with an __asm__ qualifier giving
the name of the Go function.

Before this CL we put that declaration in the exported header file.
Because code would sometimes #include "_cgo_export.h", we added a macro
definition for the C function giving it the name of the declaration.  We
then added a macro undefine in the actual C code, so that we could
declare the C function we wanted.

This rounadabout process worked OK until we started exporting the header
file for use with -buildmode=c-archive and c-shared.  Doing that caused
the code to see the define and thus call the Go function rather than the
C function.  That often works fine, but the C function calls
_cgo_wait_runtime_init_done before calling the Go function, and that
sometimes matters.  This didn't show up in tests because we don't test
using gccgo.  That is something we should fix, but not now.

Fix that by simplifying the code to declare the C function in the header
file as one would expect, and move the __asm__ declaration to the C
code.

Change-Id: I33547e028152ff98e332630994b4f33285feec32
Reviewed-on: https://go-review.googlesource.com/15043
Reviewed-by: Minux Ma <minux@golang.org>
8 years agotests/fixedbugs: make test for issue11656 run known instruction
Joel Sing [Sun, 27 Sep 2015 18:39:01 +0000 (04:39 +1000)]
tests/fixedbugs: make test for issue11656 run known instruction

As detailed in #11910, the current implementation attempts to execute an area
of memory with unknown content. If the memory is executable, the result is
unpredictable - instead, make the test deterministic by attempting to execute
an instruction that is known to trigger a trap on the given architecture.

The new implementation is written by iant@ and provided via #11910.

Update issue #11910

Change-Id: Ia698c36e0dd98a9d9d16a701f60f6748c6faf896
Reviewed-on: https://go-review.googlesource.com/15058
Run-TryBot: Joel Sing <jsing@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agonet/http/fcgi: fix panic with malformed params record
Didier Spezia [Sat, 26 Sep 2015 17:21:35 +0000 (17:21 +0000)]
net/http/fcgi: fix panic with malformed params record

As stated in FastCGI specifications:

FastCGI transmits a name-value pair as the length of the name,
followed by the length of the value, followed by the name,
followed by the value.

The current implementation trusts the name and value length
provided in the record, leading to a panic if the record
is malformed.

Added an explicit check on the lengths.

Test case and fix suggested by diogin@gmail.com (Jingcheng Zhang)

Fixes #11824

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

8 years agocmd/go: Skip note reading test with linkmode external on openbsd/arm
Joel Sing [Sat, 26 Sep 2015 16:33:00 +0000 (02:33 +1000)]
cmd/go: Skip note reading test with linkmode external on openbsd/arm

openbsd/arm does not support external linking - skip the note reading test that
uses linkmode external on this platform. While here, cleanup the code and
consistently use t.Skipf for all platforms that cannot run this test.

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

8 years agomath/big: remove some string conversions in Int encoding
Robert Griesemer [Fri, 25 Sep 2015 22:11:14 +0000 (15:11 -0700)]
math/big: remove some string conversions in Int encoding

Change-Id: I1180aa3d30fb8563c8e6ecefeb3296af0a88f5a6
Reviewed-on: https://go-review.googlesource.com/14998
Reviewed-by: Alan Donovan <adonovan@google.com>
8 years agomath/big: move Int/Rat gob/json/xml functionality in separate files
Robert Griesemer [Fri, 25 Sep 2015 21:56:19 +0000 (14:56 -0700)]
math/big: move Int/Rat gob/json/xml functionality in separate files

Like int/rat/float conversions, move this functionality into separate
implementation and test files.

No implementation changes besides the move.

Change-Id: If19c45f5a72a57b95cbce2329724693ae5a4807d
Reviewed-on: https://go-review.googlesource.com/14997
Reviewed-by: Alan Donovan <adonovan@google.com>
8 years agomath/big: removed more unnecessary string conversions
Robert Griesemer [Fri, 25 Sep 2015 17:09:04 +0000 (10:09 -0700)]
math/big: removed more unnecessary string conversions

- renamed (nat) itoa to utoa (since that's what it is)
- added (nat) itoa that takes a sign parameter; this helps removing a few string copies
- used buffers instead of string+ in Rat conversions

Change-Id: I6b37a6b39557ae311cafdfe5c4a26e9246bde1a9
Reviewed-on: https://go-review.googlesource.com/14995
Reviewed-by: Alan Donovan <adonovan@google.com>
8 years agomath/big: implement Int.Text, Int.Append
Robert Griesemer [Thu, 24 Sep 2015 23:36:08 +0000 (16:36 -0700)]
math/big: implement Int.Text, Int.Append

This makes the Int conversion routines match the respective strconv
and big.Float conversion routines.

Change-Id: I5cfcda1632ee52fe87c5bb75892bdda76cc3af15
Reviewed-on: https://go-review.googlesource.com/14994
Reviewed-by: Alan Donovan <adonovan@google.com>
8 years agosyscall: fix alignment check for link-layer information on BSD variants
Mikio Hara [Thu, 24 Sep 2015 06:23:26 +0000 (15:23 +0900)]
syscall: fix alignment check for link-layer information on BSD variants

When link-layer information is wrapped with sockaddr_dl, we need to
follow the len field of sockaddr_dl. When link-layer information is
naked, we need to use the length of whole link-layer information.

Fixes #12641.

Change-Id: I4d377f64cbab1760b993fc55c719288616042bbb
Reviewed-on: https://go-review.googlesource.com/14939
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agodoc: go1.6.txt: bufio.ErrFinalToken
Rob Pike [Fri, 25 Sep 2015 21:56:30 +0000 (14:56 -0700)]
doc: go1.6.txt: bufio.ErrFinalToken

Change-Id: I2714faa6e8aa7b81a05f0e015b045a57407d808d
Reviewed-on: https://go-review.googlesource.com/14996
Reviewed-by: Rob Pike <r@golang.org>
8 years agobufio: fix scanning with a final empty token.
Rob Pike [Thu, 24 Sep 2015 20:10:00 +0000 (13:10 -0700)]
bufio: fix scanning with a final empty token.

The Scan function's interface to the split function was not sufficient
to handle an empty final token in a pure function; state was required.
This was ugly.

We introduce a special error value that a split function can return
that signals that this token is OK, but is the last one and scanning
should stop immediately _after_ this token.

The same effect could be achieved using the same trick (a special
error value) and checking for that error after Scan finishes, but it's
a little clumsy. Providing a published sentinel value in bufio is
cleaner and means everyone can use the same trick. The result
is an error-free scan.

Rewrite the test (that was only barely working) to use the value
and be more robust.

Also write a new example showing how to do it.

Fixes #11836

Change-Id: Iaae77d0f95b4a2efa0175ced94d93c66353079e8
Reviewed-on: https://go-review.googlesource.com/14924
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agocmd/go: elide -rpath when not applicable and used via LDFLAGS
Shawn Walker-Salas [Thu, 17 Sep 2015 22:47:20 +0000 (15:47 -0700)]
cmd/go: elide -rpath when not applicable and used via LDFLAGS

Some linker flags should only be applied when performing the final
linking step for a shared library or executable, etc. In other
contexts, they're either invalid, or meaningless to apply (so should
not be specified).

When an external linker is used (either directly by Go or by the
compiler driver used by cgo), -rpath and -rpath-link should only be
specified in the final linking step.  On platforms such as Solaris,
ld(1) will reject its use in any other scenario (such as when linking
relocatable objects).

This change is necessary because Go does not currently offer a way to
specify LDFLAGS based on when they should be applied.

Fixes #12115

Change-Id: If35a18d8eee8ec7ddcca2d4ccd41ab6ffcf93b41
Reviewed-on: https://go-review.googlesource.com/14674
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agomath/big: faster string conversion routines
Robert Griesemer [Thu, 24 Sep 2015 22:10:47 +0000 (15:10 -0700)]
math/big: faster string conversion routines

Eliminated unnecessary string conversions throughout and removed
(internal) capability for arbitrary character sets in conversion
routines (functionality was not exported and not used internally).

benchmark                         old ns/op     new ns/op     delta
BenchmarkDecimalConversion-8      198283        187085        -5.65%
BenchmarkStringPiParallel-8       46116         47822         +3.70%
BenchmarkString10Base2-8          216           166           -23.15%
BenchmarkString100Base2-8         886           762           -14.00%
BenchmarkString1000Base2-8        7296          6625          -9.20%
BenchmarkString10000Base2-8       72371         65563         -9.41%
BenchmarkString100000Base2-8      725849        672766        -7.31%
BenchmarkString10Base8-8          160           114           -28.75%
BenchmarkString100Base8-8         398           309           -22.36%
BenchmarkString1000Base8-8        2650          2244          -15.32%
BenchmarkString10000Base8-8       24974         21745         -12.93%
BenchmarkString100000Base8-8      245457        217489        -11.39%
BenchmarkString10Base10-8         337           288           -14.54%
BenchmarkString100Base10-8        1298          1046          -19.41%
BenchmarkString1000Base10-8       6200          5752          -7.23%
BenchmarkString10000Base10-8      24942         22589         -9.43%
BenchmarkString100000Base10-8     8012921       7947152       -0.82%
BenchmarkString10Base16-8         156           107           -31.41%
BenchmarkString100Base16-8        344           255           -25.87%
BenchmarkString1000Base16-8       2067          1705          -17.51%
BenchmarkString10000Base16-8      19026         16112         -15.32%
BenchmarkString100000Base16-8     184038        163457        -11.18%

Change-Id: I68bd807529bd9b985f4b6ac2a87764bcc1a7d2f7
Reviewed-on: https://go-review.googlesource.com/14926
Reviewed-by: Alan Donovan <adonovan@google.com>
8 years agocmd/doc: don't stop after first package if the symbol is not found
Rob Pike [Wed, 23 Sep 2015 23:49:30 +0000 (16:49 -0700)]
cmd/doc: don't stop after first package if the symbol is not found

The test case is
go doc rand.Float64
The first package it finds is crypto/rand, which does not have a Float64.
Before this change, cmd/doc would stop there even though math/rand
has the symbol. After this change, we get:

% go doc rand.Float64
package rand // import "math/rand"

func Float64() float64

    Float64 returns, as a float64, a pseudo-random number in [0.0,1.0) from the
    default Source.
%

Another nice consequence is that if a symbol is not found, we might get
a longer list of packages that were examined:

% go doc rand.Int64
doc: no symbol Int64 in packages crypto/rand, math/rand
exit status 1
%

This change introduces a coroutine to scan the file system so that if
the symbol is not found, the coroutine can deliver another path to try.
(This is darned close to the original motivation for coroutines.)
Paths are delivered on an unbuffered channel so the scanner does
not proceed until candidate paths are needed.

The scanner is attached to a new type, called Dirs, that caches the results
so if we need to scan a second time, we don't walk the file system
again. This is significantly more efficient than the existing code, which
could scan the tree multiple times looking for a package with
the symbol.

Change-Id: I2789505b9992cf04c19376c51ae09af3bc305f7f
Reviewed-on: https://go-review.googlesource.com/14921
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agomath/big: fix test for denormalized inputs and enable more test cases
Robert Griesemer [Thu, 24 Sep 2015 16:48:39 +0000 (09:48 -0700)]
math/big: fix test for denormalized inputs and enable more test cases

Also: removed unnecessary BUG comment (was fixed).

Change-Id: I8f11fbcb4e30a19ec5a25df742b3e25e2ee7f846
Reviewed-on: https://go-review.googlesource.com/14923
Reviewed-by: Alan Donovan <adonovan@google.com>
8 years agocompile/internal/gc,internal/obj: remove some usages of obj.Bool2int
Marvin Stenger [Wed, 23 Sep 2015 23:48:03 +0000 (01:48 +0200)]
compile/internal/gc,internal/obj: remove some usages of obj.Bool2int

Passes go build -toolexec 'toolstash -cmp' -a std.

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

8 years agocmd/link/internal/ld: removed some uses of stringsCompare
Marvin Stenger [Thu, 24 Sep 2015 14:01:50 +0000 (16:01 +0200)]
cmd/link/internal/ld: removed some uses of stringsCompare

Only one use of stringsCompare is left. Cannot simply be replaced by
strings.Compare for bootstrapping reasons I guess.
Moving the function away from util.go to the actual destination data.go
also would not help much. So I left this one unchanged for readability and convenience.

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

8 years agocmd/compile/internal/gc: move functions from util.go to lex.go
Marvin Stenger [Thu, 24 Sep 2015 13:41:05 +0000 (15:41 +0200)]
cmd/compile/internal/gc: move functions from util.go to lex.go

Moves the functions:
        isSpace(int) bool
        isAlpha(int) bool
        isDigit(int) bool
        isAlnum(int) bool
        plan9quote(string) string

Passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I6f946981abb6f29b047ad90d5c117847e826789f
Reviewed-on: https://go-review.googlesource.com/14952
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/compile/internal/gc: convert return values from int to bool
Marvin Stenger [Wed, 23 Sep 2015 22:38:54 +0000 (00:38 +0200)]
cmd/compile/internal/gc: convert return values from int to bool

Passes go build -toolexec 'toolstash -cmp' -a std.

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

8 years agomultipart: fixes problem parsing mime/multipart of certain lengths
Francisco Claude [Wed, 16 Sep 2015 15:56:06 +0000 (12:56 -0300)]
multipart: fixes problem parsing mime/multipart of certain lengths

When parsing the multipart data, if the delimiter appears but doesn't
finish with -- or \n or \r\n, it assumes the data can be consumed. This
is incorrect when the peeking buffer finishes with --delimiter-

Fixes #12662

Change-Id: I329556a9a206407c0958289bf7a9009229120bb9
Reviewed-on: https://go-review.googlesource.com/14652
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoarchive/tar: remove dead code with USTAR path splitting
Joe Tsai [Thu, 17 Sep 2015 23:07:38 +0000 (16:07 -0700)]
archive/tar: remove dead code with USTAR path splitting

Convert splitUSTARPath to return a bool rather than an error since
the caller never ever uses the error other than to check if it is
nil. Thus, we can remove errNameTooLong as well.

Also, fold the checking of the length <= fileNameSize and whether
the string is ASCII into the split function itself.

Lastly, remove logic to set the MAGIC since that's already done on
L200. Thus, setting the magic is redundant.

There is no overall logic change.

Updates #12638

Change-Id: I26b6992578199abad723c2a2af7f4fc078af9c17
Reviewed-on: https://go-review.googlesource.com/14723
Reviewed-by: David Symonds <dsymonds@golang.org>
Run-TryBot: David Symonds <dsymonds@golang.org>

8 years agocmd/dist: fix build after "go test" argument order change
Shenghou Ma [Wed, 23 Sep 2015 22:53:16 +0000 (18:53 -0400)]
cmd/dist: fix build after "go test" argument order change

Change-Id: I332cd4a4b48cbb52d2beeb16c4a24833bb7069d7
Reviewed-on: https://go-review.googlesource.com/14890
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agospec: minor adjustment of prose in composite literal section
Robert Griesemer [Wed, 23 Sep 2015 00:47:38 +0000 (17:47 -0700)]
spec: minor adjustment of prose in composite literal section

The prose discussing composite literals referred to the composite
literal type with 'LiteralType', denoting the literal type's EBNF
production explicitly. Changed 'LiteralType' to 'literal type' to
remove the literal (no pun intended) connection and instead mean
the underlying type. Seems a simpler and more readable change
than referring to the underlying type everywhere explicitly.

Fixes #12717.

Change-Id: I225df95f9ece2664b19068525ea8bda5ca05a44a
Reviewed-on: https://go-review.googlesource.com/14851
Reviewed-by: Rob Pike <r@golang.org>
8 years agodoc: go1.6.txt: go test flag changes
Rob Pike [Wed, 23 Sep 2015 21:23:01 +0000 (14:23 -0700)]
doc: go1.6.txt: go test flag changes

Change-Id: Icb52589909776fbe195ef2502ec7c0a4b590f350
Reviewed-on: https://go-review.googlesource.com/14859
Reviewed-by: Rob Pike <r@golang.org>
8 years agocmd/go: fix processing of flags for test binaries.
Rob Pike [Tue, 22 Sep 2015 21:23:32 +0000 (14:23 -0700)]
cmd/go: fix processing of flags for test binaries.

The usage message says:

test [-c] [-i] [build and test flags] [packages] [flags for test binary]

but this was not what was implemented. Instead, after packages are named,
flag processing continues, which makes it impossible, for example, to pass
to the binary a flag with the same name as a test flag. This was triggered
by the -v flag in glog.

Consider this test:

package pkg

... imports ...

var v = flag.Int("v", 0, "v flag")

func TestFoo(t *testing.T) {
if *v != 7 { log.Fatal(*v) }
}

Attempting to run this test with go test pkg -v=7 would give a usage
message. This change allows it. In fact it allows

go test -v pkg -v=7

The solution is to implement the usage message. One compatibility
issue is that flags after the package name are no longer processed
as test flags, so this no longer works:

go test foo -cover

One must write

go test -cover foo

I do not think this is onerous but it must be called out in the
release notes.

Fixes #12177.

Change-Id: Ib9267884b47a6b0c183efa888ec78333272113aa
Reviewed-on: https://go-review.googlesource.com/14826
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agostrconv: slightly simplified roundShortest; better comments
Robert Griesemer [Wed, 23 Sep 2015 16:52:21 +0000 (09:52 -0700)]
strconv: slightly simplified roundShortest; better comments

Change-Id: If886f15468680f7e1c589873066b4391eb9784b5
Reviewed-on: https://go-review.googlesource.com/14856
Reviewed-by: Alan Donovan <adonovan@google.com>
8 years agomath/big: factored out an internal accessor method (cleanup), added benchmark
Robert Griesemer [Wed, 23 Sep 2015 17:05:44 +0000 (10:05 -0700)]
math/big: factored out an internal accessor method (cleanup), added benchmark

Current result of DecimalConversion benchmark (for future reference):

BenchmarkDecimalConversion-8    10000     204770 ns/op

Measured on Mac Mini (late 2012) running OS X 10.10.5,
2.3 GHz Intel Core i7, 8 GB 1333 MHz DDR3.

Also: Removed comment suggesting to implement decimal by representing
digits as numbers 0..9 rather than ASCII chars '0'..'9' to avoid
repeated +/-'0' operations. Tried and it appears (per above benchmark)
that the +/-'0' operations are neglibile but the addition conversion
passes around it are not and that it makes things significantly slower.

Change-Id: I6ee033b1172043248093cc5d02abff5fc54c2e7a
Reviewed-on: https://go-review.googlesource.com/14857
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
8 years agoos: document that behavior of Seek on O_APPEND files is not specified
Shenghou Ma [Wed, 23 Sep 2015 15:49:44 +0000 (11:49 -0400)]
os: document that behavior of Seek on O_APPEND files is not specified

The actual behavior varies across platforms, and due to the inherent
race, we can't do anything better (other than to always return 0).

Fixes #12710.

Change-Id: Icb52f0f1f0a267e0f9f70767cae427f3f0239965
Reviewed-on: https://go-review.googlesource.com/14881
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoruntime: fix incomplete sentence in comment
Shenghou Ma [Tue, 22 Sep 2015 06:18:57 +0000 (02:18 -0400)]
runtime: fix incomplete sentence in comment

Fixes #12709.

Change-Id: If5a2536458fcd26d6f003dde1bfc02f86b09fa94
Reviewed-on: https://go-review.googlesource.com/14793
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agomath/big: implement negative precision for Float.Append/Text
Robert Griesemer [Wed, 23 Sep 2015 00:32:54 +0000 (17:32 -0700)]
math/big: implement negative precision for Float.Append/Text

Enabled all but a handful of disabled Float formatting test cases.

Fixes #10991.

Change-Id: Id18e160e857be2743429a377000e996978015a1a
Reviewed-on: https://go-review.googlesource.com/14850
Reviewed-by: Alan Donovan <adonovan@google.com>
8 years agoruntime: test that timeBeginPeriod succeeds
Alex Brainman [Thu, 23 Jul 2015 01:42:51 +0000 (11:42 +1000)]
runtime: test that timeBeginPeriod succeeds

Change-Id: I5183f767dadb6d24a34d2460d02e97ddbaab129a
Reviewed-on: https://go-review.googlesource.com/12546
Run-TryBot: Minux Ma <minux@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocompress/gzip: detect truncated streams
Joe Tsai [Tue, 22 Sep 2015 09:14:28 +0000 (02:14 -0700)]
compress/gzip: detect truncated streams

Reader fails to detect truncated streams since calls to io.ReadFull
do not check if the error is io.EOF.

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

8 years agocompress/flate: detect truncated streams
Joe Tsai [Tue, 22 Sep 2015 08:28:09 +0000 (01:28 -0700)]
compress/flate: detect truncated streams

Reader failed to detect truncated streams since calls to
io.ReadFull did not check if the error is io.EOF.

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

8 years agoos: add check for ERROR_BAD_NETPATH in windows IsNotExist
Alex Brainman [Tue, 15 Sep 2015 06:59:20 +0000 (16:59 +1000)]
os: add check for ERROR_BAD_NETPATH in windows IsNotExist

Otherwise IsNotExist does not account for not existent servers and shares.

Fixes #12374

Change-Id: I37f6850198f91dcb02a4a917b793339d7e30e934
Reviewed-on: https://go-review.googlesource.com/14579
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agodoc: document go1.4.3
Chris Broadfoot [Wed, 23 Sep 2015 03:45:16 +0000 (20:45 -0700)]
doc: document go1.4.3

Change-Id: Ib1bfe4038e2b125a31acd9ff7772e462b0a6358f
Reviewed-on: https://go-review.googlesource.com/14852
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agoregexp: add runnable example to regex.Split
Seth Hoenig [Fri, 18 Sep 2015 04:26:39 +0000 (23:26 -0500)]
regexp: add runnable example to regex.Split

The existing comment for regex.Split contains a plain text example,
while many of the other regex functions have runnable examples. This
change provides a runnable example for Split.

Change-Id: I5373f57f532fe843d7d0adcf4b513061ec797047
Reviewed-on: https://go-review.googlesource.com/14737
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoencoding/json: spell "marshaling" and "unmarshaling" consistently
Andrew Gerrand [Tue, 1 Sep 2015 07:51:39 +0000 (17:51 +1000)]
encoding/json: spell "marshaling" and "unmarshaling" consistently

Fixes #12431

Change-Id: I67c42bf2cd9285f471387248fd9c22a16b158349
Reviewed-on: https://go-review.googlesource.com/14150
Reviewed-by: Dmitri Shuralyov <shurcool@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
8 years agotest/fixedbugs: update overly restrictive test case
Robert Griesemer [Tue, 22 Sep 2015 16:37:56 +0000 (09:37 -0700)]
test/fixedbugs: update overly restrictive test case

See discussion in https://go-review.googlesource.com/14830 .

Change-Id: I94f25f92b8cdaa509d2c335865a645228425804d
Reviewed-on: https://go-review.googlesource.com/14837
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoruntime: fix offset in invalidptr panic message
Austin Clements [Mon, 21 Sep 2015 15:49:52 +0000 (11:49 -0400)]
runtime: fix offset in invalidptr panic message

Change-Id: I00e1eebbf5e1a01c8fad5ca5324aa8eec1e4d731
Reviewed-on: https://go-review.googlesource.com/14792
Reviewed-by: Rick Hudson <rlh@golang.org>
8 years agoruntime: optimize duffcopy on amd64
Ilya Tocar [Tue, 22 Sep 2015 11:32:05 +0000 (14:32 +0300)]
runtime: optimize duffcopy on amd64

Use movups to copy 16 bytes at a time.
Results (haswell):

name            old time/op  new time/op  delta
CopyFat8-48     0.62ns ± 3%  0.63ns ± 3%     ~     (p=0.535 n=20+20)
CopyFat12-48    0.92ns ± 2%  0.93ns ± 3%     ~     (p=0.594 n=17+18)
CopyFat16-48    1.23ns ± 2%  1.23ns ± 2%     ~     (p=0.839 n=20+19)
CopyFat24-48    1.85ns ± 2%  1.84ns ± 0%   -0.48%  (p=0.014 n=19+20)
CopyFat32-48    2.45ns ± 0%  2.45ns ± 1%     ~     (p=1.000 n=16+16)
CopyFat64-48    3.30ns ± 2%  2.14ns ± 1%  -35.00%  (p=0.000 n=20+18)
CopyFat128-48   6.05ns ± 0%  3.98ns ± 0%  -34.22%  (p=0.000 n=18+17)
CopyFat256-48   11.9ns ± 3%   7.7ns ± 0%  -35.87%  (p=0.000 n=20+17)
CopyFat512-48   23.0ns ± 2%  15.1ns ± 2%  -34.52%  (p=0.000 n=20+18)
CopyFat1024-48  44.8ns ± 1%  29.8ns ± 2%  -33.48%  (p=0.000 n=17+19)

Change-Id: I8a78773c656d400726a020894461e00c59f896bf
Reviewed-on: https://go-review.googlesource.com/14836
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
8 years agomath/big: add test cases for min/max exponent values
Robert Griesemer [Mon, 21 Sep 2015 22:25:52 +0000 (15:25 -0700)]
math/big: add test cases for min/max exponent values

Change-Id: I2e74e39628285e2fecaab712be6cff230619a6c2
Reviewed-on: https://go-review.googlesource.com/14778
Reviewed-by: Alan Donovan <adonovan@google.com>
8 years agomath/big: optimize Float.Parse by reducing powers of 10 to powers of 2 and 5
Robert Griesemer [Sun, 20 Sep 2015 01:24:16 +0000 (18:24 -0700)]
math/big: optimize Float.Parse by reducing powers of 10 to powers of 2 and 5

Instead of computing the final adjustment factor as a power of 10,
it's more efficient to split 10**e into 2**e * 5**e . Powers of 2
are trivially added to the Float exponent, and powers of 5 are
smaller and thus faster to compute.

Also, use a table of uint64 values rather than float64 values for
initial power value. uint64 values appear to be faster to convert
to Floats (useful for small exponents).

Added two small benchmarks to confirm that there's no regresssion.

benchmark                         old ns/op     new ns/op     delta
BenchmarkParseFloatSmallExp-8     17543         16220         -7.54%
BenchmarkParseFloatLargeExp-8     60865         59996         -1.43%

Change-Id: I3efd7556b023316f86f334137a67fe0c6d52f8ef
Reviewed-on: https://go-review.googlesource.com/14782
Reviewed-by: Alan Donovan <adonovan@google.com>
8 years agosrc/cmd/compile/internal/gc: remove now unnecessary restriction on float exponent...
Robert Griesemer [Mon, 21 Sep 2015 22:58:19 +0000 (15:58 -0700)]
src/cmd/compile/internal/gc: remove now unnecessary restriction on float exponent parsing

https://go-review.googlesource.com/#/c/13778/ fixed this issue in math/big.
Remove restriction in compiler.

Fixes #11326.

Change-Id: I1429d0dd0d79431706c65616413373fff58f081e
Reviewed-on: https://go-review.googlesource.com/14830
Reviewed-by: Rob Pike <r@golang.org>
8 years agoimage/png: integer underflow when decoding
Nathan Otterness [Sat, 19 Sep 2015 00:08:47 +0000 (20:08 -0400)]
image/png: integer underflow when decoding

This change addresses an integer underflow appearing only on systems
using a 32-bit int type. The patch addresses the problem by limiting the
length of unknown chunks to 0x7fffffff. This value appears to already be
checked for when parsing other chunk types, so the bug shouldn't appear
elsewhere in the package. The PNG spec recommends the maximum size for
any chunk to remain under 2^31, so this shouldn't cause errors with
valid images.

Fixes #12687

Change-Id: I17f0e1683515532c661cf2b0b2bc65309d1b7bb7
Reviewed-on: https://go-review.googlesource.com/14766
Reviewed-by: Nigel Tao <nigeltao@golang.org>
8 years agocmd/asm: fix crash triggered by nested #define
Rob Pike [Mon, 21 Sep 2015 21:18:13 +0000 (14:18 -0700)]
cmd/asm: fix crash triggered by nested #define

A panic was in place for an impossible condition that turned
out to be possible if one used a macro to define a macro.

Another go-fuzz "win".

Fixes #12654.

Change-Id: I0a7bb0f0eabb260c986bf7a2288860c78d8db1af
Reviewed-on: https://go-review.googlesource.com/14777
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agocmd/compile/internal/gc: use sort.Interface for reflect methods
Håvard Haugen [Mon, 14 Sep 2015 22:16:35 +0000 (00:16 +0200)]
cmd/compile/internal/gc: use sort.Interface for reflect methods

Generate slices of method *Sig(nature)s instead of linked lists.
Remove custom lsort function in favor of sort.Interface.

Eliminates another use of stringsCompare.

Passes go build -a -toolexec 'toolstash -cmp' std cmd.

Change-Id: I9ed1664b7f55be9e967dd7196e396a76f6ea3422
Reviewed-on: https://go-review.googlesource.com/14559
Reviewed-by: Dave Cheney <dave@cheney.net>
8 years agocmd/vet: build the binary only once in the test
Rob Pike [Mon, 21 Sep 2015 18:06:43 +0000 (11:06 -0700)]
cmd/vet: build the binary only once in the test

Recent changes caused vet to build the binary for each Test function.
This is wasteful and will become only more so as more tests are added.
Use testing.Main to build only once.

Verified that compilation errors still appear if the binary cannot be
built.

Before:
real 0m11.169s
user 0m18.328s
sys 0m2.152s

After:
real 0m5.132s
user 0m9.404s
sys 0m1.168s

Of course if the compiler were fast we might not notice, but vet is
a big program and growing bigger all the time, as are the tests.

Change-Id: I209a8fdcace94bc5cec946f5dd365d7191f44c02
Reviewed-on: https://go-review.googlesource.com/14822
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agogo/printer: avoid stomping on err before checking it
Tarmigan Casebolt [Mon, 24 Aug 2015 02:51:26 +0000 (19:51 -0700)]
go/printer: avoid stomping on err before checking it

Change-Id: I97ba31e758d3396842ad99a08af696e49a5f1a7d
Reviewed-on: https://go-review.googlesource.com/13954
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
8 years agocmd/vet: copy changes from golang.org/x/tools to cmd/vet
Rob Pike [Mon, 21 Sep 2015 17:30:04 +0000 (10:30 -0700)]
cmd/vet: copy changes from golang.org/x/tools to cmd/vet

This means bringing over the examples flag and sorting doc.go.

Subsequent changes will generalize the examples flag to a general
test naming flag, but let's start with the original code.

No more changes to golang.org/x/tools please. This should not have
happened (and letting it happen was partly my fault).

Change-Id: Ia879ea1d15d82372df14853f919263125dfb7b96
Reviewed-on: https://go-review.googlesource.com/14821
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/doc: don't drop const/var block if first entry is unexported
Rob Pike [Fri, 18 Sep 2015 21:53:33 +0000 (14:53 -0700)]
cmd/doc: don't drop const/var block if first entry is unexported

The code assumed that if the first entry was unexported, all the
entries were. The fix is simple: delete a bunch of code.

Fixes #12286.

Change-Id: Icb09274e99ce97df4d8bddbe59d17a5c0622e4c6
Reviewed-on: https://go-review.googlesource.com/14780
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agoencoding/json: scanner: use byte, more consistent
Marvin Stenger [Sun, 20 Sep 2015 22:45:21 +0000 (00:45 +0200)]
encoding/json: scanner: use byte, more consistent

The fields step and redoState of struct scanner are now defined as
`func(s *scanner, c byte) int` instead of
`func(s *scanner, c int) int`, since bytes are sufficient.
Further changes improve the consistency in the scanner.go file.

Change-Id: Ifb85f2130d728d2b936d79914d87a1f0b5c6ee7d
Reviewed-on: https://go-review.googlesource.com/14801
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocmd/compile/internal/gc: eliminate stringsCompare for stackvar sorting
Håvard Haugen [Sat, 19 Sep 2015 21:55:27 +0000 (23:55 +0200)]
cmd/compile/internal/gc: eliminate stringsCompare for stackvar sorting

Passes go build -a -toolexec 'toolstash -cmp' std cmd.

Change-Id: I2a87d31da74affdf3d0f358d0efdb3f1c646d917
Reviewed-on: https://go-review.googlesource.com/14759
Reviewed-by: Dave Cheney <dave@cheney.net>
8 years agobufio: fix overflow calculation in Scan
Rob Pike [Sat, 19 Sep 2015 18:39:22 +0000 (11:39 -0700)]
bufio: fix overflow calculation in Scan

I was being too clever, as usual. Write the obvious code to make sure
that when we grow the buffer we don't overflow.

Change-Id: I1641831177b0bb8a89ab6e9bcabccf6c2fcfe1d2
Reviewed-on: https://go-review.googlesource.com/14781
Reviewed-by: Minux Ma <minux@golang.org>
8 years agonet: check 'ok' return in dnsmsg when initially packing rr.Header()
Tarmigan Casebolt [Mon, 24 Aug 2015 02:51:31 +0000 (19:51 -0700)]
net: check 'ok' return in dnsmsg when initially packing rr.Header()

In the present code, there is no way for ok to ever return false, but
it still a good idea to check it.

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

8 years agoruntime: race instrument read of convT2E/I arg
Dmitry Vyukov [Fri, 18 Sep 2015 09:40:36 +0000 (11:40 +0200)]
runtime: race instrument read of convT2E/I arg

Sometimes this read is instrumented by compiler when it creates
a temp to take address, but sometimes it is not (e.g. for global vars
compiler takes address of the global directly).

Instrument convT2E/I similarly to chansend and mapaccess.

Fixes #12664

Change-Id: Ia7807f15d735483996426c5f3aed60a33b279579
Reviewed-on: https://go-review.googlesource.com/14752
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocmd/dist: skip spectralnorm shootout test on the linux-arm-arm5 builder
Brad Fitzpatrick [Sat, 19 Sep 2015 05:39:03 +0000 (05:39 +0000)]
cmd/dist: skip spectralnorm shootout test on the linux-arm-arm5 builder

Temporary fix to get the arm5 builder happy again.

Without hardware floating point, this test takes over 20 minutes to
run.

A proper solution would probably be to run all the benchmark tests,
but with a much lower iteration count, just to exercise the code.

Updates golang/go#12688

Change-Id: Ie56c93d3bf2a5a693a33217ba1b1df3c6c856442
Reviewed-on: https://go-review.googlesource.com/14775
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Minux Ma <minux@golang.org>
8 years agocmd/compile/internal/gc: move intLiteral to gc.Node
Dave Cheney [Fri, 18 Sep 2015 08:56:47 +0000 (18:56 +1000)]
cmd/compile/internal/gc: move intLiteral to gc.Node

intLiteral is used by the gins wrappers in arm64, ppc64 and
mips64. Refactor the function to a method on gc.Node and update
the callers to use the common copy.

Change-Id: I2db90d801a9cb18f8526eb921e13daa75ca1cf6f
Reviewed-on: https://go-review.googlesource.com/14744
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Reviewed-by: Dave Cheney <dave@cheney.net>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoruntime: remove flaky TestInvalidptrCrash to fix build
Austin Clements [Sat, 19 Sep 2015 01:17:07 +0000 (21:17 -0400)]
runtime: remove flaky TestInvalidptrCrash to fix build

This test fails on arm64 and some amd64 OSs and fails on Linux/amd64
if you remove the first runtime.GC(), which should be unnecessary, and
run it in all.bash (but not if you run it in isolation). I don't
understand any of these failures, so for now just remove this test.

TBR=rlh

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

8 years agoruntime: avoid debug prints of huge objects
Austin Clements [Fri, 18 Sep 2015 16:06:24 +0000 (12:06 -0400)]
runtime: avoid debug prints of huge objects

Currently when the GC prints an object for debugging (e.g., for a
failed invalidptr or checkmark check), it dumps the entire object. To
avoid inundating the user with output for really large objects, limit
this to printing just the first 128 words (which are most likely to be
useful in identifying the type of an object) and the 32 words around
the problematic field.

Change-Id: Id94a5c9d8162f8bd9b2a63bf0b1bfb0adde83c68
Reviewed-on: https://go-review.googlesource.com/14764
Reviewed-by: Rick Hudson <rlh@golang.org>
8 years agoruntime: improve invalid pointer error message
Austin Clements [Fri, 18 Sep 2015 15:55:31 +0000 (11:55 -0400)]
runtime: improve invalid pointer error message

By default, the runtime panics if it detects a pointer to an
unallocated span. At this point, this usually catches bad uses of
unsafe or cgo in user code (though it could also catch runtime bugs).
Unfortunately, the rather cryptic error misleads users, offers users
little help with debugging their own problem, and offers the Go
developers little help with root-causing.

Improve the error message in various ways. First, the wording is
improved to make it clearer what condition was detected and to suggest
that this may be the result of incorrect use of unsafe or cgo. Second,
we add a dump of the object containing the bad pointer so that there's
at least some hope of figuring out why a bad pointer was stored in the
Go heap.

Change-Id: I57b91b12bc3cb04476399d7706679e096ce594b9
Reviewed-on: https://go-review.googlesource.com/14763
Reviewed-by: Rick Hudson <rlh@golang.org>
8 years agocrypto/x509: return err if marshalPublicKey fails to marshal an rsa public key
Tarmigan Casebolt [Mon, 24 Aug 2015 02:51:16 +0000 (19:51 -0700)]
crypto/x509: return err if marshalPublicKey fails to marshal an rsa public key

Change-Id: I9bd5c1b66fd90f0b54bd1a8f3e57b6830d2b7733
Reviewed-on: https://go-review.googlesource.com/13846
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>