]> Cypherpunks repositories - gostls13.git/log
gostls13.git
9 years agotest: add test case for issue 8154
Dave Cheney [Mon, 8 Jun 2015 07:45:54 +0000 (17:45 +1000)]
test: add test case for issue 8154

Updates #8154

Change-Id: Ie9c731a91b008277e51c723eef6871bb0919fa4c
Reviewed-on: https://go-review.googlesource.com/10831
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: slightly clean up softfloat code
Shenghou Ma [Fri, 1 May 2015 07:55:17 +0000 (03:55 -0400)]
runtime: slightly clean up softfloat code

Removes the remains of the old C based stepflt implementation.
Also removed goto usage.

Change-Id: Ida4742c49000fae4fea4649f28afde630ce4c577
Reviewed-on: https://go-review.googlesource.com/9600
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: reduce slice growth during append to 2x
Russ Cox [Thu, 25 Jun 2015 23:27:20 +0000 (19:27 -0400)]
runtime: reduce slice growth during append to 2x

The new inlined code for append assumed that it could pass the
desired new cap to growslice, not the number of new elements.
But growslice still interpreted the argument as the number of new elements,
making it always grow by >2x (more precisely, 2x+1 rounded up
to the next malloc block size). At the time, I had intended to change
the other callers to use the new cap as well, but it's too late for that.
Instead, introduce growslice_n for the old callers and keep growslice
for the inlined (common case) caller.

Fixes #11403.

Filed #11419 to merge them.

Change-Id: I1338b1e5b352f3be4e43641f44b652ef7195251b
Reviewed-on: https://go-review.googlesource.com/11541
Reviewed-by: Austin Clements <austin@google.com>
9 years agonet/url: don't escape star requests when writing requests
Brad Fitzpatrick [Thu, 25 Jun 2015 09:48:27 +0000 (11:48 +0200)]
net/url: don't escape star requests when writing requests

Includes a new net/http test too.

Fixes #11202

Change-Id: I61edc594f4de8eb6780b8dfa221269dd482e8f35
Reviewed-on: https://go-review.googlesource.com/11492
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet/http: don't overwrite Authorization headers when URL has username
Steve Streeting [Thu, 25 Jun 2015 15:52:51 +0000 (16:52 +0100)]
net/http: don't overwrite Authorization headers when URL has username

Fixes #11399

Change-Id: I3be7fbc86c5f62761f47122632f3e11b56cb6be6
Reviewed-on: https://go-review.googlesource.com/11510
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet/http: change default user agent string
Aamir Khan [Mon, 27 Apr 2015 13:31:12 +0000 (22:31 +0900)]
net/http: change default user agent string

Default user agent in use - "Go 1.1 package http" doesn't conform to RFC 7231.
See http://tools.ietf.org/html/rfc7231#section-5.5.3

Use a valid user-agent string instead.

Fixes #9792

Change-Id: I80249709800dcdbf6f2e97a63fab05656898e6aa
Reviewed-on: https://go-review.googlesource.com/9385
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet/http: add comment to exported ErrNoCookie and ErrNoLocation values
Matt Layher [Sat, 13 Jun 2015 15:25:17 +0000 (11:25 -0400)]
net/http: add comment to exported ErrNoCookie and ErrNoLocation values

All other exported errors in net/http are commented.  This change adds
documentation to ErrNoCookie and ErrNoLocation to explain where they are
returned, and why.

Change-Id: I21fa0d070dd35256681ad0714000f238477d4af1
Reviewed-on: https://go-review.googlesource.com/11044
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoreflect: test repeats with large scalar tails
Austin Clements [Wed, 24 Jun 2015 15:43:40 +0000 (11:43 -0400)]
reflect: test repeats with large scalar tails

This adds a GC bitmap test of a type with many pointer bits and a
large scalar tail, such as the one in issue #11286. This test would
have failed prior to the fix in a8ae93f. This test is a more direct
version of the test introduced in that commit (which was distilled
from the failing test in the issue).

Change-Id: I2e716cd1000b49bde237f5da6d857e8983fe7e7a
Reviewed-on: https://go-review.googlesource.com/11423
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoreflect: test GC bits for slices
Austin Clements [Wed, 24 Jun 2015 15:25:28 +0000 (11:25 -0400)]
reflect: test GC bits for slices

Currently we test bitmap repetitions constructed by the compiler (for
small arrays) and repetitions performed by GC programs (large arrays
and reflect-constructed arrays), but we don't test dynamic repetitions
performed by the runtime for slice backing stores. Add tests that
parallel the array tests using slices.

Change-Id: If4425941a33cc5b20178dd819a7371e347e47585
Reviewed-on: https://go-review.googlesource.com/11422
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet/http: Fix test that occasionally fails
Todd Neal [Wed, 17 Jun 2015 14:31:08 +0000 (09:31 -0500)]
net/http: Fix test that occasionally fails

The consecutive calls to Head would sometimes get different
connections depending on if the readLoop had finished executing
and placed its connection on the idle list or not.  This change
ensures that readLoop completes before we make our second connection.

Fixes #11250

Change-Id: Ibdbc4d3d0aba0162452f6dec5928355a37dda70a
Reviewed-on: https://go-review.googlesource.com/11170
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodebug/elf: change R_ARM_REL32 to R_ARM_ABS32 in applyRelocationsARM
Ian Lance Taylor [Thu, 18 Jun 2015 01:28:50 +0000 (18:28 -0700)]
debug/elf: change R_ARM_REL32 to R_ARM_ABS32 in applyRelocationsARM

The original version of applyRelocationsARM was added in
http://golang.org/cl/7266.  It was added to fix the ARM build, which
had been broken by http://golang.org/cl/6780.

Before CL 6780, there was no relocation processing for ARM.  CL 6780
changed the code to require relocation processing for every supported
target.  CL 7266 fixed the ARM build by adding a relocation processing
function, but in fact no actual processing was done.  The code only
looked for REL32 relocations, but ARM debug info has no such
relocations.  The test case added in CL 7266 doesn't have any either.

This didn't matter because no relocation processing was required on
ARM, at least not for GCC-generated debug info.  GCC generates ABS32
relocations, but only against section symbols which have the value 0.
Therefore, the addition done by correct handling of ABS32 doesn't
change anything.

Clang, however, generates ABS32 relocations against local symbols,
some of which have non-zero values.  For those, we need to handle
ABS32 relocations.

This patch corrects the CL 7266 to look for ABS32 relocations instead
of REL32 relocations.  The code was already written to correctly
handle ABS32 relocations, it just mistakenly said REL32.

This is the ARM equivalent of https://golang.org/cl/96680045, which
fixed the same problem in the same way for clang on 386.

With this patch, clang-3.5 can be used to build Go on ARM GNU/Linux.

Fixes #8980.

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

