]> Cypherpunks repositories - gostls13.git/log
gostls13.git
6 years agostrings: add ReplaceAll example
dupoxy [Wed, 12 Dec 2018 22:49:31 +0000 (22:49 +0000)]
strings: add ReplaceAll example

Change-Id: I6b0d470bdedb92844943c8e5823e214d6a7471cf
GitHub-Last-Rev: 4a135000ba9c23a588b960e5b2989710cc71e3e2
GitHub-Pull-Request: golang/go#29199
Reviewed-on: https://go-review.googlesource.com/c/153840
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agostrings: revert accidental example change from CL 153840
Brad Fitzpatrick [Wed, 12 Dec 2018 22:28:50 +0000 (22:28 +0000)]
strings: revert accidental example change from CL 153840

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

6 years agogo/build: document when Context.BuildTags is used.
Muhammad Falak R Wani [Wed, 29 Aug 2018 00:01:46 +0000 (05:31 +0530)]
go/build: document when Context.BuildTags is used.

Context.BuildTags is not set when you read go/build.Default.BuildTags.
It's only used by (*BuildTags).Import, etc.

Fixes: #27320
Change-Id: I97e5f1923c410b48f70be8c15938a7e04a178e3f
Reviewed-on: https://go-review.googlesource.com/c/131975
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoruntime: pass LR to sigprof on windows/arm
Jordan Rhee [Wed, 12 Dec 2018 19:28:46 +0000 (11:28 -0800)]
runtime: pass LR to sigprof on windows/arm

TestCPUProfileLabel was failing on windows/arm because the link register
was not being passed to sigprof(). The link register is required to
generate a correct traceback. With this change, all tests in runtime.pprof
are now passing.

Updates #26148

Change-Id: Ia693b34278dc08a98023751ff1a922d9eee8fdd6
Reviewed-on: https://go-review.googlesource.com/c/153839
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/go: reject GOCACHE=off when the default cache is initialized
Bryan C. Mills [Fri, 7 Dec 2018 17:05:00 +0000 (12:05 -0500)]
cmd/go: reject GOCACHE=off when the default cache is initialized

Allow GOCACHE=off only for operations that never actually write
anything to the cache (in which case the GOCACHE setting should not
matter at all).

Fixes #29127

Change-Id: I733d02cd2fbcf3671f5adcfb73522865d131e360
Reviewed-on: https://go-review.googlesource.com/c/153462
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
6 years agogo/internal/gccgoimporter: permit fixups for V2 export data
Than McIntosh [Wed, 12 Dec 2018 19:38:03 +0000 (14:38 -0500)]
go/internal/gccgoimporter: permit fixups for V2 export data

The changes added in https://golang.org/cl/151997 to fix problems when
reading older export data introduced the ability to add "fixups" to
handle references to a type whose definition has not yet been
finalized. It turns out we need to allow for fixups even for more
recent export data (V2 and V3); this patch removes a version guard for
the fixup generation logic.

Fixes #29198.

Change-Id: I82136ac45b53e4a59c05ff0879ac6bb545d0ff31
Reviewed-on: https://go-review.googlesource.com/c/153821
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/go/internal/web2: log http requests with -v
Hana Kim [Tue, 11 Dec 2018 23:06:50 +0000 (18:06 -0500)]
cmd/go/internal/web2: log http requests with -v

It's similar to what cmd/go/internal/web package does
when cfg.BuildV is set. The web2 package is what
cmd/go/internal/modfetch uses, so this change allows us
to trace web requests go get command in module mode
sends for modfetch.

Change-Id: If387efd8a8698c816bf267d1e6c6766fd357c298
Reviewed-on: https://go-review.googlesource.com/c/153640
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agosyscall: update doc comment to match behavior for Proc.Call
Andrew Bonventre [Wed, 12 Dec 2018 22:05:06 +0000 (17:05 -0500)]
syscall: update doc comment to match behavior for Proc.Call

golang.org/cl/147117 increased the number of arguments permitted
by Proc.Call on Windows, but the doc comment was never updated.

Change-Id: Iea5eb9e0aafbc1025d5fcb8665d028b2254c183a
Reviewed-on: https://go-review.googlesource.com/c/153825
Reviewed-by: Channing Kimble-Brown <ckimblebrown@google.com>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
6 years agocmd/go/internal/modfetch: skip symlinks in (*coderepo).Zip
Bryan C. Mills [Wed, 12 Dec 2018 03:46:55 +0000 (22:46 -0500)]
cmd/go/internal/modfetch: skip symlinks in (*coderepo).Zip

Tested manually.

Before:

$ go mod init golang.org/issue/scratch
go: creating new go.mod: module golang.org/issue/scratch
$ go1.11.2 mod download github.com/rogpeppe/test2@latest
go: finding github.com/rogpeppe/test2 v0.0.11
$ find $GOPATH -name goodbye
/tmp/tmp.Y8a8UzX3zD/_gopath/pkg/mod/github.com/rogpeppe/test2@v0.0.11/tests/goodbye
$ cat $(find $GOPATH -name goodbye)
hello

After:

$ go mod init golang.org/issue/scratch
go: creating new go.mod: module golang.org/issue/scratch
$ go mod download github.com/rogpeppe/test2@latest
go: finding github.com/rogpeppe/test2 v0.0.11
$ find $GOPATH -name goodbye
$ find $GOPATH -name hello
/tmp/tmp.Zo0jhfLaRs/_gopath/pkg/mod/github.com/rogpeppe/test2@v0.0.11/tests/hello

