]> Cypherpunks repositories - gostls13.git/log
gostls13.git
9 years agoruntime: on unexpected netpoll error, throw instead of looping
Ian Lance Taylor [Fri, 10 Jul 2015 22:28:01 +0000 (15:28 -0700)]
runtime: on unexpected netpoll error, throw instead of looping

The current code prints an error message and then tries to carry on.
This is not helpful for Go users: they see a message that means
nothing and that they can do nothing about.  In the only known case of
this message, in issue 11498, the best guess is that the netpoll code
went into an infinite loop.  Instead of doing that, crash the program.

Fixes #11498.

Change-Id: Idda3456c5b708f0df6a6b56c5bb4e796bbc39d7c
Reviewed-on: https://go-review.googlesource.com/12047
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
9 years agoruntime: fix aeshash of empty string
Keith Randall [Tue, 1 Sep 2015 19:53:15 +0000 (12:53 -0700)]
runtime: fix aeshash of empty string

Aeshash currently computes the hash of the empty string as
hash("", seed) = seed.  This is bad because the hash of a compound
object with empty strings in it doesn't include information about
where those empty strings were.  For instance [2]string{"", "foo"}
and [2]string{"foo", ""} might get the same hash.

Fix this by returning a scrambled seed instead of the seed itself.
With this fix, we can remove the scrambling done by the generated
array hash routines.

The test also rejects hash("", seed) = 0, if we ever thought
it would be a good idea to try that.

The fallback hash is already OK in this regard.

Change-Id: Iaedbaa5be8d6a246dc7e9383d795000e0f562037
Reviewed-on: https://go-review.googlesource.com/14129
Reviewed-by: jcd . <jcd@golang.org>
9 years agomath/big: Add small complete example of big.Rat usage
Alberto Donizetti [Sun, 6 Sep 2015 17:59:12 +0000 (19:59 +0200)]
math/big: Add small complete example of big.Rat usage

Updates #11241

Change-Id: If71f651f3b8aca432c91314358b93f195217d9ec
Reviewed-on: https://go-review.googlesource.com/14317
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agodoc: go1.6.txt: template.Funcs checks names
Rob Pike [Tue, 15 Sep 2015 16:12:31 +0000 (09:12 -0700)]
doc: go1.6.txt: template.Funcs checks names

Change-Id: I7de85034d499a9f859ab37d56463073f5cb29b35
Reviewed-on: https://go-review.googlesource.com/14592
Reviewed-by: Rob Pike <r@golang.org>
9 years agoasm: more early returns on errors
Rob Pike [Mon, 14 Sep 2015 18:48:19 +0000 (11:48 -0700)]
asm: more early returns on errors

More protection against random input bytes.

Fixes #12614.

Change-Id: Ie9f817de1376a10bb80b22ecee3bae4f1d26cc6c
Reviewed-on: https://go-review.googlesource.com/14563
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agotext/template: verify that names in FuncMap are valid identifiers
Rob Pike [Mon, 14 Sep 2015 18:27:20 +0000 (11:27 -0700)]
text/template: verify that names in FuncMap are valid identifiers

There was no verification in Funcs that the map had valid names,
which meant that the error could only be caught when parsing
the template that tried to use them. Fix this by validating the names
in Funcs and panicking before parsing if there is a bad name.

This is arguably an API change, since it didn't trigger a panic
before, but Funcs did already panic if the function itself was no
good, so I argue it's an acceptable change to add more sanity
checks.

Fixes #9685.

Change-Id: Iabf1d0602c49d830f3ed71ca1ccc7eb9a5521ff5
Reviewed-on: https://go-review.googlesource.com/14562
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/compile/internal/gc: cleaning lex.go
Marvin Stenger [Thu, 10 Sep 2015 22:03:19 +0000 (00:03 +0200)]
cmd/compile/internal/gc: cleaning lex.go

Cleaning along the way:
-convert variable types from int to bool
-remove unnecessary functions
-remove unnecessary type conversion
-remove unnecessary variable declarations
-transform struct{string,string} with lookup to map[string]string

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I259728fe4afd7f23b67f08fab856ce0abee57b21
Reviewed-on: https://go-review.googlesource.com/14435
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet: remove named parameters in Listener.Accept doc signature
Brad Fitzpatrick [Tue, 15 Sep 2015 03:58:21 +0000 (20:58 -0700)]
net: remove named parameters in Listener.Accept doc signature

They added no value.

Change-Id: I9e690379d2dfd983266de0ea5231f2b57c8b1517
Reviewed-on: https://go-review.googlesource.com/14568
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: skip external tests on linux/arm
Dave Cheney [Fri, 7 Aug 2015 01:15:54 +0000 (11:15 +1000)]
cmd/go: skip external tests on linux/arm

CL 13166 skipped external tests on freebsd/arm with the rationale
that the cmd/go tests are not architecture dependent.

This CL does the same for linux/arm to help linux/arm users who are
building Go on platforms like the Raspberry Pi where ./all.bash
frequently times out due to a lack of resources.

Change-Id: Iae1a25b63b74200da3f1b5637da0fa5c2dceeb83
Reviewed-on: https://go-review.googlesource.com/13342
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: provide room for first 4 syscall parameters in windows usleep2
Alex Brainman [Thu, 3 Sep 2015 07:48:21 +0000 (17:48 +1000)]
runtime: provide room for first 4 syscall parameters in windows usleep2

Windows amd64 requires all syscall callers to provide room for first
4 parameters on stack. We do that for all our syscalls, except inside
of usleep2. In https://codereview.appspot.com/7563043#msg3 rsc says:

"We don't need the stack alignment and first 4 parameters on amd64
because it's just a system call, not an ordinary function call."

He seems to be wrong on both counts. But alignment is already fixed.
Fix parameter space now too.

Fixes #12444

Change-Id: I66a2a18d2f2c3846e3aa556cc3acc8ec6240bea0
Reviewed-on: https://go-review.googlesource.com/14282
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agogo/parser: better error message for unexpected ',' in struct type
Robert Griesemer [Mon, 14 Sep 2015 19:01:04 +0000 (12:01 -0700)]
go/parser: better error message for unexpected ',' in struct type

Fixes #12437.

Change-Id: I5463970a6259527003eb0e12903a338cc78e0683
Reviewed-on: https://go-review.googlesource.com/14564
Reviewed-by: Chris Manghane <cmang@golang.org>
9 years agoruntime: unblock special glibc signals on each thread
Ian Lance Taylor [Fri, 4 Sep 2015 17:58:42 +0000 (10:58 -0700)]
runtime: unblock special glibc signals on each thread

Glibc uses some special signals for special thread operations.  These
signals will be used in programs that use cgo and invoke certain glibc
functions, such as setgid.  In order for this to work, these signals
need to not be masked by any thread.  Before this change, they were
being masked by programs that used os/signal.Notify, because it
carefully masks all non-thread-specific signals in all threads so that a
dedicated thread will collect and report those signals (see ensureSigM
in signal1_unix.go).