9 years agocrypto/x509: don't panic when decrypting invalid PEM data.
Adam Langley [Sun, 14 Jun 2015 23:41:31 +0000 (16:41 -0700)]
crypto/x509: don't panic when decrypting invalid PEM data.

If an encrypted PEM block contained ciphertext that was not a multiple
of the block size then the code would panic. This change tests for that
case and returns an error.

Fixes #11215.

Change-Id: I7b700f99e20810c4f545519b1e9d766b4640e8a7
Reviewed-on: https://go-review.googlesource.com/11097
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocrypto/ecdsa, crypto/x509: update SEC1 ECC link in comments
Dmitry Savintsev [Fri, 26 Jun 2015 10:09:45 +0000 (12:09 +0200)]
crypto/ecdsa, crypto/x509: update SEC1 ECC link in comments

Updated the document URL in comments to avoid dead link
Old: http://www.secg.org/download/aid-780/sec1-v2.pdf
New: http://www.secg.org/sec1-v2.pdf

Change-Id: If13d0da4c0e7831b2bd92c45116c2412a2a965f5
Reviewed-on: https://go-review.googlesource.com/11550
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/compile: fix half multiply issue
Todd Neal [Tue, 23 Jun 2015 23:59:52 +0000 (18:59 -0500)]
cmd/compile: fix half multiply issue

In walkdiv, an OMUL node was created and passed to typecheck,
before the op was changed back to OHMUL.  In some instances,
the node that came back was an evaluated literal constant that
occurred with a full multiply.  The end result was a literal node
with a non-shifted value and an OHMUL op. This change causes code
to be generated for the OHMUL.

Fixes #11358
Fixes #11369

Change-Id: If42a98c6830d07fe065d5ca57717704fb8cfbd33
Reviewed-on: https://go-review.googlesource.com/11400
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/compile: add instrumentation of OKEY
Dmitry Vyukov [Wed, 24 Jun 2015 17:25:51 +0000 (19:25 +0200)]
cmd/compile: add instrumentation of OKEY

Instrument operands of OKEY.
Also instrument OSLICESTR. Previously it was not needed
because of preceeding bounds checks (which were instrumented).
But the preceeding bounds checks have disappeared.

Change-Id: I3b0de213e23cbcf5b8ef800abeded5eeeb3f8287
Reviewed-on: https://go-review.googlesource.com/11417
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoarchive/tar: fix round-trip attributes
Vincent Batts [Wed, 4 Mar 2015 17:29:16 +0000 (12:29 -0500)]
archive/tar: fix round-trip attributes

