Ian Lance Taylor [Mon, 30 Jan 2023 23:43:25 +0000 (15:43 -0800)]
cmd/link: rewrite (*BuildMode).Set to use platform.BuildModeSupported
Change-Id: I7aa2bb4560198a7d9d9e4321f60dec38f6834bdc
Reviewed-on: https://go-review.googlesource.com/c/go/+/463745 Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Ian Lance Taylor [Mon, 30 Jan 2023 20:09:33 +0000 (12:09 -0800)]
cmd/link: rename ELF struct fields to remove "elf" prefix
While we're here rename setupplt to setupPLT.
This is a pure naming change with no semantic change.
Change-Id: Ib0312fb6568475b620dab7632438b4d25e4d9cc0
Reviewed-on: https://go-review.googlesource.com/c/go/+/463744 Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Ian Lance Taylor [Sun, 29 Jan 2023 04:05:53 +0000 (20:05 -0800)]
cmd/link, cmd/dist, internal/platform: consolidate c-archive support
Make all the tests for whether -buildmode=c-archive is supported consistent.
Base this on the historical code, on whether cmd/compile supports -shared,
and whether cmd/link permits the mode.
Change-Id: Ib996546906f698ade4c32b8e6c705838e4ad4b90
Reviewed-on: https://go-review.googlesource.com/c/go/+/463984 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Ian Lance Taylor [Sun, 29 Jan 2023 03:56:41 +0000 (19:56 -0800)]
cmd/link: skip c-archive tests if c-archive mode is not supported
Change-Id: If0e034d9ebf2baeb89cb52b22aedbe923cc703ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/463983 Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Ian Lance Taylor [Sun, 29 Jan 2023 03:55:19 +0000 (19:55 -0800)]
cmd/link: make .dynamic section read-only for MIPS ELF
For #36435
Change-Id: Ie733b641f20ca5bcee3784c088eb27699890a151
Reviewed-on: https://go-review.googlesource.com/c/go/+/463982 Reviewed-by: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
Ian Lance Taylor [Mon, 30 Jan 2023 23:09:21 +0000 (15:09 -0800)]
cmd/dist: test goos, not gohostos, in tester.extLink
This error dates back to when the method was introduced in CL 6531.
It only matters for the rare case of building tests on one GOOS and
running them on another, and only makes a difference for the rare case
where one GOOS supports external linking and another does not.
Change-Id: I1a7abfb0a5bbec49ddbcd9c1a4f5c0ec43a8095c
Reviewed-on: https://go-review.googlesource.com/c/go/+/463991 Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Kevin Burke [Sun, 29 Jan 2023 03:56:34 +0000 (19:56 -0800)]
strconv: show what fmt package uses for float printing
The strconv docs are not very helpful for people who just want to pick
a reasonable default, for example the one used by the fmt package to
show floats.
Add an example illustrating what the fmt package uses.
Change-Id: Iefefa70dfd4d4bfa9962a20654ee23662818ef38
Reviewed-on: https://go-review.googlesource.com/c/go/+/463980
Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Bryan C. Mills [Fri, 27 Jan 2023 20:33:48 +0000 (15:33 -0500)]
cmd/dist: set GOFLAGS=-trimpath when building cmd for releases
Also set it on the Go builders, so that the builders more closely
match releases.
It looks like this change was intended to be included in CL 454836,
but was commented out at some point — perhaps during debugging? —
before that change was merged.
Than McIntosh [Mon, 12 Dec 2022 16:04:05 +0000 (11:04 -0500)]
cmd/link: load host archive libc_nonshared.a for -fstack-protector
For internal linking, at the point where we finish reading libgcc.a,
if the symbol "__stack_chk_local" is still undefined, then read
in the host archive libc_nonshared.a as well.
Updates #57261.
Change-Id: I0b1e485aa50aa7940db8cabcb3b9a7959bf99ce7
Reviewed-on: https://go-review.googlesource.com/c/go/+/456856 Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Bryan C. Mills [Fri, 27 Jan 2023 20:25:57 +0000 (15:25 -0500)]
cmd/dist: leave cgo enabled if external linking is required
Certain ios and android configurations do not yet support internal
linking.
On ios, attempting to build without cgo causes tests to fail on
essentially every run (#57961).
On android, it produces a lot of warning spam from the linker,
obscuring real problems.
Since external linking makes the result of `go install` depend on the
installed C toolchain either way, the reproducibility benefit of
disabling cgo seems minimal on these platforms anyway.
qmuntal [Thu, 19 Jan 2023 15:17:56 +0000 (16:17 +0100)]
cmd/internal/obj/x86: use push/pop instead of mov to store/load FP
This CL changes how the x86 compiler stores and loads the frame pointer
on each function prologue and epilogue, with the goal to reduce the
final binary size without affecting performance.
The compiler is currently using MOV instructions to load and store BP,
which can take from 5 to 8 bytes each.
This CL changes this approach so it emits PUSH/POP instructions instead,
which always take only 1 byte each (when operating with BP). It can also
avoid using the SUBQ/ADDQ to grow the stack for functions that have
frame pointer but does not have local variables.
On Windows, this CL reduces the go toolchain size from 15,697,920 bytes
to 15,584,768 bytes, a reduction of 0.7%.
Example of epilog and prologue for a function with 0x10 bytes of
local variables:
Before
===
SUBQ $0x18, SP
MOVQ BP, 0x10(SP)
LEAQ 0x10(SP), BP
... function body ...
MOVQ 0x10(SP), BP
ADDQ $0x18, SP
RET
===
After
===
PUSHQ BP
LEAQ 0(SP), BP
SUBQ $0x10, SP
... function body ...
MOVQ ADDQ $0x10, SP
POPQ BP
RET
===
Updates #6853
Change-Id: Ice9e14bbf8dff083c5f69feb97e9a764c3ca7785
Reviewed-on: https://go-review.googlesource.com/c/go/+/462300 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Michael Anthony Knyszek [Mon, 30 Jan 2023 17:51:32 +0000 (17:51 +0000)]
doc: move Go 1.20 release notes to x/website
Now that the development of the Go 1.20 release is almost done, its
release notes are moved to their eventual long-term home in x/website
in CL 464075. Delete the initial development copy here.
For golang/go#54202.
Change-Id: Ia402d1abd4539fbce415e2a7dffd6709186f08a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/464055
Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Ian Lance Taylor [Fri, 27 Jan 2023 20:01:38 +0000 (12:01 -0800)]
cmd/link: refactor ELF hooks into ELFArch struct
This is a pure cleanup to bring the ELF hooks together.
Change-Id: I01d5227c70f30e4a659dcd7904e7c247266e95b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/463981
Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Joel Sing <joel@sing.id.au>
Russ Cox [Mon, 30 Jan 2023 18:21:34 +0000 (13:21 -0500)]
cmd/go: add and use cmd/go/internal/slices.Clip
This will be part of the standard library soon and then
cmd/go can use it directly, but I am writing a few more instances
of this pattern today and wanted to clean these up first.
cuiweixie [Sun, 29 Jan 2023 08:42:17 +0000 (16:42 +0800)]
encoding/binary: add String and GoString method to nativeEndian
Updates #57237
Change-Id: Ib626610130cae9c1d1aff5dd2a5035ffde0e127f
Reviewed-on: https://go-review.googlesource.com/c/go/+/463985 Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Johan Brandhorst-Satzkorn [Sat, 28 Jan 2023 06:50:54 +0000 (22:50 -0800)]
net/http: disable fetch on NodeJS
NodeJS 18 introduced support for the fetch API for
making HTTP requests. This broke all wasm tests
that were relying on NodeJS falling back to the fake
network implementation in net_fake.go. Disable
the fetch API on NodeJS to get tests passing.
Fixes #57613
Change-Id: Icb2cce6d5289d812da798e07366f8ac26b5f82cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/463976 Reviewed-by: Evan Phoenix <evan@phx.io>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Johan Brandhorst-Satzkorn [Sat, 28 Jan 2023 06:48:57 +0000 (22:48 -0800)]
misc/wasm: use NodeJS performance library
The upgrade to NodeJS 18 introduces various library
updates that mean we can no longer override the global
performance package. Instead, rely on the performance
library provided by the NodeJS runtime.
Fixes #57516
Change-Id: Ic8ed902c696ad154f676e0b74b42efb84f02f8db
Reviewed-on: https://go-review.googlesource.com/c/go/+/463234
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Evan Phoenix <evan@phx.io> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Bryan C. Mills [Wed, 11 Jan 2023 22:27:56 +0000 (17:27 -0500)]
cmd/dist: skip building std for the host when cross-compiling
The purpose of building the host toolchain is so that we can use it to
build and test the target configuration.
The host configuration should already be tested separately (with its
own builder), so we do not need to build the parts of that
configuration that are not relevant to the task of building and
testing the target configuration.
Bryan C. Mills [Tue, 22 Nov 2022 16:40:42 +0000 (11:40 -0500)]
cmd/dist: skip rebuilding packages during builder testing
Since packages in "std" no longer have install targets, checking them
for staleness is somewhat meaningless: if they are not cached they
will be rebuilt anyway, and without installed archives against which
we can compare them the staleness check will not detect builder skew.
It would still be meaningful to check "cmd" for staleness, but
(especially on sharded VM-based builders) that is a fairly expensive
operation relative to its benefit. If we are really interested in
detecting builder skew and/or build reproducibility, we could instead
add a "misc" test (similar to "misc/reboot", or perhaps even a part of
that test) that verifies that bootstrapped binaries are reproducible.
Russ Cox [Sat, 14 Jan 2023 18:57:52 +0000 (13:57 -0500)]
cmd: import latest golang.org/x/tools
go get golang.org/x/tools@ff9bea528a4d (CL 462817, 2023-01-19)
go mod tidy
go mod vendor
This sets up for using passes/directive in cmd/vet
(that CL will add those actual files, with a new go mod vendor).
Note that it also brings in golang.org/x/sys@17fce3a (CL 463675, 2023-01-26),
to get v0.4.0 with the bug fixed in that CL to keep the build working.
The update of x/sys is in both std and cmd to keep them in sync.
Michael Pratt [Fri, 16 Dec 2022 18:43:16 +0000 (13:43 -0500)]
cmd/internal/obj: drop Filesym from DwarfAbstractFunc
PutAbstractFunc doesn't use FnState.Filesym, so it isn't needed, but
more importantly it is misleading. DwarfAbstractFunc is frequently used
on inlined functions from outside the current compilation unit. For
those function, ctxt.fileSymbol returns nil, meaning it probably isn't
safe to use if the original compilation unit could also generate an
abstract func with the correct file symbol.
Change-Id: I0e6c76e41d75ac9ca07e0f775e49d791249e1c5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/458198 Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
Michael Pratt [Thu, 15 Dec 2022 22:17:01 +0000 (17:17 -0500)]
cmd/link/internal/ld: add dwarf testing helpers
Many tests build a program just to analyze it with dwtest.Examiner. Add
gobuildAndExamine, a helper that returns Examiner directly to reduce
duplication in these tests.
Many tests also lookup the DIE for a specific subprogram, which includes
several verification steps. Package those up in findSubprogramDIE.
Change-Id: I72202ba289ae8389b682be525ff7e6cfbfc00ff3
Reviewed-on: https://go-review.googlesource.com/c/go/+/458196 Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Michael Pratt [Thu, 12 Jan 2023 21:55:19 +0000 (16:55 -0500)]
all: give nested modules fully-qualified names
The two crypto modules are both named "asm". If both are included in a
single go.work (e.g., from `go work use -r .` in the repo), builds break
from "module asm appears multiple times in workspace".
Give these modules fully-qualified names to avoid conflicts. While we
are here, also expand the name of two other testdata modules. Those
modules don't currently conflict, but they have vague names at risk of
future conflicts.
Fixes #57769.
Change-Id: I2bd8a505051e92348d49560ec698ed921f2c81be
Reviewed-on: https://go-review.googlesource.com/c/go/+/461896 Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Michael Pratt [Wed, 14 Dec 2022 18:36:19 +0000 (13:36 -0500)]
cmd/compile,cmd/link: set DW_AT_decl_line for function declarations
DW_AT_decl_line provides the line number of function declarations (the
line containing the func keyword). This is the equivalent to CL 429638,
but provided via DWARF.
Note that the file of declarations (DW_AT_decl_file) is already provided
for non-inlined functions. It is omitted for inlined functions because
those DWARF subprograms may be generated outside of their source
compilation unit, where referencing the file table is difficult.
Fixes #57308.
Change-Id: I3ad12e1f366c4465c2a588297988a5825ef7efec
Reviewed-on: https://go-review.googlesource.com/c/go/+/458195
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
CL 463219 broke TestAllDependencies because zsyscall_windows.go
was not correctly formatted, probably edited by hand.
The failure was not catch by the CL builders because it is
only failing on linux longtests builders, which was not executed.
Windows builders skip that test because it lacks of the `diff` command.
qmuntal [Fri, 27 Jan 2023 20:53:06 +0000 (21:53 +0100)]
internal/poll: don't queue port completion entry for udp on windows
This CL sets the FILE_SKIP_COMPLETION_PORT_ON_SUCCESS notification mode
for all udp and tcp networks.
When SetFileCompletionNotificationModes was implemented, back in
go 1.2 [1], it was not possible to enable this mode on udp connections
because it is buggy on Windows 7 and earlier. The bug was fixed on
Windows 8. We can safely enable this mode now, since go 1.21
will require Windows 10 or higher.
While here, I noticed that this mode is only enabled for tcp, but not
for tcp4 nor tcp6. I don't think this restriction makes sense, so I'm
lifting it.
Thanonchai W [Fri, 27 Jan 2023 05:54:48 +0000 (05:54 +0000)]
os: use GetTempPath2 on Windows if available
This generates GetTempPath2. Go now tries to determine if the windows it runs on has GetTempPath2 by finding it only once at the loading time. If GetTempPath2 exists, it sets the flag so that any calls to tempDir will use it. If it doesn't exist, Go then uses GetTempPath.
GetTempPath2 was generated into internal/syscall/windows since syscall is locked down.
Daniela Petruzalek [Wed, 4 Jan 2023 15:26:03 +0000 (15:26 +0000)]
os: fix findOneDriveDir to expand strings that contain environment variables
On Windows the registry data type REG_EXPAND_SZ indicates that the string requires expansion
of environment variables. The existing implementation doesn't take that into consideration
and just returns the unexpanded string, ignoring the registry type. This implementation ensures
that environment variables are properly expanded when needed.
Keith Randall [Fri, 27 Jan 2023 23:43:52 +0000 (15:43 -0800)]
cmd/compile: fix -m=2 output for recursive function with closures
ir.VisitFuncsBottomUp returns recursive==true for functions which
call themselves. It also returns any closures inside that function.
We don't want to report the closures as recursive, as they really
aren't. Only the containing function is recursive.
Fixes #54159
Change-Id: I3b4d6710a389ec1d6b250ba8a7065f2e985bdbe1
Reviewed-on: https://go-review.googlesource.com/c/go/+/463233 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
Bryan C. Mills [Fri, 27 Jan 2023 21:03:27 +0000 (16:03 -0500)]
cmd/dist: remove dead code for META_BUILDLET_HOST_TYPE
This environment variable appears to never be used; according to
https://cs.opensource.google/search?q=META_BUILDLET_HOST_TYPE&ss=go&ssfr=1
this is the only reference to it in the whole Go project.
Paul E. Murphy [Tue, 24 Jan 2023 17:38:29 +0000 (11:38 -0600)]
test/codegen: merge identical ppc64 and ppc64le tests
Manually consolidate the remaining ppc64/ppc64le test which
are not so trivial to automatically merge.
The remaining ppc64le tests are limited to cases where load/stores are
merged (this only happens on ppc64le) and the race detector (only
supported on ppc64le).
Change-Id: I1f9c0f3d3ddbb7fbbd8c81fbbd6537394fba63ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/463217 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Paul E. Murphy [Wed, 25 Jan 2023 17:53:10 +0000 (11:53 -0600)]
test/codegen: combine trivial PPC64 tests into ppc64x
Use a small python script to consolidate duplicate
ppc64/ppc64le tests into a single ppc64x codegen test.
This makes small assumption that anytime two tests with
for different arch/variant combos exists, those tests
can be combined into a single ppc64x test.
E.x:
// ppc64le: foo
// ppc64le/power9: foo
into
// ppc64x: foo
or
// ppc64: foo
// ppc64le: foo
into
// ppc64x: foo
import glob
import re
files = glob.glob("codegen/*.go")
for file in files:
with open(file) as f:
text = [l for l in f]
i = 0
while i < len(text):
first = re.match("\s*// ?ppc64(le)?(/power[89])?:(.*)", text[i])
if first:
j = i+1
while j < len(text):
second = re.match("\s*// ?ppc64(le)?(/power[89])?:(.*)", text[j])
if not second:
break
if (not first.group(2) or first.group(2) == second.group(2)) and first.group(3) == second.group(3):
text[i] = re.sub(" ?ppc64(le|x)?"," ppc64x",text[i])
text=text[:j] + (text[j+1:])
else:
j += 1
i+=1
with open(file, 'w') as f:
f.write("".join(text))
cuiweixie [Wed, 25 Jan 2023 03:22:29 +0000 (11:22 +0800)]
encoding/binary: add var NativeEndian
Updates #57237
Change-Id: I149c8b7eeac91b87b5810250f96d48ca87135807
Reviewed-on: https://go-review.googlesource.com/c/go/+/463218 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: xie cui <523516579@qq.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Bryan C. Mills [Thu, 8 Dec 2022 20:23:32 +0000 (15:23 -0500)]
syscall: avoid making assumptions about syscall permissions
We currently check for at least three different permission bits before
running tests that require root permissions: we look for UID 0, lack
of an LXC container, and lack of a Docker container, and probe a
number of distro-specific files in /proc and /sys.
The sheer number of these checks suggests that we have probably missed
at least one. Per Alan J. Perlis, “If you have a procedure with ten
parameters, you probably missed some.” (And, indeed, we definitely
have: a Debian patch¹ adds one more environment check!)
CL 58170 added some of these container checks, but “decided to go this
way instead of just skipping os.IsPermission errors because many of
those tests were specifically written to check false positive
permission errors.” However, we can't in general distinguish between a
false-positive error and a real one caused by a container: if one is
making a change to the syscall package, they should run the tests with
-v and check for unexpected skips.
Notably:
- TestUnshare already skips itself if the command fails with an error
ending in the string "operation not permitted", which could be caused
by a variety of possible bugs.
- The Unshare tests added in CL 38471 will fail with a permission
error if CLONE_NEWNS is not supported, but it seems to me that if
CLONE_NEWNS is supported — sufficient to start the process! — then
Unmount must also be supported, and the test can at least check that
the two are consistent.
- The AmbientCaps tests should fail to start the subprocess with
EINVAL or similar (not produce bogus output) if the kernel does not
support ambient caps for any reason, which we can then detect.
(If the subprocess fails in the way the test is concerned about, it
will exit with status 2, not fail to start in the first place.)
By executing the system calls and checking for permission errors,
this change exposed an existing bug for AmbientCaps (filed as #57208),
which was detected by the linux-arm-aws builder.
Benjamin Prosnitz [Fri, 13 Jan 2023 16:54:35 +0000 (11:54 -0500)]
hex: fix panic in Decode when len(src) > 2*len(dst)
hex.Decode never checks the length of dst and triggers a panic
if there are insufficient bytes in the slice.
There isn't document on what the behavior *should* be in this case.
Two possibilities:
1. Error dst has insufficient space (as done in this change)
2. Reduce the length of the decode to min(dst, src)
Option 1 was chosen because it seems the least surprising or
subtle.
Change-Id: I3bf029e3d928202de716830434285e3c165f26dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/461958 Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Benjamin Prosnitz <bprosnitz@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Robert Griesemer [Thu, 26 Jan 2023 21:20:34 +0000 (13:20 -0800)]
go/types, types2: simplify unifier
The unifier was written such that it was possible to specify
a different set of type parameters (declared by different
generic declarations) for each type x, y being unified,
to allow for what is called "bidirectional unification"
in the documentation (comments).
However, in the current implementation, this mechanism is
not used:
- For function type inference, we only consider the
type parameter list of the generic function (type parameters
that appear in the arguments are considered stand-alone types).
We use type parameter renaming to avoid any problems in case
of recursive generic calls that rely on type inference.
- For constraint type inference, the type parameters for the
types x and y (i.e., the type parameter and its constraint)
are the same and had to be explicitly set to be identical.
This CL removes the ability to set separate type parameter
lists. Instead a single type parameter list is used during
unification and is provided when we initialize a unifier.
As a consequence, we don't need to maintain the separate
tparamsList data structure: since we have a single list
of type parameters we can keep it directly in the unifier.
Adjust all the unifier code accordingly and update comments.
As an aside, remove the `exact` flag from the unifier as it
was never set. However, keep the functionality for now and
use a constant (exactUnification) instead. This makes it
easy to find the respectice code without incurring any cost.
Change-Id: I969ba6dbbed2d65d06ba4e20b97bdc362c806772
Reviewed-on: https://go-review.googlesource.com/c/go/+/463223 Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This CL simplifies and removes some old noding code, which isn't
necessary any more.
Most notably, we no longer need separate posMaps for each noder,
because noders are only used for parsing now. Before we started using
types2, noders were also responsible for constructed (untyped) IR, so
posMaps were necessary to translate syntax.Pos into src.XPos.
Change-Id: Ic761abcd727f5ecefc71b611635a0f5b088c941f
Reviewed-on: https://go-review.googlesource.com/c/go/+/463738
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Matthew Dempsky [Tue, 20 Dec 2022 19:23:23 +0000 (11:23 -0800)]
cmd/compile: apply FixVariadicCall and FixMethodCall during typecheck
To simplify backend analysis, we normalize variadic and method calls:
variadic calls are rewritten with an explicit slice argument, and
method calls are turned into function calls that pass the receiver
argument as the first parameter.
But because we've been supporting multiple frontends, this
normalization was scattered in various later passes. Now that we're
back to just one frontend, we can move the normalization forward into
typecheck (where most other IR normalization already happens).
Change-Id: Idd05ae231fc180ae3dd1664452414f6b6d578962
Reviewed-on: https://go-review.googlesource.com/c/go/+/463737
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org>
Mateusz Poliwczak [Sat, 3 Dec 2022 13:50:45 +0000 (13:50 +0000)]
net: report completed when context is done in cgoLookupIP and cgoLookupPTR
All the Lookup* methods that resolve hostnames eventually call lookupIP
or lookupHost method. When the order is selected to be hostLookupCGO
then lookupHost calls cgoLookupHost which internally calls cgoLookupIP
(the lookupIP directly calls cgoLookupIP).
When we provide a context that is cancelled after cgo call, then the
cgoLookupIP returns completed == false, which caues the
lookupIP/lookupHost to fallback to the go resolver.
This fallback is unnecessary because our context is already cancelled.
The same thing can happen to LookupAddr.
Change-Id: Ifff7716c461f05d954ef43b5205865103558b410
GitHub-Last-Rev: 2ef2023e8c51cdd251986f79e94aba86a0722230
GitHub-Pull-Request: golang/go#57042
Reviewed-on: https://go-review.googlesource.com/c/go/+/454696
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Bryan C. Mills [Tue, 22 Nov 2022 18:45:12 +0000 (13:45 -0500)]
cmd/dist: require absolute path to executable in flattenCommandLine
This should help to prevent bugs from unintended use of system tools,
especially the system or bootstrap "go" command.
(Suggested by Austin on CL 452678.)
Matthew Dempsky [Tue, 3 Jan 2023 20:11:44 +0000 (12:11 -0800)]
cmd/compile/internal/inline: adjust isBigFunc to recognize unified IR codegen
Unified IR generates uniform IR for "a, b = f()" to be able to insert
implicit conversion expressions, but the result is somewhat more
verbose and trips up the inliner's naive cost metrics.
The hairyVisitor.doNode method was already adjusted to account for
this, but isBigFunc needs the same adjustment.
Bryan C. Mills [Tue, 22 Nov 2022 15:12:18 +0000 (10:12 -0500)]
cmd/dist: consistently use $GOROOT/bin/go instead of just "go"
Also remove existing special cases that transform "go" into
gorootBinGo, because they make debugging and code-reviews more
difficult: log messages that don't include the full path can mask bugs
like #31567, and the reader of the code has to trace through the
various call chains to verify that the correct "go" is being used.
Instead, we can make the use of the correct "go" command plainly
obvious in the code by using one consistent name for it.
(Prior to this CL, we had three different names for it:
gorootBinGo, "go", and cmdGo. Now we have only one.
Sym.Def used to be used for symbol resolution during the
old (pre-types2) typechecker. But since moving to types2-based IR
construction, we haven't really had a need for Sym.Def to ever refer
to anything but the package-scope definition, because types2 handles
symbol resolution for us.
This CL finally removes the Markdcl/Pushdcl/Popdcl functions that have
been a recurring source of issues in the past.
Change-Id: I2b012a0f17203efdd724ebd1e9314bd128cc2d61
Reviewed-on: https://go-review.googlesource.com/c/go/+/458625
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
This CL removes a handful of features that were only needed for the
pre-unified frontends.
In particular, Type.Pkg was a hack for iexport so that
go/types.Var.Pkg could be precisely populated for struct fields and
signature parameters by gcimporter, but it's no longer necessary with
the unified export data format because we now write export data
directly from types2-supplied type descriptors.
Several other features (e.g., OrigType, implicit interfaces, type
parameters on signatures) are no longer relevant to the unified
frontend, because it only uses types1 to represent instantiated
generic types.
Updates #57410.
Change-Id: I84fd1da5e0b65d2ab91d244a7bb593821ee916e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/458622 Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Keith Randall <khr@golang.org>
Matthew Dempsky [Fri, 2 Dec 2022 01:24:40 +0000 (17:24 -0800)]
cmd/compile/internal/types: remove TTYPEPARAM and TUNION types
These were used by the nounified frontend for representing
uninstantiated generic types; however, the unified frontend only needs
types1 to represent instantiated types.
Updates #57410.
Change-Id: Iac417fbf2b86f4e08bd7fdd26ae8ed17395ce833
Reviewed-on: https://go-review.googlesource.com/c/go/+/458621
Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
In the types1 universe under the unified frontend, we never need to
worry about type parameter constraints, so we only see pure
interfaces. However, we might still see interfaces that contain union
types, because of interfaces like "interface{ any | int }" (equivalent
to just "any").
We can handle these without needing to actually represent type unions
within types1 by simply mapping any union to "any".
Updates #57410.
Change-Id: I5e4efcf0339edbb01f4035c54fb6fb1f9ddc0c65
Reviewed-on: https://go-review.googlesource.com/c/go/+/458619
Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Robert Griesemer [Thu, 26 Jan 2023 19:22:26 +0000 (11:22 -0800)]
go/types, types2: remove misleading example from comment
Before this CL, the comment used the case of a recursive generic
function call as an example for uni-directional unification.
However, such cases are now more generally (and correctly) addressed
through renaming of the type parameters.
Change-Id: I69e94f53418e1fb4ca9431aeb27c639c40d19b09
Reviewed-on: https://go-review.googlesource.com/c/go/+/463735 Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
qmuntal [Mon, 2 Jan 2023 14:54:44 +0000 (15:54 +0100)]
runtime: use explicit NOFRAME on darwin/amd64
This CL marks some darwin assembly functions as NOFRAME to avoid relying
on the implicit amd64 NOFRAME heuristic, where NOSPLIT functions
without stack were also marked as NOFRAME.
Change-Id: I797f3909bcf7f7aad304e4ede820c884231e54f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/460235 Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Matthew Dempsky [Fri, 2 Dec 2022 00:33:59 +0000 (16:33 -0800)]
cmd/compile: change some unreachable code paths into Fatalf
Now that GOEXPERIMENT=nounified is removed, we can assume InlineCall
and HaveInlineBody will always be overridden with the unified
frontend's implementations. Similarly, we can assume expandDecl will
never be called.
This CL changes the code paths into Fatalfs, so subsequent CLs can
remove all the unreachable code.
Updates #57410.
Change-Id: I2a0c3edb32916c30dd63c4dce4f1bd6f18e07468
Reviewed-on: https://go-review.googlesource.com/c/go/+/458618
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Keith Randall <khr@golang.org>
Matthew Dempsky [Fri, 2 Dec 2022 00:43:05 +0000 (16:43 -0800)]
cmd/compile: remove -d=typecheckinl flag
This flag forced the compiler to eagerly type check all available
inline function bodies, which presumably was useful in the early days
of implementing inlining support. However, it shouldn't have any
significance with the unified frontend, since the same code paths are
used for constructing normal function bodies as for inlining.
Updates #57410.
Change-Id: I6842cf86bcd0fbf22ac336f2fc0b7b8fe14bccca
Reviewed-on: https://go-review.googlesource.com/c/go/+/458617 Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Matthew Dempsky [Tue, 20 Dec 2022 20:00:36 +0000 (12:00 -0800)]
cmd/compile/internal/pkginit: remove dependency on typecheck.Resolve
The use of typecheck.Resolve was previously necessary to interoperate
with the non-unified frontend, because it hooked into iimport. It's no
longer necessary with unified IR, where we can just lookup the
".inittask" symbol and access Def directly.
Updates #57410.
Change-Id: I73bdfd53f65988ececd2b777743cd8b591a6db48
Reviewed-on: https://go-review.googlesource.com/c/go/+/458616
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Keith Randall <khr@golang.org>
Keith Randall [Thu, 5 Jan 2023 21:02:44 +0000 (13:02 -0800)]
cmd/compile: improve register overwrite decision for resultInArg0 ops
When we're compiling a resultInArg0 op, we need to clobber the
register containing the input value. So we first make a register copy
of the input value. We can then clobber either of the two registers
the value is in and still have the original input value in a register
for future uses.
Before this CL, we always clobbered the original, not the copy.
But that's not always the right decision - if the original is already
in a specific register that it needs to be in later (typically, a
return value register), clobber the copy instead.
This optimization can remove a mov instruction. It saves 1376 bytes
of instructions in cmd/go.
Redo of CL 460656, reverted at CL 463475, with a fix for s390x.
The new code just ensures that the copied value is in a register
which is a valid input register for the instruction.
Change-Id: Id570b8a60a6d2da9090de80a90b6bb0266e9e38a
Reviewed-on: https://go-review.googlesource.com/c/go/+/463221
Auto-Submit: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Matthew Dempsky [Fri, 2 Dec 2022 00:14:11 +0000 (16:14 -0800)]
cmd: remove GOEXPERIMENT=nounified knob
This CL removes the GOEXPERIMENT=nounified knob, and any conditional
statements that depend on that knob. Further CLs to remove unreachable
code follow this one.
Updates #57410.
Change-Id: I39c147e1a83601c73f8316a001705778fee64a91
Reviewed-on: https://go-review.googlesource.com/c/go/+/458615
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Bryan C. Mills [Tue, 10 Jan 2023 16:49:37 +0000 (11:49 -0500)]
context: eliminate arbitrary timeouts in examples
ExampleWithDeadline and ExampleWithTimeout used an arbitrary 1-second
timeout for a “blocked” select case, which could fail if the test
goroutine happens to be descheduled for over a second, or perhaps if
an NTP synchronization happens to jump by a second at just the right
time.
Either case is plausible, especially on a heavily-loaded or slow
machine (as is often the case for builders for unusual ports).
Instead of an arbitrary timeout, use a “ready” channel that is never
actually ready.
Bryan C. Mills [Wed, 25 Jan 2023 16:53:03 +0000 (11:53 -0500)]
os: eliminate arbitrary timeout in testClosewithBlockingRead
The 1-second timeout on execution of this test is empirically too
short on some platforms. Rather than trying to tune the timeout, allow
the test to time out on its own (and dump goroutines) if it deadlocks.
Ian Lance Taylor [Mon, 27 Jun 2022 21:58:58 +0000 (14:58 -0700)]
cmd/link: don't export all symbols for ELF external linking
Since this may add a large number of --export-dynamic-symbol options,
use a response file if the command line gets large.
Fixes #53579
Change-Id: Ic226bf372bf1e177a3dae886d1c48f4ce3569c0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/414654 Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Joedian Reid <joedian@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Keith Randall [Thu, 5 Jan 2023 21:02:44 +0000 (13:02 -0800)]
cmd/compile: improve register overwrite decision for resultInArg0 ops
When we're compiling a resultInArg0 op, we need to clobber the
register containing the input value. So we first make a register copy
of the input value. We can then clobber either of the two registers
the value is in and still have the original input value in a register
for future uses.
Before this CL, we always clobbered the original, not the copy.
But that's not always the right decision - if the original is already
in a specific register that it needs to be in later (typically, a
return value register), clobber the copy instead.
This optimization can remove a mov instruction. It saves 1376 bytes
of instructions in cmd/go.
Change-Id: I162870c84b9a180da6715bb24c296a902974fed3
Reviewed-on: https://go-review.googlesource.com/c/go/+/460656 Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
Heschi Kreinick [Wed, 25 Jan 2023 17:48:54 +0000 (12:48 -0500)]
internal/testpty: fix error handling
When calling a c library function, you discover that an error has
occurred, typically by looking at the return value of the function. Only
after that can you use errno to figure out the cause of the error.
Nothing about cgo changes that story -- you still have to look at the
result before checking the error that represents errno. If not you can
get false errors if the function happens to leak a non-zero errno.
Bryan C. Mills [Tue, 24 Jan 2023 14:05:36 +0000 (09:05 -0500)]
os: make Lstat for symlinks on Windows consistent with POSIX
This also makes path/filepath.Walk more consistent between
Windows and POSIX platforms.
According to
https://pubs.opengroup.org/onlinepubs/9699919799.2013edition/basedefs/V1_chap04.html#tag_04_12
symlinks in a path that includes a trailing slash must be resolved
before a function acts on that path.
POSIX defines an lstat function, whereas the Win32 API does not, so
Go's os.Lstat should follow the (defined) POSIX semantics instead of
doing something arbitrarily different.
CL 134195 added a test for the correct POSIX behavior when os.Lstat is
called on a symlink. However, the test turned out to be broken on Windows,
and when it was fixed (in CL 143578) it was fixed with different Lstat
behavior on Windows than on all other platforms that support symlinks.
In #50807 we are attempting to provide consistent symlink behavior for
cmd/go. This unnecessary platform difference, if left uncorrected,
will make that fix much more difficult.
CL 460595 reworked the implementation of Stat and Lstat on Windows,
and with the new implementation this fix is straightforward.
Than McIntosh [Thu, 28 Jul 2022 09:07:02 +0000 (05:07 -0400)]
runtime/race: update race_windows_amd64.syso
Update race_windows_amd64.syso to latest tsan (V3) runtime.
This version of the runtime depends on libsynchronization.a, so to
use this syso, you need to also be using a sufficiently up to date
version of GCC (notably GCC 5.1, installed on the Go windows builders
right now, does not include this library).
Updates #48231.
Updates #35006.
Fixes #49761.
Change-Id: Ia1e2b1d8fe7e2c99728150734935a2c522006caa
Reviewed-on: https://go-review.googlesource.com/c/go/+/420197 Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Than McIntosh <thanm@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Bryan C. Mills [Fri, 9 Dec 2022 17:30:24 +0000 (12:30 -0500)]
syscall: clean up variable declarations in forkAndExecInChild
The various forkAndExecInChild implementations have comments
explaining that they pre-declare variables to force allocations
to occur before forking, but then later use ":=" declarations
for additional variables.
To make it clearer that those ":=" declarations do not allocate,
we move their declarations up to the predeclared blocks.
hopehook [Tue, 3 Jan 2023 08:23:16 +0000 (16:23 +0800)]
bytes, strings: add ContainsFunc
Fixes #54386.
Change-Id: I78747da337ed6129e4f7426dd0483a644bed82e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/460216
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: hopehook <hopehook@golangcn.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Daniel Martí [Fri, 20 Jan 2023 21:53:34 +0000 (21:53 +0000)]
encoding/gob: slightly simplify init code
https://go.dev/cl/460543 stopped using the "expect" parameter in
bootstrapType, but we forgot to actually remove it.
While here, staticcheck correctly points out that we can use the copy
builtin to fill builtinIdToTypeSlice, now that it and idToType are an
array and slice respectively.
Change-Id: I48078415ab9bdd5633cf41f33ab4dc78eb30b48a
Reviewed-on: https://go-review.googlesource.com/c/go/+/462301
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Rob Pike <r@golang.org> Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>