A proper regression test would require one of:
• a new entry in the vcs-test server (feasible but tedious, and not easily updated by open-source contributors), or
• a way to set up an HTTPS proxy in a script_test, or
• a way to explicitly populate the module cache from the contents of a local repository (#28835).

Fixes #27093
Updates #28835

Change-Id: I72702a7e791f8815965f0f87c82a30df4d6f0151
Reviewed-on: https://go-review.googlesource.com/c/153819
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
6 years agocmd/go: reproduce #28680
Bryan C. Mills [Wed, 12 Dec 2018 03:14:37 +0000 (22:14 -0500)]
cmd/go: reproduce #28680

This change encodes the current behavior in mod_clean_cache.txt.
A fix for that behavior will probably have to wait for 1.13.

Updates #28680

Change-Id: I216b5a783971309cc75187502bddccc58c3a9c35
Reviewed-on: https://go-review.googlesource.com/c/153818
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
6 years agocmd/go: retain sums for replacement modules in 'go mod tidy'
Bryan C. Mills [Wed, 12 Dec 2018 02:03:11 +0000 (21:03 -0500)]
cmd/go: retain sums for replacement modules in 'go mod tidy'

Fixes #27868

Change-Id: I6c2d221c4325a2f44625e797a82735d812ee0ec1
Reviewed-on: https://go-review.googlesource.com/c/153817
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
6 years agocmd/compile: don't combine load+op if the op has SymAddr arguments
Keith Randall [Wed, 12 Dec 2018 00:12:57 +0000 (16:12 -0800)]
cmd/compile: don't combine load+op if the op has SymAddr arguments

By combining the load+op, we may force the op to happen earlier in
the store chain. That might force the SymAddr operation earlier, and
in particular earlier than its corresponding VarDef. That leads to
an invalid schedule, so avoid that.

This is kind of a hack to work around the issue presented. I think
the underlying problem, that LEAQ is not directly ordered with respect
to its vardef, is the real problem. The benefit of this CL is that
it fixes the immediate issue, is small, and obviously won't break
anything. A real fix for this issue is much more invasive.

The go binary is unchanged in size.
This situation just doesn't occur very often.

Fixes #28445

Change-Id: I13a765e13f075d5b6808a355ef3c43cdd7cd47b6
Reviewed-on: https://go-review.googlesource.com/c/153641
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
6 years agodoc/go1.12: release notes for testing
Julie Qiu [Thu, 6 Dec 2018 16:02:49 +0000 (11:02 -0500)]
doc/go1.12: release notes for testing

Change-Id: I81ffe7ee88354efeabb24f091db66c7c4892876c
Reviewed-on: https://go-review.googlesource.com/c/152919
Reviewed-by: Andrew Bonventre <andybons@golang.org>
6 years agocmd/go: link to the FAQ for errors that indicate private VCS repos.
Julie Qiu [Tue, 20 Nov 2018 22:42:59 +0000 (17:42 -0500)]
cmd/go: link to the FAQ for errors that indicate private VCS repos.

Updates #25982

Change-Id: I5a284e3844e944f9bfae31fa65b242060d4139c7
Reviewed-on: https://go-review.googlesource.com/c/150777
Run-TryBot: Julie Qiu <julie@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years agoencoding/xml, encoding/json: docs and examples using custom marshalers
Leigh McCulloch [Tue, 11 Dec 2018 05:32:50 +0000 (05:32 +0000)]
encoding/xml, encoding/json: docs and examples using custom marshalers

Both the encoding/xml and encoding/json packages support custom
marshalers for JSON and XML, as well as the basic encoding.TextMarshaler
and encoding.TextUnmarshaler interfaces, but the docs and examples for
these are missing.

There are docs for how to use encoding.TextMarshaler and
encoding.TextUnmarshaler in encoding/json, but not encoding/xml. There
are no examples for how to use them with either json or xml. This commit
includes docs for encoding/xml and examples for both encoding/json and
encoding/xml.

There is an example using custom marshalers MarshalJSON and
UnmarshalJSON in encoding/json, but not MarshalXML and UnmarshalXML in
encoding/json. These docs are more so necessary for encoding/xml because
the complexities of XML documents is significantly greater than JSON
documents which more often leads to the need for custom marshaling. The
encoding/json package includes an example of how to write a custom
marshaler, and this commit includes the same example for the xml
package.

All examples are mirrored off the existing custom marshaler example in
encoding/json.

Fixes #6859

Change-Id: Ic93abc27c0b4d5e48dea6ede4e20b1bedca4ab39
Reviewed-on: https://go-review.googlesource.com/c/76350
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/compile: Avoid and filter out zero-length location-lists.
David Chase [Thu, 15 Nov 2018 19:11:19 +0000 (14:11 -0500)]
cmd/compile: Avoid and filter out zero-length location-lists.

This change avoids creating zero length location lists by
repairing an overly aggressive change in CL146718
and by explicitly checking for and filtering out any
zero-length lists that are detected (building
compiler+runtime creates a single one).

Updates #28486.

Change-Id: I01c571fee2376474c7f3038e801bd58fd9e0b820
Reviewed-on: https://go-review.googlesource.com/c/150097
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
6 years agogo/format: add simple benchmark framework and basic benchmark
Robert Griesemer [Wed, 12 Dec 2018 01:23:14 +0000 (17:23 -0800)]
go/format: add simple benchmark framework and basic benchmark

For now, this CL adds as a first benchmark the formatting of
a 10,000 element array literal. It is easy to add additional
test cases as we see fit.

name                   time/op
Format/array1-10000-4    26.7ms ± 7%

name                   speed
Format/array1-10000-4  2.43MB/s ± 6%

name                   alloc/op
Format/array1-10000-4    5.52MB ± 0%

name                   allocs/op
Format/array1-10000-4      119k ± 0%

Updates #26528.

Change-Id: Ic8ec8f70160d122b877740412d4d4406f5f4b345
Reviewed-on: https://go-review.googlesource.com/c/153642
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoruntime/pprof: ignore cpu profile test failures on openbsd/arm
Joel Sing [Tue, 11 Dec 2018 16:43:48 +0000 (03:43 +1100)]
runtime/pprof: ignore cpu profile test failures on openbsd/arm

This test is currently too flakey on openbsd/arm - ignore failures for the time
being.

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

6 years agosyscall: regenerate ztypes for openbsd/arm
Joel Sing [Tue, 11 Dec 2018 16:36:39 +0000 (03:36 +1100)]
syscall: regenerate ztypes for openbsd/arm

Regenerate ztypes for openbsd/arm - most of the changes relate to the OpenBSD armv7 port
switching to EABI in September 2016.

Also use signed char when generating openbsd/arm ztypes, to avoid inconsistencies between
architectures impacting MI code.

Change-Id: I9d2e19c1ac045922e270896861c830f94fc59c10
Reviewed-on: https://go-review.googlesource.com/c/153578
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoos: in RemoveAll, try Remove first
Ian Lance Taylor [Wed, 12 Dec 2018 00:55:16 +0000 (16:55 -0800)]
os: in RemoveAll, try Remove first

Otherwise we can fail to remove a unreadable empty directory.

Fixes #29178

Change-Id: I43d5c89fce57a86626abe2a1c2bbf145716e087b
Reviewed-on: https://go-review.googlesource.com/c/153720
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoruntime/pprof: fix TestCPUProfileWithFork on Windows/ARM
Jordan Rhee [Tue, 11 Dec 2018 22:57:59 +0000 (14:57 -0800)]
runtime/pprof: fix TestCPUProfileWithFork on Windows/ARM

Use smaller heap on Windows/ARM, which generally does not have
page file enabled and therefore has limited virtual address space.

Updates #26148

Signed-off-by: Jordan Rhee <jordanrh@microsoft.com>
Change-Id: I4030be24a10fab7b9b659e3736b7e83f10710bfa
Reviewed-on: https://go-review.googlesource.com/c/153719
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoruntime: fix profiling on windows/ARM
Jordan Rhee [Tue, 11 Dec 2018 22:24:07 +0000 (14:24 -0800)]
runtime: fix profiling on windows/ARM

Fix profiling handler to get the correct g for the m being profiled.
Store a pointer to the TLS slot holding g in the thread's m. This
enables the profiling handler to get the current g for the thread,
even if the thread is executing external code or system code.

Updates #26148

Signed-off-by: Jordan Rhee <jordanrh@microsoft.com>
Change-Id: Ie061284c12341c76c7d96cc0c2d5bac969230829
Reviewed-on: https://go-review.googlesource.com/c/153718
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/cgo: set correct column for user-written code
Ian Lance Taylor [Wed, 28 Nov 2018 22:19:28 +0000 (14:19 -0800)]
cmd/cgo: set correct column for user-written code

Take advantage of the new /*line*/ comments.

Fixes #26745

Change-Id: I8098642e0f11f7418fe81b9a08dbe07671f930fe
Reviewed-on: https://go-review.googlesource.com/c/151598
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agocmd/go: fix 'go test' and 'go fmt' with files outside a module
Bryan C. Mills [Mon, 10 Dec 2018 20:02:38 +0000 (15:02 -0500)]
cmd/go: fix 'go test' and 'go fmt' with files outside a module

Use the actual loader result in findModule instead of making
assumptions about nesting in the build list.
As a side-effect, this produces much clearer error messages for
packages that (for one reason or another) failed to load.

Adjust the package and module path outside a module to
"command-line-arguments". That string already appears in the output of
a number of (module-mode and GOPATH-mode) commands for file arguments,
and as far as I can tell operation outside a module is currently the
only case in which the module path of a package is not actually a
prefix of the import path.

Fixes #28011
Fixes #27099
Fixes #28943
Updates #27102
Updates #28459
Updates #27063

Change-Id: I61d5556df7b1b7d1efdaffa892f0e3e95b612d87
Reviewed-on: https://go-review.googlesource.com/c/153459
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
6 years agocmd/go/internal/modfetch/codehost: return VCSError for unimplemented functions and...
Bryan C. Mills [Mon, 10 Dec 2018 19:58:08 +0000 (14:58 -0500)]
cmd/go/internal/modfetch/codehost: return VCSError for unimplemented functions and malformed responses

Updates #28943
Updates #26092

Change-Id: I07af2731ef5af046b9f7c7280ccb3976cdf41ca4
Reviewed-on: https://go-review.googlesource.com/c/153458
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
6 years agocmd/compile: use innermost line number for -S
Keith Randall [Fri, 7 Dec 2018 18:00:36 +0000 (10:00 -0800)]
cmd/compile: use innermost line number for -S

When functions are inlined, for instructions in the inlined body, does
-S print the location of the call, or the location of the body? Right
now, we do the former. I'd like to do the latter by default, it makes
much more sense when reading disassembly. With mid-stack inlining
enabled in more cases, this quandry will come up more often.

The original behavior is still available with -S=2. Some tests
use this mode (so they can find assembly generated by a particular
source line).

This helped me with understanding what the compiler was doing
while fixing #29007.

Change-Id: Id14a3a41e1b18901e7c5e460aa4caf6d940ed064
Reviewed-on: https://go-review.googlesource.com/c/153241
Reviewed-by: David Chase <drchase@google.com>
6 years agocmd/go: add a [root] condition to script_test
Bryan C. Mills [Tue, 11 Dec 2018 16:48:01 +0000 (11:48 -0500)]
cmd/go: add a [root] condition to script_test

[root] reports whether the current effective user ID is 0.

Updates #29127

Change-Id: I9ef42f1271ea669689011e7ceff4d918c0cecb6b
Reviewed-on: https://go-review.googlesource.com/c/153637
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agogo/internal/gccgoimporter: add XCOFF support
Clément Chigot [Wed, 5 Dec 2018 16:27:24 +0000 (17:27 +0100)]
go/internal/gccgoimporter: add XCOFF support

This commit adds support to read XCOFF files and AIX big archives in
go/internal/gccgoimporter.

Fixes: #29113
Change-Id: Id84d40358ff98fae5a576d1ebdd65980896365b9
Reviewed-on: https://go-review.googlesource.com/c/152720
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agocmd/go: add a chmod command to script_test
Bryan C. Mills [Fri, 7 Dec 2018 22:36:55 +0000 (17:36 -0500)]
cmd/go: add a chmod command to script_test

Change-Id: I5d4f65553f6c368d101be59aae9440f5ec9573b7
Reviewed-on: https://go-review.googlesource.com/c/153461
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agointernal/xcoff: add big archive support
Clément Chigot [Mon, 10 Dec 2018 09:53:39 +0000 (10:53 +0100)]
internal/xcoff: add big archive support

This commit adds support to read AIX big archive inside internal/xcoff
package.

Change-Id: I4317b40824b24312a69c918dfc6438dc3aff7be7
Reviewed-on: https://go-review.googlesource.com/c/153398
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoruntime: revise openbsd/arm runtime defs
Joel Sing [Tue, 11 Dec 2018 15:19:50 +0000 (02:19 +1100)]
runtime: revise openbsd/arm runtime defs

The OpenBSD arm port switched to EABI in September 2016 - this revises the layout
of the runtime definitions to match what the kernel currently uses.

Change-Id: I1bca7de56979f576862a7c280631e835f7ae4278
Reviewed-on: https://go-review.googlesource.com/c/153577
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/cgo: don't cache bad pointer typedefs
Ian Lance Taylor [Tue, 11 Dec 2018 15:46:10 +0000 (07:46 -0800)]
cmd/cgo: don't cache bad pointer typedefs

The set of bad pointer typedefs changes as we see more typedefs, so
avoid looking in the cache when we find one.

Fixes #29175

Change-Id: Idd82289bdd8628d11a983fa5ec96517e3a5bcbf1
Reviewed-on: https://go-review.googlesource.com/c/153597
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/cover: simplify and correct isValidIdentifier
Ian Lance Taylor [Tue, 11 Dec 2018 03:35:01 +0000 (19:35 -0800)]
cmd/cover: simplify and correct isValidIdentifier

Per comment on CL 120316.

Updates #25280

Change-Id: I7d078de4030bd10934468e04ff696a34749bd454
Reviewed-on: https://go-review.googlesource.com/c/153500
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
6 years agocmd/nm: run tests in parallel, don't use Scanner on []byte
Ian Lance Taylor [Mon, 10 Dec 2018 23:47:10 +0000 (15:47 -0800)]
cmd/nm: run tests in parallel, don't use Scanner on []byte

Saves about 35% on total test time on my laptop.

Fixes #26471

Change-Id: I15b28b1bc00f889934d577dc7996864bbab10105
Reviewed-on: https://go-review.googlesource.com/c/153499
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/link: only create .init_array section if not empty
Ian Lance Taylor [Fri, 7 Dec 2018 22:19:01 +0000 (14:19 -0800)]
cmd/link: only create .init_array section if not empty

This avoids a warning from old versions of the GNU linker or glibc.

No test because these old versions are not readily available.
I tested this by hand on CentOS 6.

Fixes #28722

Change-Id: I16640c9b83a79f759ec68fac64874803e74fbbfb
Reviewed-on: https://go-review.googlesource.com/c/153257
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/cgo: preserve type information across loadDWARF loop
Ian Lance Taylor [Wed, 5 Dec 2018 22:04:27 +0000 (14:04 -0800)]
cmd/cgo: preserve type information across loadDWARF loop

CL 122575 and its successors introduced a loop calling loadDWARF,
whereas before we only called it once. Pass a single typeConv to each
call, rather than creating a new one in loadDWARF itself. Change the
maps from dwarf.Type to use string keys rather than dwarf.Type keys,
since when the DWARF is reloaded the dwarf.Type pointers will be
different. These changes permit typeConv.Type to return a consistent
value for a given DWARF type, avoiding spurious type conversion errors
due to typedefs loaded after the first loop iteration.

Fixes #27340

Change-Id: Ic33467bbfca4c54e95909621b35ba2a58216d96e
Reviewed-on: https://go-review.googlesource.com/c/152762
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
6 years agocmd/compile: emit a symbol for a method expression when using -dynlink
Ian Lance Taylor [Sat, 8 Dec 2018 02:22:04 +0000 (18:22 -0800)]
cmd/compile: emit a symbol for a method expression when using -dynlink

Fixes #25065

Change-Id: Ia3db518cfd9c006caf951b51342a491ac8372e9c
Reviewed-on: https://go-review.googlesource.com/c/153297
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agodoc: use https scheme in oss-distros link
Dmitri Shuralyov [Mon, 10 Dec 2018 20:32:17 +0000 (15:32 -0500)]
doc: use https scheme in oss-distros link

The https scheme is supported, and should be used per best practices.

The previous http link redirected to https:

$ curl -i 'http://oss-security.openwall.org/wiki/mailing-lists/distros'
HTTP/1.1 302 Moved Temporarily
Location: https://oss-security.openwall.org/wiki/mailing-lists/distros

Change-Id: I857b93eeec45996d6dc05dbf7532d1759bf4d447
Reviewed-on: https://go-review.googlesource.com/c/153457
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/compile: set correct line number for method wrappers
Keith Randall [Mon, 10 Dec 2018 22:19:33 +0000 (14:19 -0800)]
cmd/compile: set correct line number for method wrappers

When converting a method to a function, like this:

type T ...
func (t T) foo() {
}
var t T
f := t.foo

We need to build a wrapper function for the partially evaluated
method. Currently that wrapper function gets the line number of
the first place where t.foo appears. Instead it should have the
line number of where foo is declared.

Fixes #26839

Change-Id: I7dbe2094e53d5d336f329273f10f8430e0af544e
Reviewed-on: https://go-review.googlesource.com/c/153498
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agoruntime: fix CGO traceback frame count
Mark Pulford [Fri, 30 Nov 2018 10:12:06 +0000 (21:12 +1100)]
runtime: fix CGO traceback frame count

Without this, each additional C frame found via SetCgoTraceback will
cause a frame to be dropped from the bottom of the traceback stack.

Fixes #29034

Change-Id: I90aa6b2a1dced90c69b64c5dd565fe64a25724a3
Reviewed-on: https://go-review.googlesource.com/c/151917
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/cover: check that the argument of -var is valid
Andrea Nodari [Thu, 21 Jun 2018 17:01:01 +0000 (18:01 +0100)]
cmd/cover: check that the argument of -var is valid

At the moment, the cover tool does not check that the argument of -var
is a valid identifier. Hence, it could generate a file that fails to
compile afterwards.

Updates #25280

Change-Id: I6eb1872736377680900a18a4a28ba002ab5ea8ca
Reviewed-on: https://go-review.googlesource.com/c/120316
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agohash/fnv: use bits.Mul64 for 128-bit hash
Brian Kessler [Thu, 6 Sep 2018 18:26:31 +0000 (12:26 -0600)]
hash/fnv: use bits.Mul64 for 128-bit hash

Replace the 128-bit multiplication in 4 parts with bits.Mul64
and two single-width multiplications.  This simplifies the code
and increases throughput by ~50% on amd64.

name         old time/op   new time/op   delta
Fnv128KB-4    9.64µs ± 0%   6.09µs ± 0%  -36.89%  (p=0.016 n=4+5)
Fnv128aKB-4   9.11µs ± 0%   6.17µs ± 5%  -32.32%  (p=0.008 n=5+5)

name         old speed     new speed     delta
Fnv128KB-4   106MB/s ± 0%  168MB/s ± 0%  +58.44%  (p=0.016 n=4+5)
Fnv128aKB-4  112MB/s ± 0%  166MB/s ± 5%  +47.85%  (p=0.008 n=5+5)

Change-Id: Id752f2a20ea3de23a41e08db89eecf2bb60b7e6d
Reviewed-on: https://go-review.googlesource.com/c/133936
Run-TryBot: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agocmd/go/internal/modfetch: update TestCodeRepo for gopkg.in/yaml.v2 v2.2.2
Bryan C. Mills [Mon, 10 Dec 2018 22:06:40 +0000 (17:06 -0500)]
cmd/go/internal/modfetch: update TestCodeRepo for gopkg.in/yaml.v2 v2.2.2

I think we ought to make these tests hermetic, but in the meantime we
should at least make them pass.

Fixes #27692
Updates #28856

Change-Id: Ia78fa60e998dea3c871f640ffa2ece67b054f866
Reviewed-on: https://go-review.googlesource.com/c/153460
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
6 years agocmd/cgo: don't pass CGO_CFLAGS -g options to debug info generation
Ian Lance Taylor [Tue, 4 Dec 2018 00:02:10 +0000 (16:02 -0800)]
cmd/cgo: don't pass CGO_CFLAGS -g options to debug info generation

Fixes #26144

Change-Id: Ie69dab1bd819eaf158be11769903b2636bbcf516
Reviewed-on: https://go-review.googlesource.com/c/152165
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Nikhil Benesch <nikhil.benesch@gmail.com>
6 years agocmd/go: fix errors for commands run outside of modules
Jay Conrod [Thu, 6 Dec 2018 21:18:12 +0000 (16:18 -0500)]
cmd/go: fix errors for commands run outside of modules

Since CL 148517, several commands (including list and get) work when
GO111MODULE=on even when no go.mod file is present. This broke an
assumption made by "fix" and "generate" which caused panics when run
with a list of .go files (whether or not the command was run inside a
module).

This change fixes those assumptions and adds test cases for other
commands run outside modules.

Fixes #29097

Change-Id: I7927559769c5d4617d73eb63f3b17e2f26d8c219
Reviewed-on: https://go-review.googlesource.com/c/153158
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years agogo/build: improve comment on Context.CgoEnabled
Gn Shivakumar [Tue, 31 Jul 2018 00:50:02 +0000 (06:20 +0530)]
go/build: improve comment on Context.CgoEnabled

Fixes #25953

Change-Id: I4f3a64b42fce76cc5ea6cfe2888d103c7423457d
Reviewed-on: https://go-review.googlesource.com/c/126736
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years agoall: move cmd/internal/xcoff to internal/xcoff
Clément Chigot [Wed, 5 Dec 2018 16:23:25 +0000 (17:23 +0100)]
all: move cmd/internal/xcoff to internal/xcoff

This commit moves cmd/internal/xcoff package to internal/xcoff because
it will be needed to add XCOFF support in go/internal/gccgoimporter.

Change-Id: Id12df0c438fb7db4a6a458fc1478480851bf7771
Reviewed-on: https://go-review.googlesource.com/c/152719
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocrypto/ecdsa: fix NSA reference to Suite B implementer's guide to FIPS 186-3
Gerasimos (Makis) Maropoulos [Sat, 8 Dec 2018 22:20:50 +0000 (00:20 +0200)]
crypto/ecdsa: fix NSA reference to Suite B implementer's guide to FIPS 186-3

Change-Id: I34877ac1d6d7fe9ffa7eabe46b4032af84d33794
Reviewed-on: https://go-review.googlesource.com/c/153337
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agomath/bits: remove named return in TrailingZeros16
Alberto Donizetti [Sun, 9 Dec 2018 12:37:17 +0000 (13:37 +0100)]
math/bits: remove named return in TrailingZeros16

TrailingZeros16 is the only one of the TrailingZeros functions with a
named return value in the signature. This creates a sligthly
unpleasant effect in the godoc listing:

  func TrailingZeros(x uint) int
  func TrailingZeros16(x uint16) (n int)
  func TrailingZeros32(x uint32) int
  func TrailingZeros64(x uint64) int
  func TrailingZeros8(x uint8) int

Since the named return value is not even used, remove it.

Change-Id: I15c5aedb6157003911b6e0685c357ce56e466c0e
Reviewed-on: https://go-review.googlesource.com/c/153340
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/link/internal/ld: run tests in parallel
Ian Lance Taylor [Fri, 7 Dec 2018 23:16:54 +0000 (15:16 -0800)]
cmd/link/internal/ld: run tests in parallel

Also skip TestNooptCgoBuild in short mode.

Also fix a couple of obscure constants to use values named in
cmd/internal/dwarf.

This brings the time of the cmd/link/internal/ld tests down to about 1
second on my laptop.

Updates #26470

Change-Id: I71c896f30fd314a81d9090f1b6d02edc4174a808
Reviewed-on: https://go-review.googlesource.com/c/153259
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/compile: check for negative upper bound to IsSliceInBounds
David Chase [Tue, 4 Dec 2018 15:00:16 +0000 (10:00 -0500)]
cmd/compile: check for negative upper bound to IsSliceInBounds

IsSliceInBounds(x, y) asserts that y is not negative, but
there were cases where this is not true.  Change code
generation to ensure that this is true when it's not obviously
true.  Prove phase cleans a few of these out.

With this change the compiler text section is 0.06% larger,
that is, not very much.  Benchmarking still TBD, may need
to wait for access to a benchmarking box (next week).

Also corrected run.go to handle '?' in -update_errors output.

Fixes #28797.

Change-Id: Ia8af90bc50a91ae6e934ef973def8d3f398fac7b
Reviewed-on: https://go-review.googlesource.com/c/152477
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/go: disallow version string in go mod init module path
Kyle Wood [Fri, 16 Nov 2018 16:46:14 +0000 (10:46 -0600)]
cmd/go: disallow version string in go mod init module path

To prevent confusion, go mod init should not allow version strings in
the module path when provided as an argument. Instead, fail with a
useful error message.

Fixes #28803

Change-Id: I59272a91b042e32cef33c2e2116f760ca1def218
Reviewed-on: https://go-review.googlesource.com/c/150018
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years agodoc/go1.12: release notes for math/bits
Julie Qiu [Thu, 6 Dec 2018 19:13:28 +0000 (14:13 -0500)]
doc/go1.12: release notes for math/bits

Change-Id: I930942c7e057a36332ac06762f6aadf07574a7d5
Reviewed-on: https://go-review.googlesource.com/c/152977
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/link: use filepath.Join rather than d + "/" + f
Ian Lance Taylor [Fri, 7 Dec 2018 20:18:22 +0000 (12:18 -0800)]
cmd/link: use filepath.Join rather than d + "/" + f

Fixes #26917

Change-Id: I676f016ed43aaa523b6d3a87b28a1d1d2ebe72c4
Reviewed-on: https://go-review.googlesource.com/c/153237
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/go/internal/modload: add missing build constraint in testgo.go
Bryan C. Mills [Fri, 7 Dec 2018 17:08:12 +0000 (12:08 -0500)]
cmd/go/internal/modload: add missing build constraint in testgo.go

That file is supposed to make unexpected dependencies on the main
module easier to diagnose in 'go test cmd/go', but I accidentally left
off the build constraint, so it was triggering outside of the test.

Updates #29097

Change-Id: I1cde3fe6c1d80add37c98a8c95ce48524ea05024
Reviewed-on: https://go-review.googlesource.com/c/153159
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
6 years agoruntime: fix runtime-gdb.py when switching sp value
Lynn Boger [Tue, 4 Dec 2018 20:15:27 +0000 (15:15 -0500)]
runtime: fix runtime-gdb.py when switching sp value

After a recent change to runtime-gdb_test.go the ppc64le builder
has had intermittent failures. The failures occur when trying to
invoke the goroutineCmd function to display the backtrace for
a selected goroutine. There is nothing wrong with the testcase
but it seems to intermittently leave goroutines in a state
where an error can occur.

The error message indicates that the problem occurs when trying
to change the sp back to the original after displaying the
stacktrace for the goroutine.

gdb.error: Attempt to assign to an unmodifiable value.

After some searching I found that this error message can happen
if the sp register is changed when on a frame that is not the
top-most frame. To fix the problem, frame 0 is selected before
changing the value of sp. This fixes the problem in my
reproducer environment, and hopefully will fix the problem on
the builder.

Updates #28679

Change-Id: I329bc95b30f8c95acfb161b0d9cfdcbd917a1954
Reviewed-on: https://go-review.googlesource.com/c/152540
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agoruntime: enable preemption of mark termination goroutine
Michael Anthony Knyszek [Thu, 6 Dec 2018 21:51:51 +0000 (21:51 +0000)]
runtime: enable preemption of mark termination goroutine

A mark worker goroutine may attempt to preempt the mark termination
goroutine to scan its stack while the mark termination goroutine is
trying to preempt that worker to flush its work buffer, in rare
cases.

This change makes it so that, like a worker goroutine, the mark
termination goroutine stack is preemptible while it is on the
system stack, attempting to preempt others.

Fixes #28695.

Change-Id: I23bbb191f4fdad293e8a70befd51c9175f8a1171
Reviewed-on: https://go-review.googlesource.com/c/153077
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
6 years agodoc: mention the use of replacements to resolve imports for 1.12
Bryan C. Mills [Fri, 7 Dec 2018 15:14:42 +0000 (10:14 -0500)]
doc: mention the use of replacements to resolve imports for 1.12

Updates #26241

Change-Id: I8ffac13d9cc1ee4d4de8fcd2042a7fa60fca567b
Reviewed-on: https://go-review.googlesource.com/c/153157
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agodoc: announce the end of support for binary-only packages
Bryan C. Mills [Thu, 6 Dec 2018 14:03:59 +0000 (09:03 -0500)]
doc: announce the end of support for binary-only packages

Updates #28152

Change-Id: If859221afc683b392f649e79d7ff0a06125cbe10
Reviewed-on: https://go-review.googlesource.com/c/152918
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/internal/obj/s390x: don't crash on invalid instruction
Ian Lance Taylor [Fri, 7 Dec 2018 15:25:50 +0000 (07:25 -0800)]
cmd/internal/obj/s390x: don't crash on invalid instruction

I didn't bother with a test as there doesn't seem to be an existing
framework for testing assembler failures, and tests for invalid code
aren't all that interesting.

Fixes #26700

Change-Id: I719410d83527802a09b9d38625954fdb36a3c0f7
Reviewed-on: https://go-review.googlesource.com/c/153177
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agomath: document sign bit correspondence for floating-point/bits conversions
Robert Griesemer [Thu, 6 Dec 2018 21:32:50 +0000 (13:32 -0800)]
math: document sign bit correspondence for floating-point/bits conversions

Fixes #27736.

Change-Id: Ibda7da7ec6e731626fc43abf3e8c1190117f7885
Reviewed-on: https://go-review.googlesource.com/c/153057
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/cover: run tests in parallel, don't change source directory
Ian Lance Taylor [Thu, 6 Dec 2018 01:24:41 +0000 (17:24 -0800)]
cmd/cover: run tests in parallel, don't change source directory

This speeds up the cmd/cover testsuite by about 40% on my laptop.

Updates #26473
Updates #28386

Change-Id: I853b1b3b8c98dc89440f7b7bf5c0ade1d3d66802
Reviewed-on: https://go-review.googlesource.com/c/152817
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocrypto/x509: explicitly cast printf format argument
Tobias Klauser [Thu, 6 Dec 2018 19:58:26 +0000 (20:58 +0100)]
crypto/x509: explicitly cast printf format argument

After CL 128056 the build fails on darwin/386 with

  src/crypto/x509/root_cgo_darwin.go:218:55: warning: values of type 'SInt32' should not be used as format arguments; add an explicit cast to 'int' instead [-Wformat]
  go build crypto/x509: C compiler warning promoted to error on Go builders

Fix the warning by explicitly casting the argument to an int as
suggested by the warning.

Change-Id: Icb6bd622a543e9bc5f669fd3d7abd418b4a8e579
Reviewed-on: https://go-review.googlesource.com/c/152958
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/go/internal/modload: use replacements to resolve missing imports
Bryan C. Mills [Wed, 5 Dec 2018 14:52:58 +0000 (09:52 -0500)]
cmd/go/internal/modload: use replacements to resolve missing imports

If the replacements specify one or more versions, we choose the latest
(for consistency with the QueryPackage path, with resolves the latest
version from upstream).

Otherwise, we synthesize a pseudo-version with a zero timestamp and an
appropriate major version.

Fixes #26241

RELNOTE=yes

Change-Id: I14b4c63858c8714cc3e1b05ac52c33de5a16dea9
Reviewed-on: https://go-review.googlesource.com/c/152739
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agoruntime: print pointers being put in checkPut
Austin Clements [Thu, 6 Dec 2018 18:54:07 +0000 (13:54 -0500)]
runtime: print pointers being put in checkPut

In order to further diagnose #27993, I need to see exactly what
pointers are being added to the gcWork buffer too late.

Change-Id: I8d92113426ffbc6e55d819c39e7ab5eafa68668d
Reviewed-on: https://go-review.googlesource.com/c/152957
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
6 years agocmd/go/internal/module: fix validation for module paths ending with /v
Bryan C. Mills [Wed, 5 Dec 2018 15:20:24 +0000 (10:20 -0500)]
cmd/go/internal/module: fix validation for module paths ending with /v

Unlike "/v1", "/v" is not likely to be mistaken for a semantic import path.

Change-Id: I024647d78c79c7761b98ddeccdc7e259ca94b568
Reviewed-on: https://go-review.googlesource.com/c/152738
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
6 years agodoc/go1.12: release notes for lib/time
Julie Qiu [Wed, 5 Dec 2018 21:36:18 +0000 (16:36 -0500)]
doc/go1.12: release notes for lib/time

Change-Id: Ic435090bda64d1061f2c3aac0aa94ed7a4800b0b
Reviewed-on: https://go-review.googlesource.com/c/152743
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/internal/objfile: provide consistent output in objdump on ppc64x
Lynn Boger [Wed, 5 Dec 2018 21:23:52 +0000 (16:23 -0500)]
cmd/internal/objfile: provide consistent output in objdump on ppc64x

This makes a change to disasm.go so it provides consistent output
with the recent updates to arch/ppc64.

Change-Id: I812e5da2423fd1a84406032fd91ddf9cc86b7c69
Reviewed-on: https://go-review.googlesource.com/c/152761
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agodoc: 1.12 release notes for cmd/go
Bryan C. Mills [Wed, 5 Dec 2018 21:33:56 +0000 (16:33 -0500)]
doc: 1.12 release notes for cmd/go

Change-Id: I1a0bedc9fbd42e138eb68af8365115339e377856
Reviewed-on: https://go-review.googlesource.com/c/152742
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agogo/types: better error messages for field lookup errors
Robert Griesemer [Thu, 6 Dec 2018 01:08:27 +0000 (17:08 -0800)]
go/types: better error messages for field lookup errors

- follow wording of cmd/compile more closely
- only print base of a package path to avoid overly long error messages

Fixes #26234.

Change-Id: I47a8c64b3adcf73980cd296a24cf8ac721e5df06
Reviewed-on: https://go-review.googlesource.com/c/152764
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
6 years agocmd/compile/internal/syntax: remove unused field in (scanner) source
Robert Griesemer [Wed, 5 Dec 2018 22:42:47 +0000 (14:42 -0800)]
cmd/compile/internal/syntax: remove unused field in (scanner) source

The source.offs field was intended for computing line offsets which
may allow a tiny optimization (see TODO in source.go). We haven't
done the optimization, so for now just remove the field to avoid
confusion. It's trivially added if needed.

While at it, also:

- Fix comment for ungetr2.
- Make sure sentinel is present even if reading from the io.Reader failed.

Change-Id: Ib056c6478030b3fe5fec29045362c8161ff3d19e
Reviewed-on: https://go-review.googlesource.com/c/152763
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
6 years agodoc/go1.12: add more release notes for various packages
Andrew Bonventre [Wed, 5 Dec 2018 18:22:44 +0000 (13:22 -0500)]
doc/go1.12: add more release notes for various packages

Change-Id: Ie11cf7d8204860f5a61ab650589d44072d6b131c
Reviewed-on: https://go-review.googlesource.com/c/152740
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocrypto/x509: re-enable TestSystemRoots
Filippo Valsorda [Mon, 6 Aug 2018 22:38:38 +0000 (18:38 -0400)]
crypto/x509: re-enable TestSystemRoots

Now that the cgo and no-cgo paths should be correct and equivalent,
re-enable the TestSystemRoots test without any margin of error (which
was tripping anyway when users had too many of a certain edge-case).

As a last quirk, the verify-cert invocation will validate certificates
that aren't roots, but are signed by valid roots. Ignore them.

Fixes #24652

Change-Id: I6a8ff3c2282136d7122a4e7e387eb8014da0d28a
Reviewed-on: https://go-review.googlesource.com/c/128117
TryBot-Result: Gobot Gobot <gobot@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
6 years agocrypto/x509: fix root CA extraction on macOS (no-cgo path)
Filippo Valsorda [Mon, 6 Aug 2018 22:38:18 +0000 (18:38 -0400)]
crypto/x509: fix root CA extraction on macOS (no-cgo path)

Certificates without any trust settings might still be in the keychain
(for example if they used to have some, or if they are intermediates for
offline verification), but they are not to be trusted. The only ones we
can trust unconditionally are the ones in the system roots store.

Moreover, the verify-cert invocation was not specifying the ssl policy,
defaulting instead to the basic one. We have no way of communicating
different usages in a CertPool, so stick to the WebPKI use-case as the
primary one for crypto/x509.

Updates #24652

Change-Id: Ife8b3d2f4026daa1223aa81fac44aeeb4f96528a
Reviewed-on: https://go-review.googlesource.com/c/128116
Reviewed-by: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@golang.org>
6 years agocrypto/x509: fix root CA extraction on macOS (cgo path)
Filippo Valsorda [Mon, 6 Aug 2018 19:41:34 +0000 (15:41 -0400)]
crypto/x509: fix root CA extraction on macOS (cgo path)

The cgo path was not taking policies into account, using the last
security setting in the array whatever it was. Also, it was not aware of
the defaults for empty security settings, and for security settings
without a result type. Finally, certificates restricted to a hostname
were considered roots.

The API docs for this code are partial and not very clear, so this is a
best effort, really.

Updates #24652

Change-Id: I8fa2fe4706f44f3d963b32e0615d149e997b537d
Reviewed-on: https://go-review.googlesource.com/c/128056
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@golang.org>
6 years agodoc: 1.12 release notes for go/doc, go/token, and reflect packages
Katie Hockman [Tue, 4 Dec 2018 21:23:39 +0000 (16:23 -0500)]
doc: 1.12 release notes for go/doc, go/token, and reflect packages

Change-Id: I5f0ceeca2025cf19bcf610e150f7b7067fdd7397
Reviewed-on: https://go-review.googlesource.com/c/152637
Reviewed-by: Andrew Bonventre <andybons@golang.org>
6 years agodoc/go1.11: add note about go run supporting for go run pkg or go run .
komuW [Wed, 5 Dec 2018 05:39:18 +0000 (05:39 +0000)]
doc/go1.11: add note about go run supporting for go run pkg or go run .

Fixes golang/go#27047

Change-Id: I0dd40201fc03e87fbc674b47bdf9315f1783d6c2
GitHub-Last-Rev: f28ab6234ade814c4bc09e26417c424c843ad57b
GitHub-Pull-Request: golang/go#27048
Reviewed-on: https://go-review.googlesource.com/c/129696
Reviewed-by: komu wairagu <komuw05@gmail.com>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
6 years agocmd/compile: omit write barriers for slice clears of go:notinheap pointers
Austin Clements [Wed, 5 Dec 2018 20:23:26 +0000 (15:23 -0500)]
cmd/compile: omit write barriers for slice clears of go:notinheap pointers

Currently,

  for i := range a {
    a[i] = nil
  }

will compile to have write barriers even if a is a slice of pointers
to go:notinheap types. This happens because the optimization that
transforms this into a memclr only asks it a's element type has
pointers, and not if it specifically has heap pointers.

Fix this by changing arrayClear to use HasHeapPointer instead of
types.Haspointers. We probably shouldn't have both of these functions,
since a pointer to a notinheap type is effectively a uintptr, but
that's not going to change in this CL.

Change-Id: I284b85bdec6ae1e641f894e8f577989facdb0cf1
Reviewed-on: https://go-review.googlesource.com/c/152723
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agocmd/compile: mark memclrHasPointers calls as write barriers
Austin Clements [Wed, 5 Dec 2018 20:21:17 +0000 (15:21 -0500)]
cmd/compile: mark memclrHasPointers calls as write barriers

There are two places where the compiler generates memclrHasPointers
calls. These are effectively write barriers, but the compiler doesn't
currently record them as such in the function. As a result code like

  for i := range a {
    a[i] = nil
  }

inserts a write barrier for the assignment to a[i], but the compiler
doesn't report this. Hence, it's not reported in the -d=wb output, and
it's not checked against //go:nowritebarrier annotations.

Change-Id: I40299ebc9824f05cf516cba494d4c086b80ffb53
Reviewed-on: https://go-review.googlesource.com/c/152722
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agocmd/vendor: update to golang.org/x/arch@5a4828b
Lynn Boger [Tue, 4 Dec 2018 15:29:23 +0000 (10:29 -0500)]
cmd/vendor: update to golang.org/x/arch@5a4828b

This updates master to fix the ppc64 objdump. There were many cases where
the Go objdump was generating opcodes that didn't exist in the Go assembler,
or generated operands in the wrong order. The goal is to generate a Go
objdump that is acceptable to the Go assembler, or as close as possible.

An additional change will be needed for the Go objdump tool to make
use of this.

Change-Id: Ie8d2d534e13b9a64852c99b4b864a9c08ed7e036
Reviewed-on: https://go-review.googlesource.com/c/152517
Reviewed-by: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/compile: avoid multiple errors regarding misuse of ... in signatures
Robert Griesemer [Wed, 5 Dec 2018 17:52:59 +0000 (09:52 -0800)]
cmd/compile: avoid multiple errors regarding misuse of ... in signatures

Follow-up on #28450 (golang.org/cl/152417).

Updates #28450.
Fixes #29107.

Change-Id: Ib4b4fe582c35315a4f71cf6dbc7f7f2f24b37ec1
Reviewed-on: https://go-review.googlesource.com/c/152758
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
6 years agonet: skip TestVariousDeadlines on Plan 9
David du Colombier [Wed, 5 Dec 2018 19:59:42 +0000 (20:59 +0100)]
net: skip TestVariousDeadlines on Plan 9

This test is regularly failing on the plan9/386
builder running on GCE, but we haven't figured
out the issue yet.

Updates #26945.

Change-Id: I8cbe0df43c0757e7bc68e370311f4a28cd7b049b
Reviewed-on: https://go-review.googlesource.com/c/152721
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/go/internal/modcmd: fix go mod edit -module replaces empty string
Baokun Lee [Mon, 19 Nov 2018 16:40:28 +0000 (00:40 +0800)]
cmd/go/internal/modcmd: fix go mod edit -module replaces empty string

Fixes golang/go#28820.

Change-Id: Id931617efcf161ec934eb6d44062ad95e8a6ab8d
Reviewed-on: https://go-review.googlesource.com/c/150277
Run-TryBot: Baokun Lee <nototon@gmail.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years agocmd/link: close input files when copying to temporary directory
Ian Lance Taylor [Wed, 5 Dec 2018 17:52:19 +0000 (09:52 -0800)]
cmd/link: close input files when copying to temporary directory

Fixes #29110

Change-Id: I077d1a9caa7f4545de1418cec718c4a37ac36ef8
Reviewed-on: https://go-review.googlesource.com/c/152757
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agodoc/go1.12: add some package release notes
Andrew Bonventre [Tue, 4 Dec 2018 21:22:26 +0000 (16:22 -0500)]
doc/go1.12: add some package release notes

Change-Id: I845eab3c98a3d472c71310de4e0475045eb59d4e
Reviewed-on: https://go-review.googlesource.com/c/152619
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/go/internal/lockedfile: fix filelock.Unlock() called twice
Clément Chigot [Wed, 5 Dec 2018 13:15:37 +0000 (14:15 +0100)]
cmd/go/internal/lockedfile: fix filelock.Unlock() called twice

filelock.Unlock() was called twice for fcntl implementation if an error
occurs during file.{,R}Lock(): once in the error handler, once in
filelock.lock().

Change-Id: I5ad84e8ef6b5e51d79e0a7a0c51f465276cd0c57
Reviewed-on: https://go-review.googlesource.com/c/152717
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years agocmd/cgo: reject names that are likely to be mangled C name
Hiroshi Ioka [Tue, 4 Dec 2018 23:01:07 +0000 (08:01 +0900)]
cmd/cgo: reject names that are likely to be mangled C name

Fixes #28721

Change-Id: I00356f3a9b0c2fb21dc9c2237dd5296fcb3b319b
Reviewed-on: https://go-review.googlesource.com/c/152657
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocrypto/elliptic: utilize faster z14 multiply/square instructions (when available)
bill_ofarrell [Wed, 31 Oct 2018 02:45:51 +0000 (22:45 -0400)]
crypto/elliptic: utilize faster z14 multiply/square instructions (when available)

In the s390x assembly implementation of NIST P-256 curve, utilize faster multiply/square
instructions introduced in the z14. These new instructions are designed for crypto
and are constant time. The algorithm is unchanged except for faster
multiplication when run on a z14 or later. On z13, the original mutiplication
(also constant time) is used.

P-256 performance is critical in many applications, such as Blockchain.

name            old time      new time     delta
BaseMultP256    24396 ns/op   21564 ns/op  1.13x
ScalarMultP256  87546 ns/op   72813 ns/op. 1.20x

Change-Id: I7e6d8b420fac56d5f9cc13c9423e2080df854bac
Reviewed-on: https://go-review.googlesource.com/c/146022
Reviewed-by: Michael Munday <mike.munday@ibm.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Michael Munday <mike.munday@ibm.com>

6 years agoruntime: correct isAbortPC check in isgoexception
Alex Brainman [Tue, 4 Dec 2018 01:05:11 +0000 (12:05 +1100)]
runtime: correct isAbortPC check in isgoexception

The expression passed into isAbortPC call was written specifically
for windows/amd64 and windows/386 runtime.abort implementation.
Adjust the code, so it also works for windows/arm.

Fixes #29050

Change-Id: I3dc8ddd08031f34115396429eff512827264826f
Reviewed-on: https://go-review.googlesource.com/c/152357
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/compile: improve error message for non-final variadic parameter
smasher164 [Tue, 4 Dec 2018 11:41:39 +0000 (06:41 -0500)]
cmd/compile: improve error message for non-final variadic parameter

Previously, when a function signature had defined a non-final variadic
parameter, the error message always referred to the type associated with that
parameter. However, if the offending parameter's name was part of an identifier
list with a variadic type, one could misinterpret the message, thinking the
problem had been with one of the other names in the identifer list.

    func bar(a, b ...int) {}
clear ~~~~~~~^       ^~~~~~~~ confusing

This change updates the error message and sets the column position to that of
the offending parameter's name, if it exists.

Fixes #28450.

Change-Id: I076f560925598ed90e218c25d70f9449ffd9b3ea
Reviewed-on: https://go-review.googlesource.com/c/152417
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agocmd/compile: fix unnamed parameter handling in escape analysis
Cherry Zhang [Tue, 4 Dec 2018 20:54:14 +0000 (15:54 -0500)]
cmd/compile: fix unnamed parameter handling in escape analysis

For recursive functions, the parameters were iterated using
fn.Name.Defn.Func.Dcl, which does not include unnamed/blank
parameters. This results in a mismatch in formal-actual
assignments, for example,

func f(_ T, x T)

f(a, b) should result in { _=a, x=b }, but the escape analysis
currently sees only { x=a } and drops b on the floor. This may
cause b to not escape when it should (or a escape when it should
not).

Fix this by using fntype.Params().FieldSlice() instead, which
does include unnamed parameters.

Also add a sanity check that ensures all the actual parameters
are consumed.

Fixes #29000

Change-Id: Icd86f2b5d71e7ebbab76e375b7702f62efcf59ae
Reviewed-on: https://go-review.googlesource.com/c/152617
Reviewed-by: Keith Randall <khr@golang.org>
6 years agocmd/go: revert multi-flag GOFLAGS doc example
Daniel Martí [Tue, 4 Dec 2018 16:25:39 +0000 (16:25 +0000)]
cmd/go: revert multi-flag GOFLAGS doc example

This partially reverts https://golang.org/cl/135035.

Reason for revert: multiple -ldflags=-foo flags simply override each
other, since that's the logic for per-package flags. The suggested
'GOFLAGS=-ldflags=-s -ldflags=-w' has never worked for 'go build', and
even breaks 'go test' and 'go vet'.

There should be a way to specify -ldflags='-w -s' via GOFLAGS, which is
being tracked in #29096. For now, just remove the incorrect suggestion.

Fixes #29053.

Change-Id: I9203056f7e5191e894bcd16595a92df2fb704ea7
Reviewed-on: https://go-review.googlesource.com/c/152479
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>

6 years agodoc/go1.12: flesh out net, etc
Brad Fitzpatrick [Tue, 4 Dec 2018 19:31:52 +0000 (19:31 +0000)]
doc/go1.12: flesh out net, etc

Change-Id: I081400286544d88eec83a8b332b9f7934fd76ae2
Reviewed-on: https://go-review.googlesource.com/c/152539
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agodoc: update 1.12 with latest relnote output
Andrew Bonventre [Tue, 4 Dec 2018 15:49:27 +0000 (10:49 -0500)]
doc: update 1.12 with latest relnote output

Change-Id: Iac0e6671902404a149dd382af37a2be002b1e50f
Reviewed-on: https://go-review.googlesource.com/c/152518
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agogo/types: use new importer.ForCompiler for gotype command
Robert Griesemer [Tue, 4 Dec 2018 18:17:33 +0000 (10:17 -0800)]
go/types: use new importer.ForCompiler for gotype command

This will produce better error messages (position information)
for errors referring to imported objects.

Change-Id: I24646ae803e6b8f78e9240310a858d4095e9463d
Reviewed-on: https://go-review.googlesource.com/c/152538
Reviewed-by: Alan Donovan <adonovan@google.com>
6 years agogo/importer: add ForCompiler, which accepts a token.FileSet
Alan Donovan [Fri, 2 Nov 2018 15:27:53 +0000 (11:27 -0400)]
go/importer: add ForCompiler, which accepts a token.FileSet

The importer.For function logically requires a FileSet, but did not
when it was first created because export data did not then record
position information. This change adds a new function, ForCompiler,
that has an additional FileSet parameter, and deprecates the For
function.

Before this change, cmd/vet would report confusing spurious
positions for token.Pos values produced by the importer.
The bug is essentially unfixable in cmd/vet.

This CL includes a test that the FileSet is correctly populated.

The changes to cmd/vendor will be applied upstream in a follow-up.

Fixes #28995

Change-Id: I9271bcb1f28e96845c913e15f0304bac93d4d4c4
Reviewed-on: https://go-review.googlesource.com/c/152258
Run-TryBot: Alan Donovan <adonovan@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agogo/doc: tune factory method association logic
Agniva De Sarker [Wed, 10 Oct 2018 10:22:03 +0000 (15:52 +0530)]
go/doc: tune factory method association logic

Ignore predeclared types (such as error) in result parameter lists when determining
with which result type a method should be associated with. This change will again
associate common factory functions with the first result type even if there are more
than one result, as long as the others are predeclared types.

Fixes #27928

Change-Id: Ia2aeaed15fc4c8debdeeaf729cc7fbba1612cafb
Reviewed-on: https://go-review.googlesource.com/c/141617
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agogo/internal/gccgoimporter: skip /*nointerface*/ comment
Ian Lance Taylor [Tue, 4 Dec 2018 03:20:47 +0000 (19:20 -0800)]
go/internal/gccgoimporter: skip /*nointerface*/ comment

Support for methods marked with "//go:nointerface" was broken by CL
151557, based on CL 150061, which changed the scanner to stop skipping
comments.

Change-Id: I43d5e2cf51bed2dc4ed9d6136ca21aa1223e8df1
Reviewed-on: https://go-review.googlesource.com/c/152378
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
6 years agosyscall, cmd/go/internal/lockedfile: remove Flock syscall for aix/ppc64
Clément Chigot [Tue, 4 Dec 2018 08:03:32 +0000 (09:03 +0100)]
syscall, cmd/go/internal/lockedfile: remove Flock syscall for aix/ppc64

AIX doesn't provide flock() syscall, it was previously emulated by fcntl
calls. However, there are some differences between a flock() syscall and
a flock() using fcntl. Therefore, it's safer to remove it and just
provide FcntlFlock.

Thus, lockedfile implementation must be moved to use FcntlFlock on aix/ppc64.

Updates #29065.
Fixes #29084.

Change-Id: Ic48fd9f315f24c2acdf09b91d917da131a1f2dd5
Reviewed-on: https://go-review.googlesource.com/c/152397
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years agocmd/go: add missing gccgo checks for buildmodeInit
Lynn Boger [Mon, 3 Dec 2018 22:02:20 +0000 (17:02 -0500)]
cmd/go: add missing gccgo checks for buildmodeInit

Some recent failures in gccgo on linux/ppc64 identified
an error in buildmodeInit when buildmode=c-archive.
A fix went into gofrontend, and this is the
corresponding change for master. This change also includes
two other updates related to gccgo in this function that
were in the file from gofrontend but missing from master.

Updates #29046

Change-Id: I9a894e7d728e31fb9e9344cd61d50408df7faf4a
Reviewed-on: https://go-review.googlesource.com/c/152160
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>