The issue was identified while
working with round trip FileInfo of the headers of hardlinks. Also,
additional test cases for hard link handling.
(review carried over from http://golang.org/cl/165860043)

Fixes #9027

Change-Id: I9e3a724c8de72eb1b0fbe0751a7b488894911b76
Reviewed-on: https://go-review.googlesource.com/6790
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodoc: suggest security@golang.org for reporting security issues
Andrew Gerrand [Thu, 25 Jun 2015 22:46:30 +0000 (08:46 +1000)]
doc: suggest security@golang.org for reporting security issues

Fixes #11402

Change-Id: I195575a54e30ad6d6b1d0996fde34c0163bbd2c2
Reviewed-on: https://go-review.googlesource.com/11530
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agodoc/go1.5.html: fix typo
Matt Layher [Fri, 26 Jun 2015 04:23:50 +0000 (00:23 -0400)]
doc/go1.5.html: fix typo

Change-Id: I193b416ac91b4fa9234d30a1c1c58b3f0a71f398
Reviewed-on: https://go-review.googlesource.com/11543
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
9 years agoFix several out of date references to 4g/5g/6g/8g/9g.
Aaron Jacobs [Tue, 23 Jun 2015 23:50:12 +0000 (09:50 +1000)]
Fix several out of date references to 4g/5g/6g/8g/9g.

Change-Id: Ifb8e4e13c7778a7c0113190051415e096f5db94f
Reviewed-on: https://go-review.googlesource.com/11390
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agospec: fix bare & in HTML
Rob Pike [Fri, 26 Jun 2015 01:11:45 +0000 (11:11 +1000)]
spec: fix bare & in HTML

No need to update the date; this is not a spec change.

Change-Id: I10a31234ed985c59e5d9b5328664a36661cef31e
Reviewed-on: https://go-review.googlesource.com/11531
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agomath: explain OEIS link
Andrew Gerrand [Thu, 25 Jun 2015 12:38:19 +0000 (22:38 +1000)]
math: explain OEIS link

Fixes #10236

Change-Id: Ife85513efda48af81c267b753da2ac7317cdfe75
Reviewed-on: https://go-review.googlesource.com/11479
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
9 years agonet/http: tolerate old buggy user agents, per RFC 2616 section 4.1
Brad Fitzpatrick [Thu, 25 Jun 2015 09:31:37 +0000 (11:31 +0200)]
net/http: tolerate old buggy user agents, per RFC 2616 section 4.1

Some old buggy browsers sent extra CRLF(s) after POST bodies. Skip
over them before reading subsequent requests.

Fixes #10876

Change-Id: I62eacf2b3e985caffa85aee3de39d8cd3548130b
Reviewed-on: https://go-review.googlesource.com/11491
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

9 years agomisc/cgo/testcshared: don't leave garbages after test
Mikio Hara [Thu, 25 Jun 2015 02:33:48 +0000 (11:33 +0900)]
misc/cgo/testcshared: don't leave garbages after test

Change-Id: I668b18b1e6901c59cf170e0c1cde9a3923c0cb13
Reviewed-on: https://go-review.googlesource.com/11472
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agodoc: first cut at prose for big changes in go1.5.html
Rob Pike [Thu, 25 Jun 2015 06:20:27 +0000 (16:20 +1000)]
doc: first cut at prose for big changes in go1.5.html

Change-Id: Ie2aba3d5069d88548414f7d76b9b6efb9acf0393
Reviewed-on: https://go-review.googlesource.com/11477
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime/race: fix test driver
Dmitry Vyukov [Wed, 24 Jun 2015 16:51:06 +0000 (18:51 +0200)]
runtime/race: fix test driver

At some point it silently stopped recognizing test output.
Meanwhile two tests degraded...

Change-Id: I90a0325fc9aaa16c3ef16b9c4c642581da2bb10c
Reviewed-on: https://go-review.googlesource.com/11416
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http: bound the number of bytes read seeking EOF in Handler's Body.Close
Brad Fitzpatrick [Wed, 24 Jun 2015 09:53:24 +0000 (11:53 +0200)]
net/http: bound the number of bytes read seeking EOF in Handler's Body.Close

If a client sent a POST with a huge request body, calling
req.Body.Close in the handler (which is implicit at the end of a
request) would end up consuming it all.

Put a cap on that, using the same threshold used elsewhere for similar
cases.

Fixes #9662

Change-Id: I26628413aa5f623a96ef7c2609a8d03c746669e5
Reviewed-on: https://go-review.googlesource.com/11412
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agodoc: add a missing space in func signature
Brad Fitzpatrick [Thu, 25 Jun 2015 03:33:51 +0000 (05:33 +0200)]
doc: add a missing space in func signature

Fixes #11383

Change-Id: I7ef0bb8b535ef513afdfcda19317ae4ff21f7166
Reviewed-on: https://go-review.googlesource.com/11490
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
9 years agofmt: handle negative width/prec when supplied as an argument
Todd Neal [Wed, 24 Jun 2015 12:48:35 +0000 (07:48 -0500)]
fmt: handle negative width/prec when supplied as an argument

Negative width arguments now left align the way a minus-width in the
format string aligns. The minus in the format string overrides the sign
of the argument as in C.

Precision behavior is modified to include an error if the argument is
negative.  This differs from a negative precision in a format string
which just terminates the format.

Additional checks for large magnitude widths and precisions are added to
make the runtime behavior (failure, but with different error messages),
more consistent between format string specified width/precision and
argument specified width/precision.

Fixes #11376

Change-Id: I8c7ed21088e9c18128a45d4c487c5ab9fafd13ef
Reviewed-on: https://go-review.googlesource.com/11405
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>

9 years agonet/http: sync Get and Head's documentation
Matthew Dempsky [Tue, 23 Jun 2015 18:36:57 +0000 (11:36 -0700)]
net/http: sync Get and Head's documentation

Instead of ambiguously referring to "the Client's CheckRedirect
function" in Head, describe the default behavior like for Get as users
aren't expected to change DefaultClient.CheckRedirect.

While here, use consistent punctuation for the Get and Head Client
method documentation.

Change-Id: I9e7046c73b0d0bc4de002234924d9e7c59aceb41
Reviewed-on: https://go-review.googlesource.com/11362
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agodoc: move go1.5.txt to go1.5.html
Rob Pike [Thu, 25 Jun 2015 04:36:49 +0000 (14:36 +1000)]
doc: move go1.5.txt to go1.5.html

Just a copy, other than adding a header, preparatory to preparing the release notes.

Change-Id: Ia4dc27777b96b1e898d9873e7d38e6e795057698
Reviewed-on: https://go-review.googlesource.com/11474
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http: document that Hijack's net.Conn might have left-over timeouts set
Brad Fitzpatrick [Wed, 24 Jun 2015 10:11:58 +0000 (12:11 +0200)]
net/http: document that Hijack's net.Conn might have left-over timeouts set

Fixes #8296

Change-Id: I71b330a0f961d46ae4ed81d5f3f5ce5bf708a29a
Reviewed-on: https://go-review.googlesource.com/11411
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/compile/internal/gc: make sure nonzero-sized objects have nonzero alignment
Keith Randall [Wed, 24 Jun 2015 14:23:40 +0000 (07:23 -0700)]
cmd/compile/internal/gc: make sure nonzero-sized objects have nonzero alignment

See issue #11354.

Change-Id: I6817d499e6c02e4a9c83f80bc66a2bee368a69ec
Reviewed-on: https://go-review.googlesource.com/11406
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet/http: don't always require certFile, keyFile in Server.ListenAndServerTLS
Brad Fitzpatrick [Wed, 24 Jun 2015 11:57:33 +0000 (13:57 +0200)]
net/http: don't always require certFile, keyFile in Server.ListenAndServerTLS

The ListenAndServerTLS function still requires the certFile and
keyFile, but the Server.ListenAndServerTLS method doesn't need to
require the certFile and keyFile if the Server.TLSConfig.Certificates
are already populated.

Fixes #8599

Change-Id: Id2e3433732f93e2619bfd78891f775d89f1d651e
Reviewed-on: https://go-review.googlesource.com/11413
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agonet/http: document that FormValue returns the empty string
Brad Fitzpatrick [Wed, 24 Jun 2015 10:34:06 +0000 (12:34 +0200)]
net/http: document that FormValue returns the empty string

Fixes #8137

Change-Id: Icd94bbe430a3ef333248425449b5fc678edb0343
Reviewed-on: https://go-review.googlesource.com/11410
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agotext/template: make zero Template work again
Russ Cox [Wed, 24 Jun 2015 15:11:51 +0000 (11:11 -0400)]
text/template: make zero Template work again

Fixes #11379.

Change-Id: Idbb5c3faad472b77e9867dd2d4551fef5e4ac5f1
Reviewed-on: https://go-review.googlesource.com/11421
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/compile: handle copy in escape analysis
Russ Cox [Wed, 24 Jun 2015 21:31:57 +0000 (17:31 -0400)]
cmd/compile: handle copy in escape analysis

Somehow we missed this!
Fixes #11387.

Change-Id: Ida08fe52eff7da2ef7765b4cf35a39a301420c43
Reviewed-on: https://go-review.googlesource.com/11460
Reviewed-by: David Chase <drchase@google.com>
9 years agoruntime: set m.procid always on Linux
Russ Cox [Mon, 22 Jun 2015 16:32:05 +0000 (12:32 -0400)]
runtime: set m.procid always on Linux

For debuggers and other program inspectors.

Fixes #9914.

Change-Id: I670728cea28c045e6eaba1808c550ee2f34d16ff
Reviewed-on: https://go-review.googlesource.com/11341
Reviewed-by: Austin Clements <austin@google.com>
9 years agogo/format: fix //line corner case when formatting statements
Didier Spezia [Sat, 20 Jun 2015 11:25:59 +0000 (11:25 +0000)]
go/format: fix //line corner case when formatting statements

The code formatting mechanism can be applied to partial Go code,
such as a list of statements. The statements are wrapped into a
function definition (to be parsed fine), and unwrapped after formatting.

When the statements contain //line annotations, it may fail,
because not all comments are flushed by the printer before the final '}'.
Formatting "\ta()\n//line :1" results in "\ta() }\n\n//line", which
is wrong.

Tweaked the wrapping/unwrapping code to make sure comments are flushed
before the '}'.

Fixes #11276

Change-Id: Id15c80279b0382ee9ed939cca1647f525c4929f5
Reviewed-on: https://go-review.googlesource.com/11282
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agoruntime/race: make test more robust
Dmitry Vyukov [Thu, 7 May 2015 09:33:45 +0000 (12:33 +0300)]
runtime/race: make test more robust

The test is flaky on builders lately. I don't see any issues other than
usage of very small sleeps. So increase the sleeps. Also take opportunity
to refactor the code.
On my machine this change significantly reduces failure rate with GOMAXPROCS=2.
I can't reproduce the failure with GOMAXPROCS=1.

Fixes #10726

Change-Id: Iea6f10cf3ce1be5c112a2375d51c13687a8ab4c9
Reviewed-on: https://go-review.googlesource.com/9803
Reviewed-by: Austin Clements <austin@google.com>
9 years agonet/url: validate ports in URLs and bytes after IPv6 literals
Brad Fitzpatrick [Wed, 24 Jun 2015 14:50:49 +0000 (16:50 +0200)]
net/url: validate ports in URLs and bytes after IPv6 literals

Fixes #11208

Change-Id: I35cc94129577b2a977fd35aafb0a5fb02c534a7c
Reviewed-on: https://go-review.googlesource.com/11414
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
9 years agonet: make LookupIP("1.2.3.4") behavior consistent
Russ Cox [Wed, 24 Jun 2015 12:39:44 +0000 (08:39 -0400)]
net: make LookupIP("1.2.3.4") behavior consistent

To date, the behavior has depended on whether we're using cgo and
in turn what the host resolver does. Most host resolvers will "resolve"
IP addresses, but the non-cgo pure Go path has not.
This CL makes resolution of IP addresses always work, even if we're not using cgo
and even if the host resolver does not "resolve" IP addresses.

Fixes #11335.

Change-Id: I19e82be968154d94904bb2f72e9c17893019a909
Reviewed-on: https://go-review.googlesource.com/11420
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agotext/scanner: add runnable example for package
Carlos C [Thu, 18 Jun 2015 18:58:50 +0000 (20:58 +0200)]
text/scanner: add runnable example for package

Change-Id: I42a952b04a56fb888fa7d5d9c2b56cbdd3434034
Reviewed-on: https://go-review.googlesource.com/11246
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/go: don't fetch from insecure repositories without -insecure
Andrew Gerrand [Tue, 5 May 2015 21:11:39 +0000 (07:11 +1000)]
cmd/go: don't fetch from insecure repositories without -insecure

Fixes #9637
Fixes #10120

Change-Id: I3728239089efb94d04cd4115c9f840afd7badeaf
Reviewed-on: https://go-review.googlesource.com/9715
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agospec: clarify effect of rounding of constant expressions
Robert Griesemer [Tue, 23 Jun 2015 21:17:59 +0000 (14:17 -0700)]
spec: clarify effect of rounding of constant expressions

Not a language change.

Fixes #11350.

Change-Id: I9b905f17d1ef2722cab4bae38a037270165c7d95
Reviewed-on: https://go-review.googlesource.com/11369
Reviewed-by: Rob Pike <r@golang.org>
9 years agogo/types: in string(x) conversions, x must be of integer type
Robert Griesemer [Tue, 23 Jun 2015 21:01:45 +0000 (14:01 -0700)]
go/types: in string(x) conversions, x must be of integer type

Port of https://go-review.googlesource.com/11365

Fixes #11357.

Change-Id: Icd20fa038696a8853d1d14477e1c1132938b3e2e
Reviewed-on: https://go-review.googlesource.com/11368
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agogo/types: better error message for certain unary/binary expression errors
Robert Griesemer [Tue, 23 Jun 2015 20:59:18 +0000 (13:59 -0700)]
go/types: better error message for certain unary/binary expression errors

Port of https://go-review.googlesource.com/11363.

Fixes #11367.

Change-Id: Ie0a82bcfab782c514d1947e7a6b190e286afd159
Reviewed-on: https://go-review.googlesource.com/11367
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agoruntime: fix heap bitmap repeating with large scalar tails
Austin Clements [Tue, 23 Jun 2015 15:35:21 +0000 (11:35 -0400)]
runtime: fix heap bitmap repeating with large scalar tails

When heapBitsSetType repeats a source bitmap with a scalar tail
(typ.ptrdata < typ.size), it lays out the tail upon reaching the end
of the source bitmap by simply increasing the number of bits claimed
to be in the incoming bit buffer. This causes later iterations to read
the appropriate number of zeros out of the bit buffer before starting
on the next repeat of the source bitmap.

Currently, however, later iterations of the loop continue to read bits
from the source bitmap *regardless of the number of bits currently in
the bit buffer*. The bit buffer can only hold 32 or 64 bits, so if the
scalar tail is large and the padding bits exceed the size of the bit
buffer, the read from the source bitmap on the next iteration will
shift the incoming bits into oblivion when it attempts to put them in
the bit buffer. When the buffer does eventually shift down to where
these bits were supposed to be, it will contain zeros. As a result,
words that should be marked as pointers on later repetitions are
marked as scalars, so the garbage collector does not trace them. If
this is the only reference to an object, it will be incorrectly freed.

Fix this by adding logic to drain the bit buffer down if it is large
instead of reading more bits from the source bitmap.

Fixes #11286.

Change-Id: I964432c4b9f1cec334fc8c3da0ff16460203feb6
Reviewed-on: https://go-review.googlesource.com/11360
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: document memory ordering for h_spans
Austin Clements [Tue, 23 Jun 2015 18:04:09 +0000 (14:04 -0400)]
runtime: document memory ordering for h_spans

h_spans can be accessed concurrently without synchronization from
other threads, which means it needs the appropriate memory barriers on
weakly ordered machines. It happens to already have the necessary
memory barriers because all accesses to h_spans are currently
protected by the heap lock and the unlocks happen in exactly the
places where release barriers are needed, but it's easy to imagine
that this could change in the future. Document the fact that we're
depending on the barrier implied by the unlock.

Related to issue #9984.

Change-Id: I1bc3c95cd73361b041c8c95cd4bb92daf8c1f94a
Reviewed-on: https://go-review.googlesource.com/11361
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
9 years agogo/types: add missing test for constant shifts
Robert Griesemer [Mon, 22 Jun 2015 23:01:17 +0000 (16:01 -0700)]
go/types: add missing test for constant shifts

Port of https://go-review.googlesource.com/11344 to std repo.

Fixes #11325.

Change-Id: I634beaf77cbaeb09de50aa1410e8c53fc37b19df
Reviewed-on: https://go-review.googlesource.com/11317
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agocmd/asm: fix shifts again, this time for sure
Rob Pike [Mon, 22 Jun 2015 22:40:40 +0000 (08:40 +1000)]
cmd/asm: fix shifts again, this time for sure

There are two conditions to worry about:

1) The shift count cannot be negative. Since the evaluator uses unsigned
arithmetic throughout, this means checking that the high bit of
the shift count is always off, which is done by converting to int64
and seeing if the result is negative.