This change adds the two glibc special signals to the set of signals
that are unmasked in each thread.

Fixes #12498.

Change-Id: I797d71a099a2169c186f024185d44a2e1972d4ad
Reviewed-on: https://go-review.googlesource.com/14297
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agoruntime: minor clarifications of markroot
Austin Clements [Mon, 14 Sep 2015 18:28:09 +0000 (14:28 -0400)]
runtime: minor clarifications of markroot

This puts the _Root* indexes in a more friendly order and tweaks
markrootSpans to use a for-range loop instead of its own indexing.

Change-Id: I2c18d55c9a673ea396b6424d51ef4997a1a74825
Reviewed-on: https://go-review.googlesource.com/14548
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agoruntime: remove unused g.readyg field
Austin Clements [Mon, 3 Aug 2015 16:13:05 +0000 (12:13 -0400)]
runtime: remove unused g.readyg field

Commit 0e6a6c5 removed readyExecute a long time ago, but left behind
the g.readyg field that was used by readyExecute. Remove this now
unused field.

Change-Id: I41b87ad2b427974d256ec7a7f6d4bdc2ce8a13bb
Reviewed-on: https://go-review.googlesource.com/13111
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agoruntime: simplify mSpan_Sweep
Austin Clements [Tue, 21 Jul 2015 15:31:44 +0000 (11:31 -0400)]
runtime: simplify mSpan_Sweep

This is a cleanup following cc8f544, which was a minimal change to fix
issue #11617. This consolidates the two places in mSpan_Sweep that
update sweepgen. Previously this was necessary because sweepgen must
be updated before freeing the span, but we freed large spans early.
Now we free large spans later, so there's no need to duplicate the
sweepgen update. This also means large spans can take advantage of the
sweepgen sanity checking performed for other spans.

Change-Id: I23b79dbd9ec81d08575cd307cdc0fa6b20831768
Reviewed-on: https://go-review.googlesource.com/12451
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agoruntime: split marking of span roots into 128 subtasks
Austin Clements [Tue, 4 Aug 2015 14:45:29 +0000 (10:45 -0400)]
runtime: split marking of span roots into 128 subtasks

Marking of span roots can represent a significant fraction of the time
spent in mark termination. Simply traversing the span list takes about
1ms per GB of heap and if there are a large number of finalizers (for
example, for network connections), it may take much longer.

Improve the situation by splitting the span scan into 128 subtasks
that can be executed in parallel and load balanced by the markroots
parallel for. This lets the GC balance this job across the Ps.

A better solution is to do this during concurrent mark, or to improve
it algorithmically, but this is a simple change with a lot of bang for
the buck.

This was suggested by Rhys Hiltner.

Updates #11485.

Change-Id: I8b281adf0ba827064e154a1b6cc32d4d8031c03c
Reviewed-on: https://go-review.googlesource.com/13112
Reviewed-by: Keith Randall <khr@golang.org>
9 years agoruntime: fix hashing of trace stacks
Austin Clements [Thu, 13 Aug 2015 03:39:10 +0000 (23:39 -0400)]
runtime: fix hashing of trace stacks

The call to hash the trace stack reversed the "seed" and "size"
arguments to memhash and, hence, always called memhash with a 0 size,
which dutifully returned a hash value that depended only on the number
of PCs in the stack and not their values. As a result, all stacks were
put in to a very subset of the 8,192 buckets.

Fix this by passing these arguments in the correct order.

Change-Id: I67cd29312f5615c7ffa23e205008dd72c6b8af62
Reviewed-on: https://go-review.googlesource.com/13613
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
9 years agocmd/compiler/internal/gc: make Type.Copyto a []*Node
Håvard Haugen [Sun, 13 Sep 2015 20:58:12 +0000 (22:58 +0200)]
cmd/compiler/internal/gc: make Type.Copyto a []*Node

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

Change-Id: Ief4613cfb341172a85e3a894f44fb2bb308c7b55
Reviewed-on: https://go-review.googlesource.com/14554
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agodatabase/sql: fix typo
Andrew Gerrand [Mon, 14 Sep 2015 00:18:22 +0000 (00:18 +0000)]
database/sql: fix typo

Fixes #12606

Change-Id: Ib68cb20108ad35c3dd96e606649c4c8f9c0f085c
Reviewed-on: https://go-review.googlesource.com/14571
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile/internal/gc: clean up errcmp
Håvard Haugen [Wed, 2 Sep 2015 18:25:46 +0000 (20:25 +0200)]
cmd/compile/internal/gc: clean up errcmp

Change-Id: Id07811a25bf4aa3ff834e7254a3dfb04522b2926
Reviewed-on: https://go-review.googlesource.com/14174
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agoruntime: reduce pthread stack size in TestCgoCallbackGC
Dave Cheney [Thu, 20 Aug 2015 03:46:19 +0000 (13:46 +1000)]
runtime: reduce pthread stack size in TestCgoCallbackGC

Fixes #11959

This test runs 100 concurrent callbacks from C to Go consuming 100
operating system threads, which at 8mb a piece (the default on linux/arm)
would reserve over 800mb of address space. This would frequently
cause the test to fail on platforms with ~1gb of ram, such as the
raspberry pi.

This change reduces the thread stack allocation to 256kb, a number picked
at random, but at 1/32th the previous size, should allow the test to
pass successfully on all platforms.

Change-Id: I8b8bbab30ea7b2972b3269a6ff91e6fe5bc717af
Reviewed-on: https://go-review.googlesource.com/13731
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Martin Capitanio <capnm9@gmail.com>
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoruntime/cgo: explicitly link msvcrt on windows
Shenghou Ma [Thu, 10 Sep 2015 06:32:12 +0000 (02:32 -0400)]
runtime/cgo: explicitly link msvcrt on windows

It's because runtime links to ntdll, and ntdll exports a couple
incompatible libc functions. We must link to msvcrt first and
then try ntdll.

Fixes #12030.

Change-Id: I0105417bada108da55f5ae4482c2423ac7a92957
Reviewed-on: https://go-review.googlesource.com/14472
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile/internal/gc: avoid allocation in bnum
Dave Cheney [Fri, 11 Sep 2015 14:10:42 +0000 (00:10 +1000)]
cmd/compile/internal/gc: avoid allocation in bnum