2) For right shifts, the value cannot be negative. We don't want a
high bit in the value because right shifting a value depends on the
sign, and for clarity we always want unsigned shifts.

Next step is to build some testing infrastructure for the parser.

Change-Id: I4c46c79989d02c107fc64954403fc18613763f1d
Reviewed-on: https://go-review.googlesource.com/11326
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoimage/gif: set default loop count to 0 when app ext. is not present
Andrew Bonventre [Fri, 19 Jun 2015 17:29:58 +0000 (13:29 -0400)]
image/gif: set default loop count to 0 when app ext. is not present

It was otherwise not being preserved across
specific Decode->Encode->Decode calls.

Fixes #11287

Change-Id: I40602da7fa39ec67403bed52ff403f361c6171bb
Reviewed-on: https://go-review.googlesource.com/11256
Reviewed-by: Nigel Tao <nigeltao@golang.org>
9 years agotext/template: explain better the semantics of ParseFiles
Rob Pike [Tue, 23 Jun 2015 03:05:25 +0000 (13:05 +1000)]
text/template: explain better the semantics of ParseFiles

Documentation change only.

Fixes #11247.

Change-Id: Ib412de2d643292dbe42b56dee955bdb877aee81b
Reviewed-on: https://go-review.googlesource.com/11329
Reviewed-by: David Symonds <dsymonds@golang.org>
9 years agonet/http: Remove unused code
Todd Neal [Mon, 22 Jun 2015 13:31:38 +0000 (08:31 -0500)]
net/http: Remove unused code

This appears to be some legacy which is no longer used.

Change-Id: I469beb59a90853e8de910158f179b32f1aa14c7d
Reviewed-on: https://go-review.googlesource.com/11304
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Andrew Gerrand <adg@golang.org>

9 years agocmd/doc: fix copy/paste error in test
Rob Pike [Sat, 20 Jun 2015 19:10:05 +0000 (05:10 +1000)]
cmd/doc: fix copy/paste error in test

Some of those consts were supposed to be vars.

Caught by Ingo Oeser.

Change-Id: Ifc12e4a8ee61ebf5174e4ad923956c546dc096e2
Reviewed-on: https://go-review.googlesource.com/11296
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/asm: fix handling of negative shifts.
Rob Pike [Mon, 22 Jun 2015 20:23:04 +0000 (06:23 +1000)]
cmd/asm: fix handling of negative shifts.

The change that "fixed" LSH was incorrect, and the fix for RSH was poor.
Make both use a correct, simple test: if the 64-bit value as a signed
integer is negative, it's an error.

Really fixes #11278.

Change-Id: I72cca03d7ad0d64fd649fa33a9ead2f31bd2977b
Reviewed-on: https://go-review.googlesource.com/11325
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/vet: refer info about -printfuncs to the -printf flag
Rob Pike [Mon, 22 Jun 2015 20:12:11 +0000 (06:12 +1000)]
cmd/vet: refer info about -printfuncs to the -printf flag

And vice versa.

The flags are tightly coupled so make the connection clear.

Change-Id: I505f76be631ffa6e489a441c2f3c717aa09ec802
Reviewed-on: https://go-review.googlesource.com/11324
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoruntime: remove race and increase precision in pointer validation.
Rick Hudson [Mon, 22 Jun 2015 18:05:00 +0000 (14:05 -0400)]
runtime: remove race and increase precision in pointer validation.

This CL removes the single and racy use of mheap.arena_end outside
of the bookkeeping done in mHeap_init and mHeap_Alloc.
There should be no way for heapBitsForSpan to see a pointer to
an invalid span. This CL makes the check for this more precise by
checking that the pointer is between mheap_.arena_start and
mheap_.arena_used instead of mheap_.arena_end.

Change-Id: I1200b54353ee1eda002d92645fd8d26048600ceb
Reviewed-on: https://go-review.googlesource.com/11342
Reviewed-by: Austin Clements <austin@google.com>
9 years agonet/http: fix tests for recent URL.RawPath addition
Russ Cox [Mon, 22 Jun 2015 18:42:09 +0000 (14:42 -0400)]
net/http: fix tests for recent URL.RawPath addition

Change-Id: I35d20ed958c32d464b2c9d849403b6e3f99b6482
Reviewed-on: https://go-review.googlesource.com/11343
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: one more Map{Bits,Spans} before arena_used update
Austin Clements [Mon, 22 Jun 2015 15:18:23 +0000 (11:18 -0400)]
runtime: one more Map{Bits,Spans} before arena_used update

In order to avoid a race with a concurrent write barrier or garbage
collector thread, any update to arena_used must be preceded by mapping
the corresponding heap bitmap and spans array memory. Otherwise, the
concurrent access may observe that a pointer falls within the heap
arena, but then attempt to access unmapped memory to look up its span
or heap bits.

Commit d57c889 fixed all of the places where we updated arena_used
immediately before mapping the heap bitmap and spans, but it missed
the one place where we update arena_used and depend on later code to
update it again and map the bitmap and spans. This creates a window
where the original race can still happen. This commit fixes this by
mapping the heap bitmap and spans before this arena_used update as
well. This code path is only taken when expanding the heap reservation
on 32-bit over a hole in the address space, so these extra mmap calls
should have negligible impact.

Fixes #10212, #11324.

Change-Id: Id67795e6c7563eb551873bc401e5cc997aaa2bd8
Reviewed-on: https://go-review.googlesource.com/11340
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
9 years agoruntime: document relaxed access to arena_used
Austin Clements [Fri, 19 Jun 2015 16:29:42 +0000 (12:29 -0400)]
runtime: document relaxed access to arena_used

The unsynchronized accesses to mheap_.arena_used in the concurrent
part of the garbage collector look like a problem waiting to happen.
In fact, they are safe, but the reason is somewhat subtle and
undocumented. This commit documents this reasoning.

Related to issue #9984.

Change-Id: Icdbf2329c1aa11dbe2396a71eb5fc2a85bd4afd5
Reviewed-on: https://go-review.googlesource.com/11254
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
9 years agonet/url: add RawPath field, a hint at the desired encoding of Path
Russ Cox [Fri, 19 Jun 2015 21:04:56 +0000 (17:04 -0400)]
net/url: add RawPath field, a hint at the desired encoding of Path

Historically we have declined to try to provide real support for URLs
that contain %2F in the path, but they seem to be popping up more
often, especially in (arguably ill-considered) REST APIs that shoehorn
entire paths into individual path elements.

The obvious thing to do is to introduce a URL.RawPath field that
records the original encoding of Path and then consult it during
URL.String and URL.RequestURI. The problem with the obvious thing
is that it breaks backward compatibility: if someone parses a URL
into u, modifies u.Path, and calls u.String, they expect the result
to use the modified u.Path and not the original raw encoding.

Split the difference by treating u.RawPath as a hint: the observation
is that there are many valid encodings of u.Path. If u.RawPath is one
of them, use it. Otherwise compute the encoding of u.Path as before.

If a client does not use RawPath, the only change will be that String
selects a different valid encoding sometimes (the original passed
to Parse).

This ensures that, for example, HTTP requests use the exact
encoding passed to http.Get (or http.NewRequest, etc).

Also add new URL.EscapedPath method for access to the actual
escaped path. Clients should use EscapedPath instead of
reading RawPath directly.

All the old workarounds remain valid.

Fixes #5777.
Might help #9859.
Fixes #7356.
Fixes #8767.
Fixes #8292.
Fixes #8450.
Fixes #4860.
Fixes #10887.
Fixes #3659.
Fixes #8248.
Fixes #6658.
Reduces need for #2782.