Although bnum was being called with a Bits value, a limitation
of the escape analyser (golang/go#12588) meant that taking the
address of the Bits.b array in the range statement caused the
formal parameter to escape to the heap.

Passing the a pointer to a Bits, as with all the other Bits helper
methods avoids the allocation.

Before:
BenchmarkBnum1-4        20000000                69.6 ns/op            32 B/op          1 allocs/op

After:
BenchmarkBnum1-4        100000000               10.1 ns/op             0 B/op          0 allocs/op

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

9 years agospec: fix composite literal syntax to match prose
Robert Griesemer [Fri, 11 Sep 2015 23:20:23 +0000 (16:20 -0700)]
spec: fix composite literal syntax to match prose

Fixes #12578.

Change-Id: I257d70a67609463e24936bc1739285da154be2fe
Reviewed-on: https://go-review.googlesource.com/14531
Reviewed-by: Rob Pike <r@golang.org>
9 years agogo/printer: fix indentation of *ast.CallExpr parameters
Michal Bohuslávek [Wed, 26 Aug 2015 21:17:22 +0000 (23:17 +0200)]
go/printer: fix indentation of *ast.CallExpr parameters

The current version of go/printer formats the following code
like this:

foo.Bar().
Run(func() {
do()
}).
Set(map[string]interface{}{
"x": "three",
"y": 4,
}).
Run(
func() {
do()
},
)

This CL changes the go/printer behaviour to make the code look
like this.

foo.Bar().
Run(func() {
do()
}).
Set(map[string]interface{}{
"x": "three",
"y": 4,
}).
Run(
func() {
do()
},
)

Fixes #12066.

Change-Id: If0f525dae1a5d45f9ba40534dbb65715d7e8001b
Reviewed-on: https://go-review.googlesource.com/13928
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agoall: use one 'l' when cancelling everywhere except Solaris
Rob Pike [Fri, 11 Sep 2015 18:12:15 +0000 (11:12 -0700)]
all: use one 'l' when cancelling everywhere except Solaris

Fixes #11626.

Change-Id: I1b70c0844473c3b57a53d7cca747ea5cdc68d232
Reviewed-on: https://go-review.googlesource.com/14526
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoencoding/base64,xml: map/slice literals janitoring
Didier Spezia [Sun, 23 Aug 2015 13:00:01 +0000 (13:00 +0000)]
encoding/base64,xml: map/slice literals janitoring

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

Change-Id: I639cfb02b1f57dea4087863df3995889c9371529
Reviewed-on: https://go-review.googlesource.com/13837
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/doc: slice/map literals janitoring
Didier Spezia [Sun, 23 Aug 2015 12:32:18 +0000 (12:32 +0000)]
cmd/doc: slice/map literals janitoring

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

Change-Id: I7f38ef9fb528e2fd284bd0f190fbdf4a91956e55
Reviewed-on: https://go-review.googlesource.com/13834
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocrypto/x509: map/slice literals janitoring
Didier Spezia [Sun, 23 Aug 2015 12:49:16 +0000 (12:49 +0000)]
crypto/x509: map/slice literals janitoring

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

Change-Id: I4472c6003cf66e65f6e69050872ff95c96f01253
Reviewed-on: https://go-review.googlesource.com/13836
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoruntime,internal/trace: map/slice literals janitoring
Didier Spezia [Sun, 23 Aug 2015 13:18:14 +0000 (13:18 +0000)]
runtime,internal/trace: map/slice literals janitoring

Simplify slice/map literal expressions.
Caught with gofmt -d -s, fixed with gofmt -w -s
Checked that the result can still be compiled with Go 1.4.

Change-Id: I06bce110bb5f46ee2f45113681294475aa6968bc
Reviewed-on: https://go-review.googlesource.com/13839
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/compile/internal/ppc64: map/slice literals janitoring
Didier Spezia [Sun, 23 Aug 2015 12:03:05 +0000 (12:03 +0000)]
cmd/compile/internal/ppc64: map/slice literals janitoring

Simplify slice/map literal expressions.
Caught with gofmt -d -s, fixed with gofmt -w -s
Checked that the result can still be compiled with Go 1.4.

Change-Id: I201cd90fdfb8de2971c46ad7fce64111152b697e
Reviewed-on: https://go-review.googlesource.com/13832
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/asm: fix some fuzz bugs
Rob Pike [Thu, 10 Sep 2015 22:48:23 +0000 (15:48 -0700)]
cmd/asm: fix some fuzz bugs

One (12466) was an actual logic error, backing up when there was
nothing there. The others were due to continuing to process an
instruction when it cannot work.

Methodically stop assembling an instruction when it's not going to
succeed.

Fixes #12466.
Fixes #12467.
Fixes #12468.

Change-Id: I88c568f2b9c1a8408043b2ac5a78f5e2ffd62abd
Reviewed-on: https://go-review.googlesource.com/14498
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoarchive/zip: fixes unexpected EOF when reading archive
alexander demakin [Thu, 10 Sep 2015 16:43:20 +0000 (19:43 +0300)]
archive/zip: fixes unexpected EOF when reading archive

If comment of the archive contains data which looks like
a zip64 directory, the comment is parsed as an
actual directory header.
Commit adds some additional checks similar to the checks
in minizip library.

Fixes #12449

Change-Id: Ia0fc950e47b9c39f77d88401b9ca30100ca7c808
Reviewed-on: https://go-review.googlesource.com/14433
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/dist: re-enable GOARM auto-detection
Shenghou Ma [Thu, 10 Sep 2015 02:56:26 +0000 (22:56 -0400)]
cmd/dist: re-enable GOARM auto-detection

cmd/dist will re-exec itself to detect VFP support at run-time.

Fixes #9732, #12548.

Change-Id: I9ad0c5c7fa3e97bd79a32da372e1a962565bb3af
Reviewed-on: https://go-review.googlesource.com/3973
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agomath/big: use more direct formatting in ExampleRoundingMode, cosmetic changes
Robert Griesemer [Thu, 10 Sep 2015 20:06:46 +0000 (13:06 -0700)]
math/big: use more direct formatting in ExampleRoundingMode, cosmetic changes

Change-Id: I3d37391af2089881a5bd4d8f3e5d434b279c272e
Reviewed-on: https://go-review.googlesource.com/14490
Reviewed-by: Chris Manghane <cmang@golang.org>
9 years agomime: fix docs for WordDecoder.Decode
Brad Fitzpatrick [Thu, 10 Sep 2015 21:16:41 +0000 (14:16 -0700)]
mime: fix docs for WordDecoder.Decode

It was correct for an early version of the CL which introduced the
type, but later versions of the CL changed the behavior without
updating the documentation.

Fixes #12568

Change-Id: Ia4090a02ba122e9f8317ed86c4c9839ae2c539e0
Reviewed-on: https://go-review.googlesource.com/14496
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/internal/obj: map/slice literals janitoring
Didier Spezia [Sun, 23 Aug 2015 12:14:54 +0000 (12:14 +0000)]
cmd/internal/obj: map/slice literals janitoring

Simplify slice/map literal expressions.
Caught with gofmt -d -s, fixed with gofmt -w -s
Checked that the result can still be compiled with Go 1.4.

Change-Id: I0a6773d12200a7b43491f25f914335069a1fa5e8
Reviewed-on: https://go-review.googlesource.com/13833
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agostrconv: fix comment
Robert Griesemer [Thu, 10 Sep 2015 21:10:23 +0000 (14:10 -0700)]
strconv: fix comment

Fixes #12531.

Change-Id: I66dc7ac1b71b8f72b4a8f3ec18befa2607ef358b
Reviewed-on: https://go-review.googlesource.com/14494
Reviewed-by: Rob Pike <r@golang.org>
9 years agodoc: in go1.6.txt, small changes to fmt and time
Rob Pike [Thu, 10 Sep 2015 20:53:42 +0000 (13:53 -0700)]
doc: in go1.6.txt, small changes to fmt and time

Change-Id: Ie86b703407f0f655a4552dd6e03df5f263be43db
Reviewed-on: https://go-review.googlesource.com/14492
Reviewed-by: Rob Pike <r@golang.org>
9 years agofmt: allow any type in a format's width argument
Rob Pike [Thu, 10 Sep 2015 20:41:03 +0000 (13:41 -0700)]
fmt: allow any type in a format's width argument

The construction
fmt.Printf("%*d", n, 4)
reads the argument n as a width specifier to use when printing 4.
Until now, only strict int type was accepted here and it couldn't
be fixed because the fix, using reflection, broke escape analysis
and added an extra allocation in every Printf call, even those that
do not use this feature.

The compiler has been fixed, although I am not sure when exactly,
so let's fix Printf and then write

Fixes #10732.

Change-Id: I79cf0c4fadd876265aa39d3cb62867247b36ab65
Reviewed-on: https://go-review.googlesource.com/14491
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agotime: allow any one- or two-digit day of the month when parsing.
Rob Pike [Mon, 31 Aug 2015 22:45:47 +0000 (15:45 -0700)]
time: allow any one- or two-digit day of the month when parsing.

In Parse, one can now say Feb 31 or even Feb 99. This is easy
to explain, consistent with time.Date, and even maybe useful.

Fixes #12333.
Fixes #7268. (By disagreeing with it.)

Change-Id: I7b95c842528bed66933681c8b9cc00640fccfcb4
Reviewed-on: https://go-review.googlesource.com/14123
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agomath/big: add example for RoundingMode
Konstantin Shaposhnikov [Mon, 7 Sep 2015 14:31:04 +0000 (22:31 +0800)]
math/big: add example for RoundingMode

Updates #11241

Change-Id: I0614c5a9a7a4c399ad5d664f36c70c3210911905
Reviewed-on: https://go-review.googlesource.com/14356
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agocmd/internal/obj, cmd/link, runtime: a saner model for TLS on arm
Michael Hudson-Doyle [Tue, 1 Sep 2015 22:35:54 +0000 (10:35 +1200)]
cmd/internal/obj, cmd/link, runtime: a saner model for TLS on arm

this leaves lots of cruft behind, will delete that soon

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

9 years agocmd/objdump: skip TestDisasm* for mips64{,le}
Yao Zhang [Thu, 10 Sep 2015 11:13:28 +0000 (07:13 -0400)]
cmd/objdump: skip TestDisasm* for mips64{,le}

Disassembler for mips64 is not supported yet.

Change-Id: Ie923dd1e37fed47fc395b9d1cd9194e55020bee5
Reviewed-on: https://go-review.googlesource.com/14459
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/go: skip part of TestNoteReading for mips64{,le}
Yao Zhang [Thu, 10 Sep 2015 11:19:08 +0000 (07:19 -0400)]
cmd/go: skip part of TestNoteReading for mips64{,le}

Because external linking is not supported for now.

Change-Id: Icdd8f3cb3bfb781a990e529fce9129d91e98a9ec
Reviewed-on: https://go-review.googlesource.com/14457
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/vet: diagnose plain assignment in copylock detector
Russ Cox [Sun, 16 Aug 2015 00:50:17 +0000 (20:50 -0400)]
cmd/vet: diagnose plain assignment in copylock detector

It went out of its way to look for implicit assignments
but never checked explicit assignments.

This detects the root bug for #12099.

Change-Id: I6a6e774cc38749ea8be7cfd58ba6421247b67000
Reviewed-on: https://go-review.googlesource.com/13646
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/go: use RawToken to parse remote package metadata
Dave Cheney [Thu, 10 Sep 2015 05:50:47 +0000 (15:50 +1000)]
cmd/go: use RawToken to parse remote package metadata

CL 14315 broke the tests for parsing loosely formed remote package
metadata. Switch the parsing to use RawToken to recover the previous
behaviour that Token provided.

It could be argued that the parser should be stricter, but as remote
metadata has been readable with the parser for several years, it is
safer to change the parser to continue to accept the samples provided
in the test cases.

Change-Id: I2a3ba1757d3cff53b1a1c4386276955bb46cf8cd
Reviewed-on: https://go-review.googlesource.com/14482
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: convert typecheckdefstack to []*Node
Dave Cheney [Sun, 6 Sep 2015 23:59:43 +0000 (09:59 +1000)]
cmd/compile: convert typecheckdefstack to []*Node

This one of a set of changes to make the transition away from NodeList
easier by removing cases in which NodeList doesn't act semi-trivially like a
[]*Node.

This CL was originally prepared by Josh Bleecher Snyder <josharian@gmail.com>.

This change passes go build -toolexec 'toolstash -cmp' -a std.

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

9 years agoruntime: move arch1_$GOARCH.go into arch_$GOARCH.go
Shenghou Ma [Thu, 10 Sep 2015 03:31:10 +0000 (23:31 -0400)]
runtime: move arch1_$GOARCH.go into arch_$GOARCH.go

Update #12563.

Change-Id: Id87f8e53586accd662575c31961c39787268df7a
Reviewed-on: https://go-review.googlesource.com/14471
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agohash/*: document the byte order used by the Sum methods
Shenghou Ma [Thu, 3 Sep 2015 23:15:26 +0000 (19:15 -0400)]
hash/*: document the byte order used by the Sum methods

Fixes #12350.

Change-Id: I3dcb0e2190c11f83f15fb07cc637fead54f734f7
Reviewed-on: https://go-review.googlesource.com/14275
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoencoding/xml: Return SyntaxError for unmatched root start elements.
Robert Stepanek [Sat, 5 Sep 2015 14:06:43 +0000 (16:06 +0200)]
encoding/xml: Return SyntaxError for unmatched root start elements.

Currently, the xml.Decoder's Token routine returns successfully for
XML input that does not properly close root start elements (and any
unclosed descendants). For example, all the following inputs

    <root>
    <root><foo>
    <root><foo></foo>

cause Token to return with nil and io.EOF, indicating a successful
parse.

This change fixes that. It leaves the semantics of RawToken intact.

Fixes #11405

Change-Id: I6f1328c410cf41e17de0a93cf357a69f12c2a9f7
Reviewed-on: https://go-review.googlesource.com/14315
Reviewed-by: Nigel Tao <nigeltao@golang.org>
9 years agoA+C: automated updates
Brad Fitzpatrick [Wed, 9 Sep 2015 15:33:34 +0000 (08:33 -0700)]
A+C: automated updates

The previous automated updates only added missing entries for commits
since Go 1.4, with the assumption that we were caught up on things
prior to that. (Initially motivated by the existence of junk email
address jokes in the early git history, which I initially didn't want
to whitelist)

But it turns out we were missing lots of stuff, at least for subrepos
prior to N months ago.

This is an update with all subrepos updated, with no date
restrictions.

Change-Id: I2b5580ae4f89ae9ba7eaa336cc54ce6d606c5379
Reviewed-on: https://go-review.googlesource.com/14409
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agohtml/template: preserve attr in stateBeforeValue
Nodir Turakulov [Sat, 5 Sep 2015 01:07:55 +0000 (18:07 -0700)]
html/template: preserve attr in stateBeforeValue

Context: #12149. The problem there is that contents of
<script type="text/template"> are treated as JS, and thus // is treated
as regexp.

Preserve context.attr while we are in the attribute, in particular in
stateBeforeValue, so we have attr when reading attr value.

Next CL will actually fix the bug.

Change-Id: I99add2237b0885ecdcc08b4f7c25d0af99173e53
Reviewed-on: https://go-review.googlesource.com/14335
Reviewed-by: Rob Pike <r@golang.org>
9 years agotext/template: perform value validity checks
Nodir Turakulov [Sun, 6 Sep 2015 06:16:49 +0000 (23:16 -0700)]
text/template: perform value validity checks

Check reflect.Value.IsValid() before calling other reflect.Value methods
that panic on zero values.

Added tests for cases with untyped nils. They panicked without these fixes.

Removed a TODO.

Fixes #12356

Change-Id: I9b5cbed26db09a0a7c36d99a93f8b9729899d51e
Reviewed-on: https://go-review.googlesource.com/14340
Reviewed-by: Rob Pike <r@golang.org>
9 years agoruntime: on map update, don't overwrite key if we don't need to.
Keith Randall [Mon, 8 Jun 2015 15:42:28 +0000 (08:42 -0700)]
runtime: on map update, don't overwrite key if we don't need to.

Keep track of which types of keys need an update and which don't.

Strings need an update because the new key might pin a smaller backing store.
Floats need an update because it might be +0/-0.
Interfaces need an update because they may contain strings or floats.

Fixes #11088

Change-Id: I9ade53c1dfb3c1a2870d68d07201bc8128e9f217
Reviewed-on: https://go-review.googlesource.com/10843
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agosyscall: implement getwd on Solaris
Shawn Walker-Salas [Fri, 4 Sep 2015 23:53:19 +0000 (16:53 -0700)]
syscall: implement getwd on Solaris

In support of the changes required for #8609, it was suggested that
syscall.getwd() be updated to work on Solaris first since the runtime
uses it and today it's unimplemented.

Fixes #12507

Change-Id: Ifb58ac9db8540936d5685c2c58bdc465dbc836cb
Reviewed-on: https://go-review.googlesource.com/14420
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
9 years agocmd/doc: the builtin package should always show unexported symbols
Rob Pike [Wed, 9 Sep 2015 18:01:01 +0000 (11:01 -0700)]
cmd/doc: the builtin package should always show unexported symbols

Trivial fix: set unexported=true for builtin.
Godoc itself has a similar hack.

Fixes #12541

Change-Id: Ib701f867d117931eb6ec6de223941b52eb6cd4a7
Reviewed-on: https://go-review.googlesource.com/14441
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agotime: fixed handling of "5" in Format's layout string
Marvin Stenger [Wed, 2 Sep 2015 22:39:53 +0000 (00:39 +0200)]
time: fixed handling of "5" in Format's layout string

Fixes #12440

Change-Id: Iead77fe34d986cfd5c16bac671fe13c8d012a754
Reviewed-on: https://go-review.googlesource.com/14178
Reviewed-by: Rob Pike <r@golang.org>
9 years agodoc: go1.6.txt: text/template and space trimming
Rob Pike [Wed, 9 Sep 2015 17:54:33 +0000 (10:54 -0700)]
doc: go1.6.txt: text/template and space trimming

Change-Id: I33c0425361c98b175d8d87e0f7e44946bfb3e3fa
Reviewed-on: https://go-review.googlesource.com/14440
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/compile/internal/gc: handle weird map literals in key dedup
Keith Randall [Tue, 8 Sep 2015 20:41:51 +0000 (13:41 -0700)]
cmd/compile/internal/gc: handle weird map literals in key dedup

We compute whether two keys k1 and k2 in a map literal are duplicates by
constructing the expression OEQ(k1, k2) and calling the constant
expression evaluator on that expression, then extracting the boolean
result.

Unfortunately, the constant expression evaluator can fail for various
reasons.  I'm not really sure why it is dying in the case of 12536, but
to be safe we should use the result only if we get a constant back (if
we get a constant back, it must be boolean).  This probably isn't a
permanent fix, but it should be good enough for 1.5.2.

A permanent fix would be to ensure that the constant expression
evaluator can always work for map literal keys, and if not the compiler
should generate an error saying that the key isn't a constant (or isn't
comparable to some specific other key).

This patch has the effect of allowing the map literal to compile when
constant eval of the OEQ fails.  If the keys are really equal (which the
map impl will notice at runtime), one will overwrite the other in the
resulting map.  Not great, but better than a compiler crash.

Fixes #12536

Change-Id: Ic151a5e3f131c2e8efa0c25c9218b431c55c1b30
Reviewed-on: https://go-review.googlesource.com/14400
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile/internal/gc: convert fields of TempVar to bool
Marvin Stenger [Tue, 8 Sep 2015 18:04:43 +0000 (20:04 +0200)]
cmd/compile/internal/gc: convert fields of TempVar to bool

Convert two fields of struct TempVar in popt.go from uint8 to bool.

This change passes go build -toolexec 'toolstash -cmp' -a std.

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

9 years agocmd/compile/internal/gc: convert fields of Symlink to bool
Marvin Stenger [Tue, 8 Sep 2015 18:29:10 +0000 (20:29 +0200)]
cmd/compile/internal/gc: convert fields of Symlink to bool

Convert two fields of struct Symlink in subr.go from uint8 to bool.

This change passes go build -toolexec 'toolstash -cmp' -a std.

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

9 years agodoc: fix typo in go1.6.txt
Rob Pike [Wed, 9 Sep 2015 05:28:50 +0000 (22:28 -0700)]
doc: fix typo in go1.6.txt

Change-Id: I3bf1862c304ff08bfb87f84b6ccbb50204225244
Reviewed-on: https://go-review.googlesource.com/14407
Reviewed-by: Rob Pike <r@golang.org>
9 years agotext/template: provide a way to trim leading and trailing space between actions
Rob Pike [Tue, 8 Sep 2015 21:58:12 +0000 (14:58 -0700)]
text/template: provide a way to trim leading and trailing space between actions

Borrowing a suggestion from the issue listed below, we modify the lexer to
trim spaces at the beginning (end) of a block of text if the action immediately
before (after) is marked with a minus sign. To avoid parsing/lexing ambiguity,
we require an ASCII space between the minus sign and the rest of the action.
Thus:

{{23 -}}
<
{{- 45}}

produces the output
23<45

All the work is done in the lexer. The modification is invisible to the parser
or any outside package (except I guess for noticing some gaps in the input
if one tracks error positions). Thus it slips in without worry in text/template
and html/template both.

Fixes long-requested issue #9969.

Change-Id: I3774be650bfa6370cb993d0899aa669c211de7b2
Reviewed-on: https://go-review.googlesource.com/14391
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoall: minor documentation tweaks for constants
Konstantin Shaposhnikov [Tue, 8 Sep 2015 11:26:02 +0000 (19:26 +0800)]
all: minor documentation tweaks for constants

Block comments appear after a block in the HTML documentation generated by
godoc. Words like "following" should be avoided.

Change-Id: Iedfad67f4b8b9c84f128b98b9b06fa76919af388
Reviewed-on: https://go-review.googlesource.com/14357
Reviewed-by: Rob Pike <r@golang.org>
9 years agoimage/png: reject zero-width and zero-height images.
Nigel Tao [Wed, 9 Sep 2015 00:57:40 +0000 (10:57 +1000)]
image/png: reject zero-width and zero-height images.

http://www.w3.org/TR/PNG/#11IHDR says that "Zero is an invalid value".

This change only affects the decoder. The encoder already checks
non-positive instead of negative.

Fixes #12545.

Change-Id: Iba40e1a2f4e0eec8b2fbcd3bbdae886311434da7
Reviewed-on: https://go-review.googlesource.com/14411
Reviewed-by: Rob Pike <r@golang.org>
9 years agocompress/lzw: tidy up some flush calls.
Nigel Tao [Tue, 30 Jun 2015 04:02:04 +0000 (14:02 +1000)]
compress/lzw: tidy up some flush calls.

Change-Id: Ie7368188ad4a970a82c140962cf97347d24f0331
Reviewed-on: https://go-review.googlesource.com/14410
Reviewed-by: David Symonds <dsymonds@golang.org>
9 years agocmd/dist, cmd/link: force external linking for shared libs on arm
Michael Hudson-Doyle [Tue, 1 Sep 2015 02:07:14 +0000 (14:07 +1200)]
cmd/dist, cmd/link: force external linking for shared libs on arm

Also run testcshared.

Fixes #12425

Change-Id: I5baea8d772d3462f945aab96260b4197dbb20c0a
Reviewed-on: https://go-review.googlesource.com/14143
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: add high-level description of how stack barriers work
Austin Clements [Sat, 29 Aug 2015 04:35:25 +0000 (00:35 -0400)]
runtime: add high-level description of how stack barriers work

Change-Id: I6affe75b5fa9dbf513c16200bff4fd7aa5f3a985
Reviewed-on: https://go-review.googlesource.com/14051
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agoruntime: move stack barrier code to its own file
Austin Clements [Sat, 29 Aug 2015 03:15:41 +0000 (23:15 -0400)]
runtime: move stack barrier code to its own file

Currently the stack barrier code is mixed in with the mark and scan
code. Move all of the stack barrier related functions and variables to
a new dedicated source file. There are no code modifications.

Change-Id: I604603045465ef8573b9f88915d28ab6b5910903
Reviewed-on: https://go-review.googlesource.com/14050
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agodoc: document go1.5.1
Chris Broadfoot [Wed, 9 Sep 2015 00:47:25 +0000 (17:47 -0700)]
doc: document go1.5.1

Change-Id: I56452559acc432e06c15844d3f25dbeacafe77b7
Reviewed-on: https://go-review.googlesource.com/14402
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/internal/obj: remove unused code
Dave Cheney [Mon, 7 Sep 2015 06:21:25 +0000 (16:21 +1000)]
cmd/internal/obj: remove unused code

Following on from CL 14350, remove the remaining dead code from data.go.

Also leave a TODO to be addressed later (with a unit test) to reduce
the overhead of SymGrow.

Change-Id: Iebad775b1280b54b89e87a3a073ca8af19a8bfba
Reviewed-on: https://go-review.googlesource.com/14359
Run-TryBot: Dave Cheney <dave@cheney.net>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/internal/ld: put read-only relocated data into .data.rel.ro when making a shared...
Michael Hudson-Doyle [Thu, 21 May 2015 01:07:19 +0000 (13:07 +1200)]
cmd/internal/ld: put read-only relocated data into .data.rel.ro when making a shared object

Currently Go produces shared libraries that cannot be shared between processes
because they have relocations against the text segment (not text section). This
fixes this by moving some data to sections with magic names recognized by the
static linker.

The change in genasmsym to add STYPELINK to the switch should fix things on
darwin/arm64.

Fixes #10914
Updates #9210

Change-Id: Iab4a6678dd04cec6114e683caac5cf31b1063309
Reviewed-on: https://go-review.googlesource.com/14306
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile/internal/mips64: copy cmd/compile/internal/ppc64
Shenghou Ma [Sun, 6 Sep 2015 00:32:40 +0000 (20:32 -0400)]
cmd/compile/internal/mips64: copy cmd/compile/internal/ppc64

Just a mechanical copy, no code changes.
This is to reduce code difference when adding the mips64 port.

Change-Id: Id06e975f414a7b09f4827167b30813b228a3bfaf
Reviewed-on: https://go-review.googlesource.com/14324
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/internal/obj/mips: copy cmd/internal/obj/ppc64
Shenghou Ma [Sun, 6 Sep 2015 00:27:00 +0000 (20:27 -0400)]
cmd/internal/obj/mips: copy cmd/internal/obj/ppc64

Just a mechanical copy with filename renames, no code changes.
This is to reduce code difference when adding the mips64 port.

Change-Id: Id06e975f414a7b09f4827167b30813b228a3bfae
Reviewed-on: https://go-review.googlesource.com/14323
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/internal/obj: remove dead code and small cleanups
Michael Hudson-Doyle [Mon, 7 Sep 2015 03:00:52 +0000 (15:00 +1200)]
cmd/internal/obj: remove dead code and small cleanups

Change-Id: I88fa0cc245a2141af04acced8716e08b1133abd1
Reviewed-on: https://go-review.googlesource.com/14350
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoAUTHORS: add Oracle as corporate copyright holder
Brad Fitzpatrick [Tue, 8 Sep 2015 17:28:22 +0000 (10:28 -0700)]
AUTHORS: add Oracle as corporate copyright holder

Some commits made by Aram from his personal email address are
actually copyright Oracle:

a77fcb3 net: fix comment in sendFile
b0e71f4 net: link with networking libraries when net package is in use
92e959a syscall, net: use sendfile on Solaris
db8d5b7 net: try to fix setKeepAlivePeriod on Solaris
fe5ef5c runtime, syscall: link Solaris binaries directly instead of using dlopen/dlsym
2b90c3e go/build: enable cgo by default on solaris/amd64
2d18ab7 doc/progs: disable cgo tests that use C.Stdout on Solaris
2230e9d misc/cgo: add various solaris build lines
649c7b6 net: add cgo support for Solaris
24396da os/user: small fixes for Solaris
121489c runtime/cgo: add cgo support for solaris/amd64
83b25d9 cmd/ld: make .rela and .rela.plt sections contiguous
c94f1f7 runtime: always load address of libcFunc on Solaris
e481aac cmd/6l: use .plt instead of .got on Solaris

See bug for clarification.

Fixes #12452

Change-Id: I0aeb1b46c0c7d09c5c736e383ecf40240d2cf85f
Reviewed-on: https://go-review.googlesource.com/14380
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agodoc: mention that go install removes binaries built by go build
Rob Pike [Tue, 8 Sep 2015 17:58:21 +0000 (10:58 -0700)]
doc: mention that go install removes binaries built by go build

Fixes #12288.

For inclusion in the 1.5.1 release.

Change-Id: I9354b7eaa76000498465c4a5cbab7246de9ecb7c
Reviewed-on: https://go-review.googlesource.com/14382
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agodoc: strconv.QuoteToGraphic in go1.6.txt
Rob Pike [Tue, 8 Sep 2015 17:39:03 +0000 (10:39 -0700)]
doc: strconv.QuoteToGraphic in go1.6.txt

Change-Id: I2f05d0b62deb5d7d0886f6fc5af5e7b79792efba
Reviewed-on: https://go-review.googlesource.com/14381
Reviewed-by: Rob Pike <r@golang.org>
9 years agostrconv: add QuoteToGraphic and friends
Rob Pike [Wed, 2 Sep 2015 22:08:24 +0000 (15:08 -0700)]
strconv: add QuoteToGraphic and friends

This version of quoting allows runes in category Zs, such as the
ideographic space characters, to be passed through unquoted.

Still to do (maybe): A way to access this from Printf.

Updates #11511.

Change-Id: I3bae84b1aa0bc1b885318d3f67c5f451099a2a5a
Reviewed-on: https://go-review.googlesource.com/14184
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
9 years agocmd/compile/internal/gc: convert fields of Type to bool
Marvin Stenger [Tue, 8 Sep 2015 01:51:30 +0000 (03:51 +0200)]
cmd/compile/internal/gc: convert fields of Type to bool

Convert some fields of struct Type in go.go from uint8 to bool.

This change passes go build -toolexec 'toolstash -cmp' -a std.

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

9 years agocmd/compile/internal/gc: convert fields of Pkg to bool
Marvin Stenger [Tue, 8 Sep 2015 03:46:31 +0000 (05:46 +0200)]
cmd/compile/internal/gc: convert fields of Pkg to bool

Convert Pkg.Imported, Pkg.Exported, Pkg.Direct from uint8/int8/int8 to bool.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I67a71f1186ff9737c03eca413f7d35d8a79ebc9b
Reviewed-on: https://go-review.googlesource.com/14371
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile/internal/gc: unexport and make Hasdefer a bool
Håvard Haugen [Mon, 7 Sep 2015 20:19:30 +0000 (22:19 +0200)]
cmd/compile/internal/gc: unexport and make Hasdefer a bool

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

Change-Id: I804ee4252fa9be78cb277faf7f467e6c9cfdd4a6
Reviewed-on: https://go-review.googlesource.com/14319
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile/internal/gc: remove unused field Type.Siggen
Marvin Stenger [Tue, 8 Sep 2015 03:54:22 +0000 (05:54 +0200)]
cmd/compile/internal/gc: remove unused field Type.Siggen

Remove unused field Type.Siggen in go.go.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: Ia61fe65a226c913fbf4a11a71d7453c56aa46c0e
Reviewed-on: https://go-review.googlesource.com/14372
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agocmd/compile: make importlist a []*Node instead of *NodeList
Håvard Haugen [Sun, 6 Sep 2015 20:38:49 +0000 (22:38 +0200)]
cmd/compile: make importlist a []*Node instead of *NodeList

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

Change-Id: Ica62765d3c1ef052afed34da1b3ac3f80646cc55
Reviewed-on: https://go-review.googlesource.com/14318
Reviewed-by: Dave Cheney <dave@cheney.net>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile/internal/gc: convert Type.Broke into a bool
Dave Cheney [Mon, 7 Sep 2015 00:37:26 +0000 (10:37 +1000)]
cmd/compile/internal/gc: convert Type.Broke into a bool

Convert Type.Broke from a uint8 to a boolean

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I44e7548c71b00467e36576bdf62933c42555a21a
Reviewed-on: https://go-review.googlesource.com/14307
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Håvard Haugen <havard.haugen@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile/internal/gc: convert Label.Used to bool
Dave Cheney [Mon, 7 Sep 2015 01:11:14 +0000 (11:11 +1000)]
cmd/compile/internal/gc: convert Label.Used to bool

Convert Label.Used to a boolean. Also move the field to the
bottom of the struct to avoid padding.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: If09ee92f9d54dce807e7b862cf771005daed810d
Reviewed-on: https://go-review.googlesource.com/14308
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: remove unused FUNCDATA_DeadValueMaps
Michael Hudson-Doyle [Mon, 7 Sep 2015 03:36:56 +0000 (15:36 +1200)]
runtime: remove unused FUNCDATA_DeadValueMaps

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

9 years agocmd/compile/internal: some janitoring
Marvin Stenger [Sun, 6 Sep 2015 14:59:57 +0000 (16:59 +0200)]
cmd/compile/internal: some janitoring

Nicer swaps, loops (removed tmp variables). Use of bool instead of int.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I541904c74b57297848decc51a8a4913a8eca4af3
Reviewed-on: https://go-review.googlesource.com/14316
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: add stub sigreturn on arm
Michael Hudson-Doyle [Wed, 2 Sep 2015 09:52:19 +0000 (21:52 +1200)]
runtime: add stub sigreturn on arm

When building a shared library, all functions that are declared must actually
be defined.

Change-Id: I1488690cecfb66e62d9fdb3b8d257a4dc31d202a
Reviewed-on: https://go-review.googlesource.com/14187
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agocmd/dist: fix mkzversion to produce gofmt'd output
Dave Cheney [Mon, 7 Sep 2015 06:04:01 +0000 (16:04 +1000)]
cmd/dist: fix mkzversion to produce gofmt'd output

Fix mkzversion to produce correctly formatted runtime/zversion.go.

Change-Id: Ie6bcd361a2f2e390b7f6c4980fcae2c41bb7e52f
Reviewed-on: https://go-review.googlesource.com/14355
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/compile: convert typecheck_stack to []*Node
Dave Cheney [Sat, 5 Sep 2015 04:43:50 +0000 (14:43 +1000)]
cmd/compile: convert typecheck_stack to []*Node

This one of a set of changes to make the transition away from NodeList
easier by removing cases in which NodeList doesn't act semi-trivially like a
[]*Node.

This CL was originally prepared by Josh Bleecher Snyder <josharian@gmail.com>.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I4d041b343952f4a31f3150fd70669e08fcaa74f8
Reviewed-on: https://go-review.googlesource.com/14305
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/asm: fix another infinite loop in register list parser
Didier Spezia [Sat, 5 Sep 2015 11:28:33 +0000 (11:28 +0000)]
cmd/asm: fix another infinite loop in register list parser

The code parsing register lists involves an inner loop on
each range defined by the lo,hi bounds. The condition on
this loop (for lo<=hi) is fragile, because the bounds
are unsigned 16 bits numbers.

In some corner cases, the calculated upper bound is 2^16-1
leading to an infinite loop.

Parsing operand `[):[o-FP` results in:
- an infinite loop for non ARM architectures
- the generation of almost 2^16 errors for the ARM architecture
  (which are then ignored)

This CL improves the code in 3 ways:
- bail out early when parsing non R prefixed registers
- make sure the register index is never negative
- make sure the number of iterations is limited by the
  maximum size of the range (as a defensive measure).

Fixes #12469

Change-Id: Ib1e7e36fb8ad5a3a52c50fc6219d3cfe2b39cc34
Reviewed-on: https://go-review.googlesource.com/14314
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/compile: use []*Node instead of NodeList in bottomUpVisitor
Dave Cheney [Sat, 5 Sep 2015 02:30:13 +0000 (12:30 +1000)]
cmd/compile: use []*Node instead of NodeList in bottomUpVisitor

This one of a set of changes to make the transition away from NodeList
easier by removing cases in which NodeList doesn't act semi-trivially like a
[]*Node.

This CL was originally prepared by Josh Bleecher Snyder <josharian@gmail.com>.

This change passes go build -toolexec 'toolstash -cmp' -a std.

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

9 years agonet: Make Listen(":port") use IPv6 when IPv4 is not supported.
Paul Marks [Sat, 5 Sep 2015 01:33:35 +0000 (18:33 -0700)]
net: Make Listen(":port") use IPv6 when IPv4 is not supported.

When running an experimental kernel with IPv4 disabled, Listen(":port")
currently tries to create an AF_INET socket, and fails.  Instead, it
should see !supportsIPv4, and use an AF_INET6 socket.

This sort of environment is quite esoteric at the moment, but I can
force the tests to fail on regular Linux using the following tweaks:

- net/net.go: supportsIPv4, supportsIPv6, supportsIPv4map = false, true, false
- net/sockopt_linux.go: ipv6only=true
- net/ipsock_posix.go: Revert this fix
- ./make.bash && ../bin/go test net

Also, make the arrows in server_test.go point to the left, because
server<-client is easier to read.

Fixes #12510

Change-Id: I0cc3b6b08d5e6908d2fbf8594f652ba19815aa4b
Reviewed-on: https://go-review.googlesource.com/14334
Run-TryBot: Paul Marks <pmarks@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: use []*Node instead of NodeList in sinit
Dave Cheney [Thu, 3 Sep 2015 07:07:00 +0000 (17:07 +1000)]
cmd/compile: use []*Node instead of NodeList in sinit

This is a first of a set of changes to make the transition away from NodeList
easier by removing cases in which NodeList doesn't act semi-trivially like a
[]*Node.

This CL was originally prepared by Josh Bleecher Snyder <josharian@gmail.com>.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: Iad10b75e42b5b24e1694407841282fa3bab2dc9f
Reviewed-on: https://go-review.googlesource.com/14232
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoreflect: record unsafe.Pointer, not uintptr, during DeepEqual
Russ Cox [Tue, 1 Sep 2015 03:41:27 +0000 (23:41 -0400)]
reflect: record unsafe.Pointer, not uintptr, during DeepEqual

This is more correct with respect to garbage collection.
I don't know of any specific failures it could cause today.

Change-Id: I7eed6a06d2f281051199e79e4a9913aa8360ded7
Reviewed-on: https://go-review.googlesource.com/14137
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile/internal/gc: fix go.y (rename of Fatal -> Fatalf)
Robert Griesemer [Fri, 4 Sep 2015 23:56:45 +0000 (16:56 -0700)]
cmd/compile/internal/gc: fix go.y (rename of Fatal -> Fatalf)

Also go generate to update generated files.

Change-Id: I049708db93455f0030ba5afc6f218fde6220958d
Reviewed-on: https://go-review.googlesource.com/14331
Reviewed-by: Damien Neil <dneil@google.com>
9 years agocmd/go: fix Go buildid reading on Solaris
Shawn Walker-Salas [Wed, 26 Aug 2015 22:24:41 +0000 (15:24 -0700)]
cmd/go: fix Go buildid reading on Solaris

TestNoteReading fails on Solaris with linkmode=external due to some
assumptions made about how ELF .note sections are written by some
linkers.

On current versions of Solaris and older derivatives, SHF_ALLOC is
intentionally ignored for .note sections unless the .note section is
assigned to the text segment via a mapfile.  Also, if .note sections
are assigned to the text segment, no PT_NOTE program header will be
created thwarting Go's attempts at attempting to quickly find the
.note.

Furthermore, Go assumes that the relevant note segment will be placed
early in the file while the Solaris linker currently places the note
segment last in the file, additionally thwarting Go's optimisation
attempts that read only the first 16KB of the file to find the
buildid.

The fix is to detect when the note section is outside of the first
16KB of the file and then fallback to additionally reading that
section of the file.  This way, in future versions of Solaris when
this linking behaviour is changed, the fast path will always succeed
and we'll only be slower if it fails; likewise, any other linker that
does this will also just work.

Fixes #12178

Change-Id: I61c1dc3f744ae3ad63938386d2ace8a432c0efe1
Reviewed-on: https://go-review.googlesource.com/14210
Run-TryBot: Aram Hăvărneanu <aram@mgk.ro>
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
9 years agoRevert "cmd/internal/ld: put read-only relocated data into .data.rel.ro when making...
Dave Cheney [Fri, 4 Sep 2015 09:53:35 +0000 (09:53 +0000)]
Revert "cmd/internal/ld: put read-only relocated data into .data.rel.ro when making a shared object"

This reverts commit 2c2cbb69c8dad1325f0a4b289417da73fd90f4b0.

Broke darwin/arm64

Change-Id: Ibd2dea475d6ce6a8b4b40e2da19a83fc0514025d
Reviewed-on: https://go-review.googlesource.com/14301
Reviewed-by: Ian Lance Taylor <iant@golang.org>