Change-Id: I77b88f14631883a7d74b72d1cf19b0073d4f5473
Reviewed-on: https://go-review.googlesource.com/11302
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/go: fix test for issue 8181
Russ Cox [Fri, 19 Jun 2015 18:43:09 +0000 (14:43 -0400)]
cmd/go: fix test for issue 8181

The test was translated from shell incorrectly,
and it depended on having hg installed, which
may not be the case.

Moved repo to GitHub, updated code, and fixed
go list ... command to be expected to succeed.

Fixes test for #8181.

Change-Id: I7f3e8fb20cd16cac5ed24de6fd952003bc5e08d4
Reviewed-on: https://go-review.googlesource.com/11301
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoencoding/csv: add examples for package
Carlos C [Thu, 18 Jun 2015 07:37:06 +0000 (09:37 +0200)]
encoding/csv: add examples for package

Change-Id: I3463826aa760aa5984dec4fc043b95fd2a5120ac
Reviewed-on: https://go-review.googlesource.com/11240
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/asm: remove needless check for negative right shift
Rob Pike [Mon, 22 Jun 2015 01:02:44 +0000 (18:02 -0700)]
cmd/asm: remove needless check for negative right shift

In the parser, the shift value is always a uint64.

Change-Id: I9b50295a9f7d174ed1f6f9baf78ec0ed43db417f
Reviewed-on: https://go-review.googlesource.com/11322
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agonet/textproto: skip zero-length keys
Jeff R. Allen [Thu, 18 Jun 2015 12:28:54 +0000 (14:28 +0200)]
net/textproto: skip zero-length keys

A header of ": value" results in an empty key. Do not add
it to the headers, because RFC7230 (section 3.2) says that
field-names are tokens, which are one or more characters.

Fixes #11205.

Change-Id: I883be89da1489dc84f98523786b019d1d0169d46
Reviewed-on: https://go-review.googlesource.com/11242
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/asm: remove pointless check for negative uint
Rob Pike [Sat, 20 Jun 2015 23:10:39 +0000 (09:10 +1000)]
cmd/asm: remove pointless check for negative uint

Fixes #11278.

Change-Id: Ic46fda0f42cefedc3f6085c0e77e67616ce4955e
Reviewed-on: https://go-review.googlesource.com/11297
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/doc: add test for constructor, fix build
Rob Pike [Sat, 20 Jun 2015 10:28:46 +0000 (20:28 +1000)]
cmd/doc: add test for constructor, fix build

Most important: skip test on darwin/arm64 for unclear reasons.

First cut at the test missed this feature of go doc: when asking for
the docs for a type, include any function that looks like it constructs
a that type as a return value.

Change-Id: I124e7695e5d365e2b12524b541a9a4e6e0300fbc
Reviewed-on: https://go-review.googlesource.com/11295
Reviewed-by: Rob Pike <r@golang.org>
9 years agosyscall: skip non-root user namespace test if kernel forbids
Ian Lance Taylor [Fri, 19 Jun 2015 20:48:06 +0000 (13:48 -0700)]
syscall: skip non-root user namespace test if kernel forbids

Some Linux kernels apparently have a sysctl that prohibits
nonprivileged processes from creating user namespaces.  If we see a
failure for that reason, skip the test.

Fixes #11261.

Change-Id: I82dfcaf475eea4eaa387941373ce7165df4848ad
Reviewed-on: https://go-review.googlesource.com/11269
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
9 years agocmd/doc: fix test on nacl
Rob Pike [Fri, 19 Jun 2015 22:12:10 +0000 (08:12 +1000)]
cmd/doc: fix test on nacl

nacl is really giving a hard time. avoid all external dependencies in the test.
Worked with trybots, failed in the build. No explanation, but this should fix it.

TBR=rsc

Change-Id: Icb644286dbce88f17ee3d96ad90efba34a80a92d
Reviewed-on: https://go-review.googlesource.com/11291
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/doc: add test
Rob Pike [Fri, 19 Jun 2015 02:39:02 +0000 (12:39 +1000)]
cmd/doc: add test

Refactor main a bit to make it possible to run tests without an exec every time.
(Makes a huge difference in run time.)

Add a silver test. Not quite golden, since it looks for pieces rather than the
full output, and also includes tests for what should not appear.

Fixes #10920.

Change-Id: I6a4951cc14e61763379754a10b0cc3484d30c267
Reviewed-on: https://go-review.googlesource.com/11272
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Rob Pike <r@golang.org>

9 years agodoc: mention moderation delay in contributing docs
Josh Bleecher Snyder [Fri, 19 Jun 2015 20:55:38 +0000 (13:55 -0700)]
doc: mention moderation delay in contributing docs

This sometime worries new contributors.
Hopefully mentioning it here will help.

Fixes #11300.

Change-Id: Ica7f10d749731704ac6a2c39c7dcba389996011e
Reviewed-on: https://go-review.googlesource.com/11236
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/link/internal/ld, cmd/go: -buildmode=c-shared support for darwin/amd64
Srdjan Petrovic [Tue, 16 Jun 2015 17:07:45 +0000 (10:07 -0700)]
cmd/link/internal/ld, cmd/go: -buildmode=c-shared support for darwin/amd64

All of the heavy-lifting was done by minux@, with his external-linking support
for darwin/arm64: golang.org/cl/8781

Change-Id: I7c9fbc19246f418c065c92fb2c13c00026ff0f82
Reviewed-on: https://go-review.googlesource.com/11127
Run-TryBot: Srdjan Petrovic <spetrovic@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: fix build
Russ Cox [Fri, 19 Jun 2015 20:03:49 +0000 (16:03 -0400)]
cmd/go: fix build

Change-Id: Ia13d1fa450e88e278b81048b99686395ca474c99
Reviewed-on: https://go-review.googlesource.com/11259
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agomath/big: fix GCD in presence of aliasing
Robert Griesemer [Fri, 19 Jun 2015 19:50:38 +0000 (12:50 -0700)]
math/big: fix GCD in presence of aliasing

Fixes #11284.

Change-Id: I4ecc4e4cd3c1b3467b43e4ba9666ea6db5fb61a5
Reviewed-on: https://go-review.googlesource.com/11268
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agodoc/go1.5.txt: cmd/go: add vendoring support
Rob Pike [Fri, 19 Jun 2015 19:16:50 +0000 (05:16 +1000)]
doc/go1.5.txt: cmd/go: add vendoring support

Change-Id: I42cfdb389282478ce0e29436464f2048ed087429
Reviewed-on: https://go-review.googlesource.com/11290
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/go: add preliminary support for vendor directories
Russ Cox [Tue, 9 Jun 2015 19:09:12 +0000 (12:09 -0700)]
cmd/go: add preliminary support for vendor directories

When GO15VENDOREXPERIMENT=1 is in the environment,
this CL changes the resolution of import paths according to
the Go 1.5 vendor proposal:

If there is a source directory d/vendor, then,
when compiling a source file within the subtree rooted at d,
import "p" is interpreted as import "d/vendor/p" if that exists.

When there are multiple possible resolutions,
the most specific (longest) path wins.

The short form must always be used: no import path can
contain “/vendor/” explicitly.

Import comments are ignored in vendored packages.

The goal of these changes is to allow authors to vendor (copy) external
packages into their source trees without any modifications to the code.
This functionality has been achieved in tools like godep, nut, and gb by
requiring GOPATH manipulation. This alternate directory-based approach
eliminates the need for GOPATH manipulation and in keeping with the
go command's use of directory layout-based configuration.

The flag allows experimentation with these vendoring semantics once
Go 1.5 is released, without forcing them on by default. If the experiment
is deemed a success, the flag will default to true in Go 1.6 and then be
removed in Go 1.7.

For more details, see the original proposal by Keith Rarick at
https://groups.google.com/d/msg/golang-dev/74zjMON9glU/dGhnoi2IMzsJ.

Change-Id: I2c6527e777d14ac6dc43c53e4b3ff24f3279216e
Reviewed-on: https://go-review.googlesource.com/10923
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/compile: add -importmap option
Russ Cox [Tue, 9 Jun 2015 19:08:59 +0000 (12:08 -0700)]
cmd/compile: add -importmap option

The -importmap option takes an argument of the form old=new
and specifies that import "old" should be interpreted as if it said
import "new". The option may be repeated to specify multiple mappings.

This option is here to support the go command's new -vendor flag.

Change-Id: I31b4ed4249b549982a720bf61bb230462b33c59b
Reviewed-on: https://go-review.googlesource.com/10922
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: ensure GC sees type-safe memory on weak machines
Austin Clements [Mon, 15 Jun 2015 16:30:23 +0000 (12:30 -0400)]
runtime: ensure GC sees type-safe memory on weak machines

Currently its possible for the garbage collector to observe
uninitialized memory or stale heap bitmap bits on weakly ordered
architectures such as ARM and PPC. On such architectures, the stores
that zero newly allocated memory and initialize its heap bitmap may
move after a store in user code that makes the allocated object
observable by the garbage collector.

To fix this, add a "publication barrier" (also known as an "export
barrier") before returning from mallocgc. This is a store/store
barrier that ensures any write done by user code that makes the
returned object observable to the garbage collector will be ordered
after the initialization performed by mallocgc. No barrier is
necessary on the reading side because of the data dependency between
loading the pointer and loading the contents of the object.

Fixes one of the issues raised in #9984.

Change-Id: Ia3d96ad9c5fc7f4d342f5e05ec0ceae700cd17c8
Reviewed-on: https://go-review.googlesource.com/11083
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Martin Capitanio <capnm9@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoimage/gif: re-enable some invalid-palette tests.
Nigel Tao [Fri, 19 Jun 2015 05:39:11 +0000 (15:39 +1000)]
image/gif: re-enable some invalid-palette tests.

These tests were broken by https://go-review.googlesource.com/#/c/11227/
which fixed the LZW encoder to reject invalid input.

For TestNoPalette, the LZW encoder with a litWidth of 2 now rejects an
input byte of 128, so we change 128 to 3, as 3 <= (1<<2 - 1).

For TestPixelOutsidePaletteRange, the LZW encoder similarly rejects an
input byte of 255. Prior to golang.org/cl/11227, the encoder (again with
a litWidth of 2) accepted the 255 input byte, but masked it with (1<<2 -
1), so that the 255 test case was effectively the same as the 3 test
case. After that LZW CL, the 255 input byte is simply invalid, so we
remove it as a test case. The test still tests pixels outside of the
palette range, since 3 >= the length of the global palette, which is 2.

Change-Id: I50be9623ace016740e34801549c15f83671103eb
Reviewed-on: https://go-review.googlesource.com/11273
Reviewed-by: David Symonds <dsymonds@golang.org>
9 years agohtml: add examples to the functions
Carlos C [Wed, 17 Jun 2015 21:51:54 +0000 (23:51 +0200)]
html: add examples to the functions

Change-Id: I129d70304ae4e4694d9217826b18b341e3834d3c
Reviewed-on: https://go-review.googlesource.com/11201
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoruntime: rename cgocall_errno and asmcgocall_errno into cgocall and asmcgocall
Alex Brainman [Mon, 27 Apr 2015 07:32:23 +0000 (17:32 +1000)]
runtime: rename cgocall_errno and asmcgocall_errno into cgocall and asmcgocall

Change-Id: I5917bea8bb35b0e725dcc56a68f3a70137cfc180
Reviewed-on: https://go-review.googlesource.com/9387
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/cgo: static variables in the preamble may not be referenced
Ian Lance Taylor [Thu, 18 Jun 2015 01:03:16 +0000 (18:03 -0700)]
cmd/cgo: static variables in the preamble may not be referenced

This is a documentation fix that reflects the current reality.

Fixes #9673.

Change-Id: Ie436b277dfd1b68b13c67813d29c238d2c23b820
Reviewed-on: https://go-review.googlesource.com/11221
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/go: do not permit importing a main package
Ian Lance Taylor [Thu, 11 Jun 2015 19:04:30 +0000 (12:04 -0700)]
cmd/go: do not permit importing a main package

Fixes #4210.

Change-Id: Id981814a6e55a57403ce7a8ac45ab3ba081a3a86
Reviewed-on: https://go-review.googlesource.com/10925
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodoc: update gccgo docs for move of gofrontend to git
Ian Lance Taylor [Mon, 15 Jun 2015 18:13:57 +0000 (11:13 -0700)]
doc: update gccgo docs for move of gofrontend to git

This also includes some other minor updates to the documentation.

Change-Id: Iafab353727d7622d125b97fbdeaa81525b7a92aa
Reviewed-on: https://go-review.googlesource.com/11123
Reviewed-by: Yves Junqueira <yves.junqueira@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/go: format temporary Go files in testsuite
Ian Lance Taylor [Thu, 11 Jun 2015 19:32:11 +0000 (12:32 -0700)]
cmd/go: format temporary Go files in testsuite

Indent the temporary file source code embedded in go_test.go, so that
we don't have temporary Go code in the first column.

No real changes to the tests, just formatting.

Change-Id: I416b4a812c8db452ea61afe63a00989ec598c228
Reviewed-on: https://go-review.googlesource.com/10926
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodoc: clarify duplicate symbol condition in cgo
Andrey Petrov [Thu, 18 Jun 2015 19:43:01 +0000 (21:43 +0200)]
doc: clarify duplicate symbol condition in cgo

Spell out what will happen if a declaration and definition is included
in the same file, should help people who run into duplicate symbol
errors and search for relevant keywords.

This edit is based on opening issue #11263 erroneously.

Change-Id: I0645a9433b8668d2ede9b9a3f6550d802c26388b
Reviewed-on: https://go-review.googlesource.com/11247
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoos: fix nits found by vet
Mikio Hara [Fri, 19 Jun 2015 00:36:25 +0000 (09:36 +0900)]
os: fix nits found by vet

Change-Id: I97812575ff9c69301a5ce2e1c814b40e1da32a55
Reviewed-on: https://go-review.googlesource.com/11271
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agoos: skip TestStartProcess and TestHostname on android
Mikio Hara [Thu, 18 Jun 2015 01:44:52 +0000 (10:44 +0900)]
os: skip TestStartProcess and TestHostname on android

Updates #11268.

Change-Id: Ib0cabd1c1806e884df9e40f6a9a1cdecf2f76823
Reviewed-on: https://go-review.googlesource.com/11223
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agoimage/gif: return an error on missing palette
Jeff R. Allen [Wed, 17 Jun 2015 12:48:03 +0000 (14:48 +0200)]
image/gif: return an error on missing palette

A frame that tries to use the global palette when it has
not been given should result in an error, not an image
with no palette at all.

Fixes #11150.

Change-Id: If0c3a201a0ac977eee2b7a5dc68930c0c5787f40
Reviewed-on: https://go-review.googlesource.com/11064
Reviewed-by: Nigel Tao <nigeltao@golang.org>
9 years agoimage/gif: (temporarily) disable broken tests.
Nigel Tao [Thu, 18 Jun 2015 22:26:02 +0000 (08:26 +1000)]
image/gif: (temporarily) disable broken tests.

The compress/lzw encoder now rejects too-large input bytes, as of
https://go-review.googlesource.com/#/c/11227/, so we can't generate bad
GIFs programatically.

Change-Id: I0b32ce8e1f1776cd6997869db61e687430464e45
Reviewed-on: https://go-review.googlesource.com/11270
Reviewed-by: Nigel Tao <nigeltao@golang.org>
9 years agocompress/lzw: reject writing bytes that don't fit into litWidth.
Nigel Tao [Thu, 18 Jun 2015 04:45:38 +0000 (14:45 +1000)]
compress/lzw: reject writing bytes that don't fit into litWidth.

Fixes #11142.

Change-Id: Id772c4364c47776d6afe86b0939b9c6281e85edc
Reviewed-on: https://go-review.googlesource.com/11227
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agomath/big: refine Fibonacci example
Andrew Gerrand [Thu, 18 Jun 2015 07:01:55 +0000 (17:01 +1000)]
math/big: refine Fibonacci example

Change-Id: Id9e8c3f89e021b9f389ab3c8403e6a8450fa9f5f
Reviewed-on: https://go-review.googlesource.com/11231
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
9 years agocompress/lzw: mention relation between litWidth and input bytes
Jeff R. Allen [Wed, 17 Jun 2015 12:07:13 +0000 (14:07 +0200)]
compress/lzw: mention relation between litWidth and input bytes

Add sentences to the docs explaining the limit on input
bytes implicit in the choice of litWidth, and the fact that
compress and decompress litWidth must match.

Fixes #11142.

Change-Id: I20cfb4df35739f7bfeb50b92c78249df3d47942c
Reviewed-on: https://go-review.googlesource.com/11063
Reviewed-by: Nigel Tao <nigeltao@golang.org>
9 years agoruntime: reduce latency by aggressively ending mark phase
Rick Hudson [Mon, 1 Jun 2015 22:16:03 +0000 (18:16 -0400)]
runtime: reduce latency by aggressively ending mark phase

Some latency regressions have crept into our system over the past few
weeks. This CL fixes those by having the mark phase more aggressively
blacken objects so that the mark termination phase, a STW phase, has less
work to do. Three approaches were taken when the mark phase believes
it has no more work to do, ie all the work buffers are empty.
If things have gone well the mark phase is correct and there is
in fact little or no work. In that case the following items will
take very little time. If the mark phase is wrong this CL will
ferret that work out and give the mark phase a chance to deal with
it concurrently before mark termination begins.

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

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

Change-Id: I152285b48a7e56c5083a02e8e4485dd39c990492
Reviewed-on: https://go-review.googlesource.com/10590
Reviewed-by: Austin Clements <austin@google.com>
9 years agointernal/testenv: skip network tests only when -short is specified
Andrew Gerrand [Thu, 18 Jun 2015 07:33:29 +0000 (17:33 +1000)]
internal/testenv: skip network tests only when -short is specified

Change-Id: I157879f5204d543eb3fc81c212d563b146473ba8
Reviewed-on: https://go-review.googlesource.com/11232
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agomath/big: Add small complete example of big.Float usage
ALTree [Thu, 18 Jun 2015 15:22:25 +0000 (17:22 +0200)]
math/big: Add small complete example of big.Float usage

Updates #11241

Change-Id: I573be85d0cfcf410f6125ecd2be8a3d292c40bbb
Reviewed-on: https://go-review.googlesource.com/11245
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agogo/parser: document that parser accepts a wider language than specified
Robert Griesemer [Thu, 18 Jun 2015 18:55:19 +0000 (11:55 -0700)]
go/parser: document that parser accepts a wider language than specified

See also issue #11271.

Change-Id: I34175f46ce137b14ca483500f673b0f8ee1f2108
Reviewed-on: https://go-review.googlesource.com/11262
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agocmd/compile: provide better error when method called without receiver
Michael Matloob [Tue, 30 Dec 2014 00:59:55 +0000 (16:59 -0800)]
cmd/compile: provide better error when method called without receiver

When a method is called using the Type.Method(receiver, args...) syntax
without the receiver, or enough arguments, provide the more helpful
error message "not enough arguments in call to method expression
Type.Method" instead of the old message "not enough arguments in call
to Type.Method".

Fixes #8385

Change-Id: Id5037eb1ee5fa93687d4a6557b4a8233b29e9df2
Reviewed-on: https://go-review.googlesource.com/2193
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoall: switch to the new deprecation convention
Shenghou Ma [Mon, 18 May 2015 19:50:00 +0000 (15:50 -0400)]
all: switch to the new deprecation convention

While we're at it, move some misplaced comment blocks around.

Change-Id: I1847d7f1ca1dbb8e5de737203c4ed6c66e112508
Reviewed-on: https://go-review.googlesource.com/10188
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agotime: correct unrepresentable Unix time comment
Shenghou Ma [Wed, 20 May 2015 01:24:31 +0000 (21:24 -0400)]
time: correct unrepresentable Unix time comment

It's easy for someone who wants a time bigger than any
valid time to reach for time.Unix(1<<63-1, 0), so it
makes sense to explicit say such value is not valid.

Fixes #10906 (again).

Change-Id: If71e32472ae40d86c30e629b982406040a73c4c7
Reviewed-on: https://go-review.googlesource.com/10266
Reviewed-by: Russ Cox <rsc@golang.org>