]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
3 years ago[dev.fuzz] all: add codereview.cfg
Katie Hockman [Thu, 18 Feb 2021 21:16:29 +0000 (16:16 -0500)]
[dev.fuzz] all: add codereview.cfg

This will enable the new "git-codereview sync-branch" command.

Change-Id: Id2f933f6d13e181817c56d2548172a74b1d0b629
Reviewed-on: https://go-review.googlesource.com/c/go/+/293909
Trust: Katie Hockman <katie@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
3 years ago[dev.fuzz] internal/fuzz: remove duplicate read from testdata
Katie Hockman [Wed, 17 Feb 2021 19:56:47 +0000 (14:56 -0500)]
[dev.fuzz] internal/fuzz: remove duplicate read from testdata

We already read the seed corpus from testdata for the
fuzz target, and pass that corpus to the coordinator.
The coordinator doesn't need to read from testdata
again.

Change-Id: Ia7822e3e02b35d56f6918c7082a7b19901b36644
Reviewed-on: https://go-review.googlesource.com/c/go/+/293189
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
3 years ago[dev.fuzz] internal/fuzz: support corpus file encoding/decoding
Katie Hockman [Wed, 10 Feb 2021 18:05:59 +0000 (13:05 -0500)]
[dev.fuzz] internal/fuzz: support corpus file encoding/decoding

Change-Id: Id245ce5f154557f1744210e7d7f061d08901c746
Reviewed-on: https://go-review.googlesource.com/c/go/+/290951
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
3 years ago[dev.fuzz] testing: make F.Fuzz more similar to T.Run
Jay Conrod [Tue, 9 Feb 2021 15:08:48 +0000 (10:08 -0500)]
[dev.fuzz] testing: make F.Fuzz more similar to T.Run

This change rewrites much of the glue code in testing/fuzz.go to work
more analogously to T.Run. This results in improved behavior:

* If a fuzz target returns without calling F.Skip, F.Fail, or F.Fuzz,
  'go test' will report an error and exit non-zero.
* Functions registered with F.Cleanup are called.
* The user can re-run individual inputs using -run=FuzzTarget/name
  where name is the base name of the seed corpus file. We now print
  the 'go test' command after a crash.

This change doesn't correctly handle T.Parallel calls yet, but it
should be easier to do that in the future.

Highlighted parts of this change:

* Instead of creating one F for all targets, create an F for each
  target. F (actually common) holds the status, output, and cleanup
  function list for each target, so it's important to keep them
  separate.
* Run each target in its own goroutine via fRunner. fRunner is
  analogous to tRunner. It runs cleanups and catches inappropriate
  Goexits and panics.
* Run each input in its own goroutine via T.Run. This enables subtest
  filtering with -test.run and ensures functions registered with
  T.Cleanup (not F.Cleanup) are run at the appropriate time.

Change-Id: Iab1da14ead8bcb57746f8a76f4aebc625baa5792
Reviewed-on: https://go-review.googlesource.com/c/go/+/290693
Reviewed-by: Katie Hockman <katie@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>

3 years ago[dev.fuzz] testing: move inFuzzFn checks from common to F
Jay Conrod [Tue, 9 Feb 2021 22:32:08 +0000 (17:32 -0500)]
[dev.fuzz] testing: move inFuzzFn checks from common to F

inFuzzFn is set when the fuzz function is called. While it's set,
F methods that have side effects like Skip and Fail may not be called.

Previously, (CL 259657) inFuzzFn was in common, and we checked it in
the common implementation of those methods. This causes problems in
CL 290693 for recursive methods like common.Fail. If T.Fail is
called by the fuzz function, it calls common.Fail on the parent F's
common. That should not panic.

Change-Id: I841b12f77d9c77f5021370d03313e71b4ef50102
Reviewed-on: https://go-review.googlesource.com/c/go/+/290811
Trust: Jay Conrod <jayconrod@google.com>
Trust: Katie Hockman <katie@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
3 years ago[dev.fuzz] internal/fuzz: make RunFuzzWorker accept CorpusEntry
Jay Conrod [Tue, 9 Feb 2021 15:36:27 +0000 (10:36 -0500)]
[dev.fuzz] internal/fuzz: make RunFuzzWorker accept CorpusEntry

RunFuzzWorker now accepts a fuzz.CorpusEntry instead of []byte. This
may help us pass structured data in the future.

Change-Id: Idf7754cb890b6a835d887032fd23ade4d0713bcf
Reviewed-on: https://go-review.googlesource.com/c/go/+/290692
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
3 years ago[dev.fuzz] testing/internal/testdeps: use signal.NotifyContext
Jay Conrod [Tue, 9 Feb 2021 15:30:02 +0000 (10:30 -0500)]
[dev.fuzz] testing/internal/testdeps: use signal.NotifyContext

In RunFuzzWorker and CoordinateFuzzing, use signal.NotifyContext
(new in 1.16) to cancel the context in response to SIGINT. This is
shorter and more correct than what we were doing before.

Change-Id: Id7e9a58e9dd992dffb86e4e0f2e3efd117d03c47
Reviewed-on: https://go-review.googlesource.com/c/go/+/290691
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
3 years ago[dev.fuzz] internal/fuzz: worker exiting 0 should not be a crasher
Jay Conrod [Tue, 9 Feb 2021 15:23:40 +0000 (10:23 -0500)]
[dev.fuzz] internal/fuzz: worker exiting 0 should not be a crasher

If a worker process exits with status 0, treat it as a communication
error. Previously, we treated this as a crasher, but it seems more
likely to be caused by a bug in the fuzz function rather than a bug in
the code being tested.

Change-Id: I0c4efeaef85537f8a0e9c6def6aac41d75b2b307
Reviewed-on: https://go-review.googlesource.com/c/go/+/290690
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
3 years ago[dev.fuzz] cmd/go: call F.Fuzz from all fuzz script tests
Jay Conrod [Tue, 9 Feb 2021 15:15:02 +0000 (10:15 -0500)]
[dev.fuzz] cmd/go: call F.Fuzz from all fuzz script tests

Fuzz targets must call F.Skip, F.Fail, or F.Fuzz. F.Fuzz must not be
called more than once. If a fuzz target panics, calls runtime.Goexit,
or returns normally without calling one of those functions, the target
should panic, and 'go test' should exit with a non-zero status.

For now, this isn't checked. It will be fixed in a follow-up CL.

Change-Id: Ibb905954462b64af15332c285124d78a998f7762
Reviewed-on: https://go-review.googlesource.com/c/go/+/290689
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
3 years ago[dev.fuzz] cmd/go: skip fuzz tests on unsupported platforms
Jay Conrod [Tue, 9 Feb 2021 21:09:30 +0000 (16:09 -0500)]
[dev.fuzz] cmd/go: skip fuzz tests on unsupported platforms

For now, fuzzing is only supported on Darwin, Linux, and Windows. We
haven't testing shared memory communication between coordinator and
worker processes on other platforms. Currently, fuzz.CoordinateFuzzing
and RunFuzzWorker both panic with "unimplemented" messages.

Unfortunately, these may be masked by runtime.Goexit calls that
override panics, so some builders fail with

    test executed panic(nil) or runtime.Goexit

Change-Id: Ic7bd692461958626dd5c5bb31198aec86387bbd6
Reviewed-on: https://go-review.googlesource.com/c/go/+/290810
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
3 years ago[dev.fuzz] internal/fuzz: refactor CorpusEntry type
Jay Conrod [Mon, 1 Feb 2021 23:00:37 +0000 (18:00 -0500)]
[dev.fuzz] internal/fuzz: refactor CorpusEntry type

CorpusEntry is now a struct type with Name and Data fields. In the
future, it may have more fields describing multiple values with
different types added with f.Add.

CorpusEntry must be the same type in testing and
internal/fuzz. However, we don't want to export it from testing, and
testing can't import internal/fuzz. We define it to be a type alias of
a struct type instead of a defined type. We need to define it to the
same thing in both places. We'll get a type error when building cmd/go
if there's a difference.

Change-Id: I9df6cd7aed67a6aa48b77ffb3a84bd302d2e5d94
Reviewed-on: https://go-review.googlesource.com/c/go/+/288534
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
3 years ago[dev.fuzz] internal/fuzz: guard concurrent access to shared memory
Jay Conrod [Wed, 20 Jan 2021 22:09:59 +0000 (17:09 -0500)]
[dev.fuzz] internal/fuzz: guard concurrent access to shared memory

This change moves the worker's *sharedMem into a buffered chan that
acts as a mutex. The mutex can be locked by receiving from the chan;
it can be unlocked by sending *sharedMem back to the chan. Multiple
objects (like worker, workerClient, workerServer) may have references
to the chan and may hold the lock across several operations.

This is intended to fix a segfault that occurred when
workerClient.fuzz accessed shared memory after it was already closed
and unmapped by the worker's goroutine. workerClient.fuzz is executed
in a separate goroutine so the worker can still receive messages from
the coordinator (like being told to stop and clean up).

Change-Id: I4eb9079ba9e5bfcfacfecd0fc8ad9bed17b33bba
Reviewed-on: https://go-review.googlesource.com/c/go/+/285054
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Trust: Jay Conrod <jayconrod@google.com>

3 years ago[dev.fuzz] internal/fuzz: handle SIGINT races gracefully
Jay Conrod [Fri, 15 Jan 2021 19:43:25 +0000 (14:43 -0500)]
[dev.fuzz] internal/fuzz: handle SIGINT races gracefully

A worker process may be terminated by SIGINT if it doesn't install the
signal handler before SIGINT is delivered. That's likely when TestMain
or the fuzz target setup take a long time. The coordinator now ignores
these errors.

Also, when testdeps.TestDeps.CoordinateFuzzing and RunFuzzWorker
return, they will send a value on the chan passed to signal.Notify
instead of closing it. This should have been obvious in hindsight, but
the signal handler could still send a value on that channel after
those functions return but before the process exits.

Change-Id: Iea2589115f1f9bb7415bb5e7911defee423e642e
Reviewed-on: https://go-review.googlesource.com/c/go/+/284292
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Katie Hockman <katie@golang.org>
3 years ago[dev.fuzz] cmd/go/testdata: fix flaky test
Katie Hockman [Fri, 15 Jan 2021 16:26:34 +0000 (11:26 -0500)]
[dev.fuzz] cmd/go/testdata: fix flaky test

Change-Id: I7702aa12a1ed9bb0645af774dd584e661d7c8fa5
Reviewed-on: https://go-review.googlesource.com/c/go/+/284193
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
3 years ago[dev.fuzz] internal/fuzz: add sharedMem.setValueLen
Jay Conrod [Thu, 14 Jan 2021 23:22:41 +0000 (18:22 -0500)]
[dev.fuzz] internal/fuzz: add sharedMem.setValueLen

This method sets the len of the slice returned by valueRef. The worker
now uses this instead of setting the length in the header directly.

Unfortunately, we can't store the whole slice header in the shared
memory header because the pointer won't be valid across processes.

Change-Id: Icef24acfcd85e098cd8c23810568f04b13649a19
Reviewed-on: https://go-review.googlesource.com/c/go/+/284012
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
3 years ago[dev.fuzz] internal/fuzz: fix context cancellation for coordinator
Katie Hockman [Wed, 13 Jan 2021 19:43:30 +0000 (14:43 -0500)]
[dev.fuzz] internal/fuzz: fix context cancellation for coordinator

Previously, performing a SIGINT would cause the coordinator
to write a crash to testdata, and would continue to run
despite being interupted.

Also includes a few small cleanups.

Change-Id: Ia3cf7cd231c30ac9ad2a61f4935aa543e241f60d
Reviewed-on: https://go-review.googlesource.com/c/go/+/283634
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
3 years ago[dev.fuzz] internal/fuzz: implement a more robust mutator
Katie Hockman [Tue, 5 Jan 2021 21:01:49 +0000 (16:01 -0500)]
[dev.fuzz] internal/fuzz: implement a more robust mutator

This change also allocates a larger capacity (100 MB) for the shared
memory at the start, rather than beginning as small as possible and
immediately needing to grow while mutating. This means that 100 MB is
the maximum size of a corpus entry currently, since growing the shared
memory is not yet supported.

The code in internal/fuzz/mutator.go and internal/fuzz/pcg.go are copied
from, or heavily inspired by, code originally authored by Dmitry Vyukov
and Josh Bleecher Snyder as part of the go-fuzz project. Thanks to them
for their contributions. See https://github.com/dvyukov/go-fuzz.

Change-Id: I0d51d53976e23933072e760ff78e6c4ad9dcd862
Reviewed-on: https://go-review.googlesource.com/c/go/+/281972
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Trust: Katie Hockman <katie@golang.org>

3 years ago[dev.fuzz] cmd/go: implement -fuzztime flag and support cancellation
Jay Conrod [Thu, 17 Dec 2020 22:25:42 +0000 (17:25 -0500)]
[dev.fuzz] cmd/go: implement -fuzztime flag and support cancellation

fuzz.CoordinateFuzzing and RunFuzzWorker now accept a context.Context
parameter. They should terminate gracefully when the context is
cancelled. The worker should exit quickly without processing more
inputs. The coordinator should save interesting inputs to the cache.

The testing package can't import context directly, so it provides a
timeout argument to testdeps.CoordinateFuzzing instead. The testdeps
wrapper sets the timeout and installs an interrupt handler (for SIGINT
on POSIX and the equivalent on Windows) that cancels the context when
^C is pressed.

Note that on POSIX platforms, pressing ^C causes the shell to deliver
SIGINT to all processes in the active group: so 'go test', the
coordinator, and the workers should all react to that. On Windows,
pressing ^C only interrupts 'go test'. We may want to look at that
separately.

Change-Id: I924d3be2905f9685dae82ff3c047ca3d6b5e2357
Reviewed-on: https://go-review.googlesource.com/c/go/+/279487
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Trust: Katie Hockman <katie@golang.org>
Trust: Jay Conrod <jayconrod@google.com>

3 years ago[dev.fuzz] cmd/go: fix test_fuzz_mutate_crash test on windows
Jay Conrod [Wed, 23 Dec 2020 14:52:30 +0000 (09:52 -0500)]
[dev.fuzz] cmd/go: fix test_fuzz_mutate_crash test on windows

Change-Id: I1efde6dd82bb22f8bba63fe837c0f6ad4b3f03bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/279992
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
3 years ago[dev.fuzz] internal/fuzz: read and write interesting values in fuzz cache
Jay Conrod [Fri, 4 Dec 2020 23:27:09 +0000 (18:27 -0500)]
[dev.fuzz] internal/fuzz: read and write interesting values in fuzz cache

'go test -fuzz' may now read and write interesting fuzzing values to
directories in $GOCACHE/fuzz. Files in this directory are named
$pkg/$test/$hash where $pkg is the package path containing the fuzz
target, $test is the target name, and $hash is the SHA-256 sum of the
data in the file.

Note that different versions of the same package or packages with the
same path from different modules may share the same directory.

Although files are written into a subdirectory of GOCACHE, they are
not removed automatically, nor are they removed by 'go clean -cache'.
Instead, they may be removed with 'go clean -fuzzcache'. We chose to
nest the fuzzing directory inside GOCACHE to avoid introducing a new
environment variable, since there's no real need for users to specify
a separate directory.

Change-Id: I2032cf8e6c92f715cf36a9fc6a550acf666d2382
Reviewed-on: https://go-review.googlesource.com/c/go/+/275534
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Trust: Katie Hockman <katie@golang.org>
Trust: Jay Conrod <jayconrod@google.com>

3 years ago[dev.fuzz] internal/fuzz: refactor in preparation for GOFUZZCACHE
Jay Conrod [Fri, 4 Dec 2020 23:07:20 +0000 (18:07 -0500)]
[dev.fuzz] internal/fuzz: refactor in preparation for GOFUZZCACHE

Several small changes, most related to GOFUZZCACHE.

* Use separate channels to send crashers and interesting values to the
  coordinator.
* Add a new type, crasherEntry, which is a corpusEntry with an
  error message.
* Workers now send fatal errors to the coordinator via errC instead of
  returning or closing doneC.
* In CoordinateFuzzing, defer code that closes doneC and waits for
  workers to stop. This is the only place where doneC is closed.
* In workerServer and workerClient, always pass input values through
  shared memory instead of RPC messages or arguments to avoid
  confusion.
* Rename sharedMem.value to valueRef and add valueCopy to make it
  clearer whether a reference or copy is needed.
* mutate now operates on shared memory directly.
* mutate will not panic on empty input.

Change-Id: I6e57354875508f0ac4483ed2728f3ba18dc938c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/275533
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Katie Hockman <katie@golang.org>
3 years ago[dev.fuzz] cmd/go: fix test_fuzz_mutate_crash
Jay Conrod [Mon, 14 Dec 2020 22:59:36 +0000 (17:59 -0500)]
[dev.fuzz] cmd/go: fix test_fuzz_mutate_crash

Add a go.mod file, which is needed now that GO111MODULE=on by default.

Change-Id: I982f32afcf80ec190a2dd4603eb0aebc6fa22c67
Reviewed-on: https://go-review.googlesource.com/c/go/+/278052
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
3 years ago[dev.fuzz] all: merge master into dev.fuzz
Katie Hockman [Mon, 14 Dec 2020 15:03:05 +0000 (10:03 -0500)]
[dev.fuzz] all: merge master into dev.fuzz

Change-Id: I5d8c8329ccc9d747bd81ade6b1cb7cb8ae2e94b2

3 years agocmd/compile: set correct type for OpIData
Cuong Manh Le [Mon, 14 Dec 2020 02:45:44 +0000 (09:45 +0700)]
cmd/compile: set correct type for OpIData

Since CL 270057, there're many attempts to fix the expand_calls pass
with interface{}-typed. But all of them did not fix the root cause. The
main issue is during SSA conversion in gc/ssa.go, for empty interface
case, we make its type as n.Type, instead of BytePtr.

To fix these, we can just use BytePtr for now, since when itab fields
are treated as scalar.

No significal changes on compiler speed, size.

cmd/compile/internal/ssa
expandCalls.func6 9488 -> 9232  (-2.70%)

file                       before   after    Δ       %
cmd/compile/internal/ssa.s 3992893  3992637  -256    -0.006%
total                      20500447 20500191 -256    -0.001%

Fixes #43112
Updates #42784
Updates #42727
Updates #42568

Change-Id: I0b15d9434e0be5448453e61f98ef9c2d6cd93792
Reviewed-on: https://go-review.googlesource.com/c/go/+/276952
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
3 years agodoc: make clear that Go 1.4 is not required for bootstrap
Russ Cox [Fri, 11 Dec 2020 18:32:14 +0000 (13:32 -0500)]
doc: make clear that Go 1.4 is not required for bootstrap

Go 1.4 does not work on some systems, including the most
recent versions of macOS. Make it clearer that that's not the only
way to bootstrap Go.

Change-Id: I7c03d6808e43bf26283a53eab2bb0b2dc4af73af
Reviewed-on: https://go-review.googlesource.com/c/go/+/277216
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agocmd/compile: fix select statement evaluation order corner case
Matthew Dempsky [Thu, 10 Dec 2020 20:21:45 +0000 (12:21 -0800)]
cmd/compile: fix select statement evaluation order corner case

The Go spec requires that select case clauses be evaluated in order,
which is stricter than normal ordering semantics. cmd/compile handled
this correctly for send clauses, but was not correctly handling
receive clauses that involved bare variable references.

Discovered with @cuonglm.

Fixes #43111.

Change-Id: Iec93b6514dd771875b084ba49c15d7f4531b4a6f
Reviewed-on: https://go-review.googlesource.com/c/go/+/277132
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
3 years agocmd/go: add documentation for the -overlay flag
Michael Matloob [Wed, 2 Dec 2020 02:45:49 +0000 (21:45 -0500)]
cmd/go: add documentation for the -overlay flag

Also add -overlay to the Go 1.16 release notes.

For #40700
Fixes #39958
Fixes #42893

Change-Id: Ifd397549e368b255e7b8800986cfa0563a942af5
Reviewed-on: https://go-review.googlesource.com/c/go/+/274714
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
3 years agocmd/link/internal/loadelf: support additional ELF relocations on mips64
Joel Sing [Mon, 7 Dec 2020 17:23:36 +0000 (04:23 +1100)]
cmd/link/internal/loadelf: support additional ELF relocations on mips64

LLVM on openbsd/mips64 generates R_MIPS_GOT_HI16 and R_MIPS_GOT_LO16 relocations,
so teach cmd/link/internal/loadelf about both of these.

Updates #43005

Change-Id: Ic45ea8b901d44dcbdbf355411ee434dcd7670a92
Reviewed-on: https://go-review.googlesource.com/c/go/+/275894
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
3 years agocmd/vet: vendor in x/tools, update structtag vet check
Ian Lance Taylor [Fri, 11 Dec 2020 06:24:21 +0000 (22:24 -0800)]
cmd/vet: vendor in x/tools, update structtag vet check

For #40281
Fixes #43083

Change-Id: I50cb4db916587a6660c7f6e71f41f02334081510
Reviewed-on: https://go-review.googlesource.com/c/go/+/277076
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agosyscall: drop references to Unix epoch in Timeval/Timespec docs
Ian Lance Taylor [Thu, 10 Dec 2020 23:01:20 +0000 (15:01 -0800)]
syscall: drop references to Unix epoch in Timeval/Timespec docs

The various conversion functions just change the format of time values.
They don't use the Unix epoch. Although in practice the values are often
times since the Unix epoch, they aren't always, so referring to the
epoch can be confusing.

Fixes #43010

Change-Id: I640d665f0d2017f0974db05d70858037c7c91eda
Reviewed-on: https://go-review.googlesource.com/c/go/+/277073
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agodoc/go1.16: add vet release note for CL 235677
Tim King [Wed, 2 Dec 2020 01:55:35 +0000 (17:55 -0800)]
doc/go1.16: add vet release note for CL 235677

For #40700
Fixes #42895

Change-Id: I05b60f0d000512d5dddb3d61e0e695aa01943d6a
Reviewed-on: https://go-review.googlesource.com/c/go/+/274617
Trust: Tim King <taking@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years agodoc/go1.16: address some remaining high-level TODOs
Dmitri Shuralyov [Thu, 10 Dec 2020 22:43:09 +0000 (17:43 -0500)]
doc/go1.16: address some remaining high-level TODOs

The tools section TODO can be removed since the tools section looks
complete by now.

All TODOs in the minor changes to the library section have been done,
so the top-level TODO is resolved. Delete it.

The currently highlighted entries under Core library section look
good. It's worth reviewing this further based on feedback from Go
1.16 pre-releases, so keep the TODO but make it non-user-visible
to unblock Go 1.16 Beta 1.

For #40700.

Change-Id: Ie72661bd457b0a93ef92e1bfc0844072f3b618a6
Reviewed-on: https://go-review.googlesource.com/c/go/+/277212
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agocmd/go: encode backslash and newline in response files
Jeremy Faller [Tue, 24 Nov 2020 17:58:21 +0000 (12:58 -0500)]
cmd/go: encode backslash and newline in response files

Fixes #42295

Change-Id: Ie324bc99a74c1d864c6c2da2e7b929b338c2e033
Reviewed-on: https://go-review.googlesource.com/c/go/+/272870
Trust: Jeremy Faller <jeremy@golang.org>
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
3 years agoruntime/metrics: add a note about floating-point values to package docs
Michael Anthony Knyszek [Mon, 7 Dec 2020 15:10:43 +0000 (15:10 +0000)]
runtime/metrics: add a note about floating-point values to package docs

This change adds a note to the package documentation that the package
will never produce a NaN or infinity, to help ease usability.

Change-Id: I72ff6ab636ca23722a68ef11e707c68b0724ac04
Reviewed-on: https://go-review.googlesource.com/c/go/+/275854
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
3 years agoruntime/metrics: expand Read documention with caveats
Michael Anthony Knyszek [Mon, 7 Dec 2020 15:03:51 +0000 (15:03 +0000)]
runtime/metrics: expand Read documention with caveats

This change modifies the documentation of Read with some caveats about
reusing the slice passed in to Read as well as with what concurrent
situations are safe.

Change-Id: I76fd31acc67ae384546a8442dfbf9d16b7445cff
Reviewed-on: https://go-review.googlesource.com/c/go/+/275853
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
3 years agoruntime/metrics: add ordering line to supported metrics docs
Michael Anthony Knyszek [Fri, 4 Dec 2020 16:04:53 +0000 (16:04 +0000)]
runtime/metrics: add ordering line to supported metrics docs

This change adds an additional line explaining the ordering of the
supported metrics list. It's also necessary to ensure "Supported
metrics" is displayed by godoc as a proper header.

This modification does mean the description test, that ensures
descriptions line up with documentation, needs to change slightly
so it it doesn't read this new line as documentation. Make this
new line the line the test uses to decide when to begin.

Change-Id: I654c1c20e97a80ea79c8eb864445153ce91950bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/275852
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
3 years agotest: match gofrontend error messages
Ian Lance Taylor [Thu, 10 Dec 2020 02:51:12 +0000 (18:51 -0800)]
test: match gofrontend error messages

fixedbugs/bug13343.go:10:12: error: initialization expressions for ‘b’ and ‘c’ depend upon each other
fixedbugs/bug13343.go:11:9: note: ‘c’ defined here
fixedbugs/bug13343.go:11:9: error: initialization expression for ‘c’ depends upon itself
fixedbugs/bug13343.go:11:9: error: initialization expressions for ‘c’ and ‘b’ depend upon each other
fixedbugs/bug13343.go:10:12: note: ‘b’ defined here

fixedbugs/issue10700.dir/test.go:24:10: error: reference to method ‘Do’ in type that is pointer to interface, not interface
fixedbugs/issue10700.dir/test.go:25:10: error: reference to method ‘do’ in type that is pointer to interface, not interface
fixedbugs/issue10700.dir/test.go:27:10: error: reference to method ‘Dont’ in type that is pointer to interface, not interface
fixedbugs/issue10700.dir/test.go:28:13: error: reference to undefined field or method ‘Dont’
fixedbugs/issue10700.dir/test.go:31:10: error: reference to undefined field or method ‘do’
fixedbugs/issue10700.dir/test.go:33:13: error: reference to undefined field or method ‘do’
fixedbugs/issue10700.dir/test.go:34:10: error: reference to undefined field or method ‘Dont’
fixedbugs/issue10700.dir/test.go:35:13: error: reference to undefined field or method ‘Dont’
fixedbugs/issue10700.dir/test.go:37:10: error: reference to method ‘Do’ in type that is pointer to interface, not interface
fixedbugs/issue10700.dir/test.go:38:10: error: reference to method ‘do’ in type that is pointer to interface, not interface
fixedbugs/issue10700.dir/test.go:40:13: error: reference to undefined field or method ‘do’
fixedbugs/issue10700.dir/test.go:41:10: error: reference to method ‘Dont’ in type that is pointer to interface, not interface
fixedbugs/issue10700.dir/test.go:42:13: error: reference to undefined field or method ‘Dont’
fixedbugs/issue10700.dir/test.go:43:10: error: reference to method ‘secret’ in type that is pointer to interface, not interface
fixedbugs/issue10700.dir/test.go:44:13: error: reference to unexported field or method ‘secret’

fixedbugs/issue10975.go:13:9: error: interface contains embedded non-interface

fixedbugs/issue11326.go:26:17: error: floating-point constant overflow
fixedbugs/issue11326.go:27:17: error: floating-point constant overflow
fixedbugs/issue11326.go:28:17: error: floating-point constant overflow

fixedbugs/issue11361.go:9:11: error: import file ‘fmt’ not found
fixedbugs/issue11361.go:11:11: error: reference to undefined name ‘fmt’

fixedbugs/issue11371.go:12:15: error: floating-point constant truncated to integer
fixedbugs/issue11371.go:13:15: error: integer constant overflow
fixedbugs/issue11371.go:17:15: error: floating-point constant truncated to integer

fixedbugs/issue11590.go:9:17: error: integer constant overflow
fixedbugs/issue11590.go:9:17: error: integer constant overflow
fixedbugs/issue11590.go:10:22: error: complex real part overflow
fixedbugs/issue11590.go:10:22: error: complex real part overflow
fixedbugs/issue11590.go:11:23: error: complex real part overflow
fixedbugs/issue11590.go:11:23: error: complex real part overflow
fixedbugs/issue11590.go:9:19: error: integer constant overflow
fixedbugs/issue11590.go:10:24: error: complex real part overflow
fixedbugs/issue11590.go:11:25: error: complex real part overflow

fixedbugs/issue11610.go:11:7: error: import path is empty
fixedbugs/issue11610.go:12:4: error: invalid character 0x3f in input file
fixedbugs/issue11610.go:14:1: error: expected identifier
fixedbugs/issue11610.go:14:1: error: expected type

fixedbugs/issue11614.go:14:9: error: interface contains embedded non-interface

fixedbugs/issue13248.go:13:1: error: expected operand
fixedbugs/issue13248.go:13:1: error: missing ‘)’
fixedbugs/issue13248.go:12:5: error: reference to undefined name ‘foo’

fixedbugs/issue13266.go:10:8: error: package name must be an identifier
fixedbugs/issue13266.go:10:8: error: expected ‘;’ or newline after package clause
fixedbugs/issue13266.go:10:8: error: expected declaration

fixedbugs/issue13273.go:50:18: error: expected ‘chan’
fixedbugs/issue13273.go:53:24: error: expected ‘chan’

fixedbugs/issue13274.go:11:58: error: expected ‘}’

fixedbugs/issue13365.go:14:19: error: index expression is negative
fixedbugs/issue13365.go:15:21: error: index expression is negative
fixedbugs/issue13365.go:16:22: error: index expression is negative
fixedbugs/issue13365.go:19:13: error: some element keys in composite literal are out of range
fixedbugs/issue13365.go:22:19: error: incompatible type for element 1 in composite literal
fixedbugs/issue13365.go:23:21: error: incompatible type for element 1 in composite literal
fixedbugs/issue13365.go:24:22: error: incompatible type for element 1 in composite literal

fixedbugs/issue13415.go:14:5: error: redefinition of ‘x’
fixedbugs/issue13415.go:14:5: note: previous definition of ‘x’ was here
fixedbugs/issue13415.go:14:5: error: ‘x’ declared but not used

fixedbugs/issue13471.go:12:25: error: floating-point constant truncated to integer
fixedbugs/issue13471.go:13:25: error: floating-point constant truncated to integer
fixedbugs/issue13471.go:14:25: error: floating-point constant truncated to integer
fixedbugs/issue13471.go:15:24: error: floating-point constant truncated to integer
fixedbugs/issue13471.go:16:23: error: floating-point constant truncated to integer
fixedbugs/issue13471.go:18:26: error: floating-point constant truncated to integer
fixedbugs/issue13471.go:19:26: error: floating-point constant truncated to integer
fixedbugs/issue13471.go:20:26: error: floating-point constant truncated to integer
fixedbugs/issue13471.go:21:25: error: floating-point constant truncated to integer
fixedbugs/issue13471.go:22:24: error: floating-point constant truncated to integer
fixedbugs/issue13471.go:24:24: error: floating-point constant truncated to integer

fixedbugs/issue13821b.go:18:12: error: incompatible types in binary expression
fixedbugs/issue13821b.go:19:13: error: incompatible types in binary expression
fixedbugs/issue13821b.go:20:13: error: incompatible types in binary expression
fixedbugs/issue13821b.go:21:13: error: incompatible types in binary expression
fixedbugs/issue13821b.go:22:13: error: incompatible types in binary expression
fixedbugs/issue13821b.go:24:12: error: incompatible types in binary expression

fixedbugs/issue14006.go:24:18: error: expected ‘;’ or ‘}’ or newline
fixedbugs/issue14006.go:30:18: error: expected ‘;’ or ‘}’ or newline
fixedbugs/issue14006.go:37:22: error: expected ‘;’ or ‘}’ or newline
fixedbugs/issue14006.go:43:22: error: expected ‘;’ or ‘}’ or newline
fixedbugs/issue14006.go:59:17: note: previous definition of ‘labelname’ was here
fixedbugs/issue14006.go:64:17: error: label ‘labelname’ already defined
fixedbugs/issue14006.go:24:17: error: value computed is not used
fixedbugs/issue14006.go:30:17: error: value computed is not used
fixedbugs/issue14006.go:37:20: error: value computed is not used
fixedbugs/issue14006.go:43:20: error: value computed is not used
fixedbugs/issue14006.go:59:17: error: label ‘labelname’ defined and not used

fixedbugs/issue14010.go:13:14: error: invalid left hand side of assignment
fixedbugs/issue14010.go:14:14: error: invalid left hand side of assignment
fixedbugs/issue14010.go:14:9: error: invalid use of type

fixedbugs/issue14321.go:30:10: error: method ‘F’ is ambiguous in type ‘C’
fixedbugs/issue14321.go:31:10: error: ‘G’ is ambiguous via ‘A’ and ‘B’
fixedbugs/issue14321.go:33:10: error: type ‘C’ has no method ‘I’

fixedbugs/issue8183.go:12:14: error: integer constant overflow

fixedbugs/issue9036.go:21:12: error: invalid prefix for floating constant
fixedbugs/issue9036.go:22:12: error: invalid prefix for floating constant

fixedbugs/issue9076.go:14:5: error: incompatible type in initialization (cannot use type uintptr as type int32)
fixedbugs/issue9076.go:15:5: error: incompatible type in initialization (cannot use type uintptr as type int32)

For issue9083.go avoid an error about a variable that is set but not used.

fixedbugs/issue9370.go:105:13: error: cannot use ‘_’ as value
fixedbugs/issue9370.go:106:13: error: cannot use ‘_’ as value
fixedbugs/issue9370.go:107:13: error: cannot use ‘_’ as value
fixedbugs/issue9370.go:108:13: error: cannot use ‘_’ as value
fixedbugs/issue9370.go:109:13: error: cannot use ‘_’ as value
fixedbugs/issue9370.go:110:13: error: cannot use ‘_’ as value
fixedbugs/issue9370.go:112:18: error: cannot use ‘_’ as value
fixedbugs/issue9370.go:113:18: error: cannot use ‘_’ as value
fixedbugs/issue9370.go:114:18: error: cannot use ‘_’ as value
fixedbugs/issue9370.go:115:18: error: cannot use ‘_’ as value
fixedbugs/issue9370.go:116:18: error: cannot use ‘_’ as value
fixedbugs/issue9370.go:117:18: error: cannot use ‘_’ as value
fixedbugs/issue9370.go:119:13: error: cannot use ‘_’ as value
fixedbugs/issue9370.go:119:18: error: cannot use ‘_’ as value
fixedbugs/issue9370.go:36:15: error: invalid comparison of non-ordered type
fixedbugs/issue9370.go:39:15: error: invalid comparison of non-ordered type
fixedbugs/issue9370.go:43:15: error: invalid comparison of non-ordered type
fixedbugs/issue9370.go:46:15: error: invalid comparison of non-ordered type
fixedbugs/issue9370.go:50:15: error: invalid comparison of non-ordered type
fixedbugs/issue9370.go:53:15: error: invalid comparison of non-ordered type
fixedbugs/issue9370.go:56:15: error: incompatible types in binary expression
fixedbugs/issue9370.go:57:15: error: incompatible types in binary expression
fixedbugs/issue9370.go:58:15: error: incompatible types in binary expression
fixedbugs/issue9370.go:59:15: error: incompatible types in binary expression
fixedbugs/issue9370.go:60:15: error: incompatible types in binary expression
fixedbugs/issue9370.go:61:15: error: incompatible types in binary expression
fixedbugs/issue9370.go:65:15: error: invalid comparison of non-ordered type
fixedbugs/issue9370.go:68:15: error: invalid comparison of non-ordered type
fixedbugs/issue9370.go:70:15: error: incompatible types in binary expression
fixedbugs/issue9370.go:71:15: error: incompatible types in binary expression
fixedbugs/issue9370.go:72:15: error: incompatible types in binary expression
fixedbugs/issue9370.go:73:15: error: incompatible types in binary expression
fixedbugs/issue9370.go:74:15: error: incompatible types in binary expression
fixedbugs/issue9370.go:75:15: error: incompatible types in binary expression
fixedbugs/issue9370.go:77:15: error: invalid operation (func can only be compared to nil)
fixedbugs/issue9370.go:78:15: error: invalid operation (func can only be compared to nil)
fixedbugs/issue9370.go:79:15: error: invalid comparison of non-ordered type
fixedbugs/issue9370.go:80:15: error: invalid operation (func can only be compared to nil)
fixedbugs/issue9370.go:81:15: error: invalid operation (func can only be compared to nil)
fixedbugs/issue9370.go:82:15: error: invalid comparison of non-ordered type
fixedbugs/issue9370.go:84:15: error: incompatible types in binary expression
fixedbugs/issue9370.go:85:15: error: incompatible types in binary expression
fixedbugs/issue9370.go:86:15: error: incompatible types in binary expression
fixedbugs/issue9370.go:87:15: error: incompatible types in binary expression
fixedbugs/issue9370.go:88:15: error: incompatible types in binary expression
fixedbugs/issue9370.go:89:15: error: incompatible types in binary expression
fixedbugs/issue9370.go:91:15: error: invalid operation (func can only be compared to nil)
fixedbugs/issue9370.go:92:15: error: invalid operation (func can only be compared to nil)
fixedbugs/issue9370.go:93:15: error: invalid comparison of non-ordered type
fixedbugs/issue9370.go:94:15: error: invalid operation (func can only be compared to nil)
fixedbugs/issue9370.go:95:15: error: invalid operation (func can only be compared to nil)
fixedbugs/issue9370.go:96:15: error: invalid comparison of non-ordered type
fixedbugs/issue9370.go:98:15: error: invalid operation (func can only be compared to nil)
fixedbugs/issue9370.go:99:15: error: invalid operation (func can only be compared to nil)
fixedbugs/issue9370.go:100:15: error: invalid comparison of non-ordered type
fixedbugs/issue9370.go:101:15: error: invalid operation (func can only be compared to nil)
fixedbugs/issue9370.go:102:15: error: invalid operation (func can only be compared to nil)
fixedbugs/issue9370.go:103:15: error: invalid comparison of non-ordered type
fixedbugs/issue9370.go:121:15: error: incompatible types in binary expression
fixedbugs/issue9370.go:122:15: error: incompatible types in binary expression
fixedbugs/issue9370.go:123:15: error: incompatible types in binary expression
fixedbugs/issue9370.go:124:15: error: incompatible types in binary expression

Change-Id: I4089de4919112b08f5f2bbec20f84fcc7dbe3955
Reviewed-on: https://go-review.googlesource.com/c/go/+/276832
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
3 years agostd: update golang.org/x/net to 20201209123823-ac852fbbde11
Dmitri Shuralyov [Thu, 10 Dec 2020 17:50:55 +0000 (12:50 -0500)]
std: update golang.org/x/net to 20201209123823-ac852fbbde11

Done with:

go get -d golang.org/x/net@latest
go mod tidy
go mod vendor
go generate -run bundle std

The cmd module was updated as well, but go mod tidy undoes the change
because the x/net module doesn't contribute any packages to cmd module.
cmd/internal/moddeps.TestDependencyVersionsConsistent is happy with it:

// It's ok if there are undetected differences in modules that do not
// provide imported packages: we will not have to pull in any backports of
// fixes to those modules anyway.

Fixes #31192.
Updates #42498.

Change-Id: If303c9a7aa2ce8c2553fcb1ced7fccc9e6652ad6
Reviewed-on: https://go-review.googlesource.com/c/go/+/277012
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
3 years agodatabase/sql: fix typo in comment
Hein Khant Zaw [Thu, 10 Dec 2020 16:45:48 +0000 (16:45 +0000)]
database/sql: fix typo in comment

Fixes #43116

Change-Id: Ib04fab6ae03f322aa1508ec00523f628d891247a
GitHub-Last-Rev: 0a86e665b2c320e0b2aef75ee53bd7281b19b013
GitHub-Pull-Request: golang/go#43122
Reviewed-on: https://go-review.googlesource.com/c/go/+/276992
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
3 years agocmd/go, cmd/asm: pass -linkshared to assembler for shared linkage builds
Than McIntosh [Thu, 10 Dec 2020 13:44:44 +0000 (08:44 -0500)]
cmd/go, cmd/asm: pass -linkshared to assembler for shared linkage builds

When the -linkshared build mode is in effect, the Go command passes
the "-linkshared" command line option to the compiler so as to insure
special handling for things like builtin functions (which may appear
in a shared library and not the main executable). This patch extends
this behavior to the assembler, since the assembler may also wind up
referencing builtins when emitting a stack-split prolog.

Fixes #43107.

Change-Id: I56eaded79789b083f3c3d800fb140353dee33ba9
Reviewed-on: https://go-review.googlesource.com/c/go/+/276932
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
3 years agocmd/link: reject too-large relocation addend on darwin/arm64
Cherry Zhang [Wed, 9 Dec 2020 17:14:00 +0000 (12:14 -0500)]
cmd/link: reject too-large relocation addend on darwin/arm64

Mach-O relocation addend is signed 24-bit. If the addend
overflows, it is better to fail the build than emitting an
incorrect binary. (I'm still working on a fix.)

Updates #42738.

Change-Id: I647f0cd4f6b84d9ac75ef3bf36673bea01dfc211
Reviewed-on: https://go-review.googlesource.com/c/go/+/276694
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
3 years agocmd/link: truncate file after code signature
Cherry Zhang [Wed, 9 Dec 2020 23:25:05 +0000 (18:25 -0500)]
cmd/link: truncate file after code signature

When external linking, in case that the external linker generates
a code signature with a different size (e.g. as it uses a
different identifier), truncate the file after rewriting the code
signature, to make sure that no bytes after the signature (which
will invalidate the signature).

Fixes #43105.

Change-Id: I732f949fedd6de42d9f3cf6d017f7ba3f4e59e7a
Reviewed-on: https://go-review.googlesource.com/c/go/+/276693
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
3 years agocmd/compile: don't constant fold divide by zero
Keith Randall [Wed, 9 Dec 2020 16:27:54 +0000 (08:27 -0800)]
cmd/compile: don't constant fold divide by zero

It just makes the compiler crash. Oops.

Fixes #43099

Change-Id: Id996c14799c1a5d0063ecae3b8770568161c2440
Reviewed-on: https://go-review.googlesource.com/c/go/+/276652
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
3 years agogo/types: avoid endless recursion in the Comparable predicate
Rob Findley [Wed, 9 Dec 2020 11:10:52 +0000 (06:10 -0500)]
go/types: avoid endless recursion in the Comparable predicate

This is a port of CL 276374 from the dev.typeparams branch. Avoid an
endless recursion in Comparable by tracking types that have already been
considered.

Fixes #43088

Change-Id: I927b29ac544df9bfb5c8c04699d57fafe6cfff73
Reviewed-on: https://go-review.googlesource.com/c/go/+/276552
Run-TryBot: Robert Findley <rfindley@google.com>
Trust: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years agoall: update to use os.ReadDir where appropriate
Russ Cox [Thu, 29 Oct 2020 18:46:29 +0000 (14:46 -0400)]
all: update to use os.ReadDir where appropriate

os.ReadDir is a replacement for ioutil.ReadDir that returns
a slice of fs.DirEntry instead of fs.FileInfo, meaning it is the
more efficient form.

This CL updates call sites throughout the Go source tree
wherever possible. As usual, code built using the Go 1.4
bootstrap toolchain is not included. There is also a use in
go/build that appears in the public API and can't be changed,
at least not without additional changes.

Fixes #42026.

Change-Id: Icfc9dd52c6045020f6830e22c72128499462d561
Reviewed-on: https://go-review.googlesource.com/c/go/+/266366
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agoall: update to use os.ReadFile, os.WriteFile, os.CreateTemp, os.MkdirTemp
Russ Cox [Thu, 29 Oct 2020 18:17:47 +0000 (14:17 -0400)]
all: update to use os.ReadFile, os.WriteFile, os.CreateTemp, os.MkdirTemp

As part of #42026, these helpers from io/ioutil were moved to os.
(ioutil.TempFile and TempDir became os.CreateTemp and MkdirTemp.)

Update the Go tree to use the preferred names.

As usual, code compiled with the Go 1.4 bootstrap toolchain
and code vendored from other sources is excluded.

ReadDir changes are in a separate CL, because they are not a
simple search and replace.

For #42026.

Change-Id: If318df0216d57e95ea0c4093b89f65e5b0ababb3
Reviewed-on: https://go-review.googlesource.com/c/go/+/266365
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agoruntime/metrics: simplify test to support more environments
Dmitri Shuralyov [Wed, 9 Dec 2020 00:44:33 +0000 (19:44 -0500)]
runtime/metrics: simplify test to support more environments

go test sets the working directory to that of the package being tested,
so opening one of the package source files can be done in a simpler way.
This also allows the test to run in more environments, for example when
GOROOT_FINAL¹ is set.

Also remove the testenv.HasSrc-like check for Go source. The doc.go
file is a part of the package being built and tested, so it's expected
to be available. If it's important for this test to handle when a test
binary is built with go test -c and executed elsewhere without package
source files, something more than testenv.HasSrc would be needed.

¹ https://golang.org/cmd/go/#hdr-Environment_variables

Fixes #43085.

Change-Id: Ie6ade395a8fc7beebdadbad6f4873800138dfc26
Reviewed-on: https://go-review.googlesource.com/c/go/+/276452
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>

3 years agocmd/compile: fix message typo
Ikko Ashimine [Wed, 9 Dec 2020 14:17:56 +0000 (14:17 +0000)]
cmd/compile: fix message typo

occurences -> occurrences

Change-Id: Ia81671f5de8a24ddd303a77b4580e8c726f29122
GitHub-Last-Rev: 11f9ab9f8c2c9acd70bcf170930426547d9b63eb
GitHub-Pull-Request: golang/go#43097
Reviewed-on: https://go-review.googlesource.com/c/go/+/276612
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
3 years agonet/http: add connections back that haven't been canceled
Michael Fraenkel [Thu, 3 Dec 2020 00:07:27 +0000 (17:07 -0700)]
net/http: add connections back that haven't been canceled

Issue #41600 fixed the issue when a second request canceled a connection
while the first request was still in roundTrip.
This uncovered a second issue where a request was being canceled (in
roundtrip) but the connection was put back into the idle pool for a
subsequent request.
The fix is the similar except its now in readLoop instead of roundTrip.
A persistent connection is only added back if it successfully removed
the cancel function; otherwise we know the roundTrip has started
cancelRequest.

Fixes #42942

Change-Id: Ia56add20880ccd0c1ab812d380d8628e45f6f44c
Reviewed-on: https://go-review.googlesource.com/c/go/+/274973
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Trust: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
3 years agoruntime: prevent stack growth after fork in runtime.sigfillset
Haoran Luo [Tue, 8 Dec 2020 14:29:04 +0000 (14:29 +0000)]
runtime: prevent stack growth after fork in runtime.sigfillset

This fixes the unexpected growth of stack in child process, which
is caused by stack checking code in runtime.sigfillset called from
runtime.sigset while clearing the signal handlers in child process.

The redundant stack checking code is generated due to missing
'//go:nosplit' directive that should be annotated for
runtime.sigfillset.

Fixes #43066
Updates #21314

Change-Id: I9483a962a4b0747074313991841e2440ee32198c
Reviewed-on: https://go-review.googlesource.com/c/go/+/276173
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
3 years agodoc: add description of new framepointer vet check
Keith Randall [Tue, 8 Dec 2020 22:35:41 +0000 (14:35 -0800)]
doc: add description of new framepointer vet check

Update #43014

Change-Id: I5fbfaa16e6acb8859fd0b1188f532f5a225f6349
Reviewed-on: https://go-review.googlesource.com/c/go/+/276373
Trust: Keith Randall <khr@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years agocmd/vet: vendor in x/tools, enable framepointer vet check
Keith Randall [Tue, 8 Dec 2020 22:07:19 +0000 (14:07 -0800)]
cmd/vet: vendor in x/tools, enable framepointer vet check

Vendor in latest x/tools.
Add framepointer vet check to vet.

Fixes #43014

Change-Id: Ife72f85b1261aa60c0028041c58040d60a40918a
Reviewed-on: https://go-review.googlesource.com/c/go/+/276372
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agogo/types: correct error position for inherited const init expressions
Rob Findley [Tue, 8 Dec 2020 14:44:48 +0000 (09:44 -0500)]
go/types: correct error position for inherited const init expressions

This is a port of CL 275517 from the dev.typeparams branch, to fix the
positioning of error messages for invalid const init expressions that
are inherited.

Differences from CL 275517:
 + The inherited flag is added to the constDecl intermediate
   representation.
 + The errpos override is made a positioner, the internal interface
   used by go/types to capture error position and span. For const decls
   errpos is just set to a singular point, but using positioner is
   correct and causes span start and end positions to also be
   overridden.
 + Test cases are updated to assert on just 'overflows', as the go/types
   error message is, for example, "cannot use 255 + iota (untyped int
   constant 256) as byte value in constant declaration (overflows)".
   This is more verbose than the compiler's "constant 256 overflows
   byte", but changing that is out of scope.

Fixes #42991

Change-Id: I0a71d2290f7fff5513f2a6e49b83e6f0f4da30e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/276172
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years agodoc/go1.16: improve channel race detector changes description
Austin Clements [Mon, 7 Dec 2020 02:20:15 +0000 (21:20 -0500)]
doc/go1.16: improve channel race detector changes description

Based on text from Daniel Fava.

For #40700.

Change-Id: I0bc3a4340b8a777ff96d3cf226a7d51d3f65db2c
Reviewed-on: https://go-review.googlesource.com/c/go/+/275786
Trust: Austin Clements <austin@google.com>
Reviewed-by: Daniel Fava <danielsfava@gmail.com>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
3 years agoruntime: correct sigfwd on openbsd/mips64
Joel Sing [Mon, 7 Dec 2020 17:21:33 +0000 (04:21 +1100)]
runtime: correct sigfwd on openbsd/mips64

Position independent code expects that R25 (aka $t9) contains the address of the
called function. As such, use R25 when calling from sigfwd.

Change-Id: I66b2b9bfa1f1bb983c7385eb2eaa19d9cd87d9fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/275893
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
3 years agodoc/go1.16: update linker stats
Austin Clements [Mon, 7 Dec 2020 22:15:06 +0000 (17:15 -0500)]
doc/go1.16: update linker stats

benchstat v2 comparison vs HEAD:

                    1.15.6                    1.16
                    sec/op       sec/op           vs base
LinkIstio-48        4.44 ± 1%   3.43 ± 1%  -22.79% (p=0.000 n=20)
LinkKubelet-48     10.89 ± 1%   8.42 ± 1%  -22.63% (p=0.000 n=20)
LinkDiscovery-48    1.43 ± 1%   1.06 ± 1%  -25.68% (p=0.000 n=20)
LinkIstio-4         4.50 ± 1%   3.52 ± 1%  -21.84% (p=0.000 n=20)
LinkKubelet-4      10.84 ± 2%   8.55 ± 1%  -21.09% (p=0.000 n=20)
LinkDiscovery-4     1.45 ± 2%   1.11 ± 2%  -23.81% (p=0.000 n=20)

                     1.15.6                      1.16
                  max-RSS-bytes  max-RSS-bytes         vs base
LinkIstio-48       1085Mi ± 1%    1006Mi ± 0%    -7.32% (p=0.000 n=20)
LinkKubelet-48     1.60Gi ± 5%    1.46Gi ± 1%    -8.57% (p=0.000 n=20)
LinkDiscovery-48    392Mi ± 1%     362Mi ± 2%    -7.71% (p=0.000 n=20)
LinkIstio-4        1022Mi ± 6%     958Mi ± 1%    -6.26% (p=0.000 n=20)
LinkKubelet-4      1.63Gi ± 2%    1.44Gi ± 0%   -11.44% (p=0.000 n=20)
LinkDiscovery-4     400Mi ± 0%     353Mi ± 1%   -11.83% (p=0.000 n=20)

                     1.15.6                    1.16
                   exe-bytes     exe-bytes           vs base
LinkIstio-48       97.7Mi ± 0%   93.4Mi ± 0%  -4.38% (p=0.000 n=20)
LinkKubelet-48      129Mi ± 0%    127Mi ± 0%  -1.17% (p=0.000 n=20)
LinkDiscovery-48   31.9Mi ± 0%   29.1Mi ± 0%  -8.67% (p=0.000 n=20)
LinkIstio-4        97.7Mi ± 0%   93.4Mi ± 0%  -4.38% (p=0.000 n=20)
LinkKubelet-4       129Mi ± 0%    127Mi ± 0%  -1.17% (p=0.000 n=20)
LinkDiscovery-4    31.9Mi ± 0%   29.1Mi ± 0%  -8.67% (p=0.000 n=20)

https://perf.golang.org/search?q=upload:20201207.6

For #40700.

Change-Id: I3f7b3e08db4fb7980d2472f15e5fc04503e95ea0
Reviewed-on: https://go-review.googlesource.com/c/go/+/275912
Trust: Austin Clements <austin@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
3 years agoreflect: document multiple keys in struct tags
Ian Lance Taylor [Thu, 3 Dec 2020 02:25:19 +0000 (18:25 -0800)]
reflect: document multiple keys in struct tags

For #40281
Fixes #42959

Change-Id: Ibc4769fda1592a1373ec720ea30baf319c0a0136
Reviewed-on: https://go-review.googlesource.com/c/go/+/274448
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years agoio/fs: fix Sub method error text
Russ Cox [Mon, 7 Dec 2020 20:20:37 +0000 (15:20 -0500)]
io/fs: fix Sub method error text

Noticed in (and alternative to) CL 275520.

Change-Id: If6c107ee9928dd1910facd4dc66da7234cb91c39
Reviewed-on: https://go-review.googlesource.com/c/go/+/275879
Trust: Russ Cox <rsc@golang.org>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agoruntime/cgo: fix building on musl
Tonis Tiigi [Sun, 6 Dec 2020 20:13:47 +0000 (20:13 +0000)]
runtime/cgo: fix building on musl

sys/unistd.h only exists in glibc and not in musl so use the standard
location. This is a regression from CL 210639

Change-Id: Idd4c75510d9829316b44300c36c34df6d667cc05
GitHub-Last-Rev: 0fa4162f1c7c460bda7585300285f47d1781985d
GitHub-Pull-Request: golang/go#43038
Reviewed-on: https://go-review.googlesource.com/c/go/+/275732
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Andrew G. Morgan <agm@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Filippo Valsorda <filippo@golang.org>

3 years agodoc/go1.16: announce openbsd/mips64 port
Austin Clements [Mon, 7 Dec 2020 02:28:36 +0000 (21:28 -0500)]
doc/go1.16: announce openbsd/mips64 port

Updates #40995.
For #40700.

Change-Id: I4dced8d70e2f1fa2da98e2eb1a5f1f829f55bb6b
Reviewed-on: https://go-review.googlesource.com/c/go/+/275787
Trust: Austin Clements <austin@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
3 years agotest: add new test that gofrontend failed to handle
Ian Lance Taylor [Sat, 5 Dec 2020 16:08:47 +0000 (08:08 -0800)]
test: add new test that gofrontend failed to handle

The gofrontend code would in some circumstances incorrectly generate a
type descriptor for an alias type, causing the type to fail to be
equal to the unaliased type.

Change-Id: I47d33b0bfde3c72a9a186049539732bdd5a6a96e
Reviewed-on: https://go-review.googlesource.com/c/go/+/275632
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
3 years agodoc/go1.16: fix typo
Alberto Donizetti [Mon, 7 Dec 2020 17:10:56 +0000 (18:10 +0100)]
doc/go1.16: fix typo

For #40700

Change-Id: Idea442d45d18ca8cedc0b160df23eac6b86755ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/275677
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
3 years agodoc/go1.16: add missing </a> tag
Tobias Klauser [Mon, 7 Dec 2020 10:33:00 +0000 (11:33 +0100)]
doc/go1.16: add missing </a> tag

For #40700

Change-Id: Ic4e16106cbbe18d0c9efffee81c5234ddeedfd32
Reviewed-on: https://go-review.googlesource.com/c/go/+/275674
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
3 years agointernal/cpu: add darwin/arm64 CPU feature detection support
Martin Möhrmann [Sat, 21 Nov 2020 16:44:04 +0000 (17:44 +0100)]
internal/cpu: add darwin/arm64 CPU feature detection support

Fixes #42747

Change-Id: I6b1679348c77161f075f0678818bb003fc0e8c86
Reviewed-on: https://go-review.googlesource.com/c/go/+/271989
Trust: Martin Möhrmann <moehrmann@google.com>
Run-TryBot: Martin Möhrmann <martisch@uos.de>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
3 years agodoc/go1.16: document riscv64 port changes
Tobias Klauser [Thu, 3 Dec 2020 10:27:05 +0000 (11:27 +0100)]
doc/go1.16: document riscv64 port changes

For #36641
For #40700

Change-Id: Ib268559a2ce7839372dbf273d95876d8d4521a45
Reviewed-on: https://go-review.googlesource.com/c/go/+/274478
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
3 years agointernal/cpu: fix typo in cpu_arm64.go
Ikko Ashimine [Sat, 5 Dec 2020 14:43:53 +0000 (14:43 +0000)]
internal/cpu: fix typo in cpu_arm64.go

auxillary -> auxiliary

Change-Id: I7c29c4a63d236c3688b8e4f5af70650d43cd89c0
GitHub-Last-Rev: d4a18c71a15cf0803bd847225ed5bf898c52e0f3
GitHub-Pull-Request: golang/go#43024
Reviewed-on: https://go-review.googlesource.com/c/go/+/275592
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Keith Randall <khr@golang.org>

3 years agosyscall: correct CertOpenStore to expect a 0 return value on failure
Jason A. Donenfeld [Sun, 29 Nov 2020 12:33:37 +0000 (13:33 +0100)]
syscall: correct CertOpenStore to expect a 0 return value on failure

According to [1], this function returns NULL when it errors, rather than
INVALID_HANDLE_VALUE, which other Win32 functions return. This was
pointed out in CL 273446 for the x/sys package, and this patch here
cleans it up for the syscall package and updates the vendored x/sys
package using the usual `go get/go mod vendor` dance. The function is
currently in use by crypto/x509/root_windows.go, which calls
CertOpenStore(CERT_STORE_PROV_MEMORY), which I assume can fail under OOM
or other weird conditions. Quick reversing indicates that [1] is
correct, as there's a `xor eax, eax` in the error paths of the function
just before jumping to the epilogue.

[1] https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-certopenstore#return-value

Change-Id: I77c0b0319c13313212f8710785252c494da56ed5
Reviewed-on: https://go-review.googlesource.com/c/go/+/273827
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Alex Brainman <alex.brainman@gmail.com>

3 years agodoc/go1.16: cleanup crypto release notes
Filippo Valsorda [Fri, 4 Dec 2020 00:46:59 +0000 (01:46 +0100)]
doc/go1.16: cleanup crypto release notes

For #40700
Fixes #42897

Change-Id: Id3b87841a899818d6939dcc3edbaaa0bc183e913
Reviewed-on: https://go-review.googlesource.com/c/go/+/275313
Trust: Filippo Valsorda <filippo@golang.org>
Trust: Roland Shoemaker <roland@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
3 years agocmd/vendor: sync pprof@v0.0.0-20201203190320-1bf35d6f28c2
zikaeroh [Fri, 4 Dec 2020 20:20:17 +0000 (12:20 -0800)]
cmd/vendor: sync pprof@v0.0.0-20201203190320-1bf35d6f28c2

Pulls in a fix to make versioned import paths more readable in pprof's
graph view.

Updated via the instructions in README.vendor.

Updates #36905

Change-Id: I6a91de0f4ca1be3fc69d8e1a39ccf4f5bd0387ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/275513
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

3 years ago[dev.fuzz] internal/fuzzing: handle and report crashers
Katie Hockman [Wed, 2 Dec 2020 19:37:49 +0000 (14:37 -0500)]
[dev.fuzz] internal/fuzzing: handle and report crashers

Change-Id: Ie2a84c12f4991984974162e74f06cfd67e9bb4d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/274855
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
3 years ago[dev.fuzz] internal/fuzz: add mutex to workerClient
Jay Conrod [Thu, 3 Dec 2020 18:05:14 +0000 (13:05 -0500)]
[dev.fuzz] internal/fuzz: add mutex to workerClient

This prevents workerClient.Close from closing fuzzIn while
workerClient.fuzz is writing to it concurrently. It also prevents
multiple callers from writing to fuzzIn concurrently, though there's
nothing that does that yet.

This should prevent most "broken pipe" errors, though they may still
be possible if worker.stop is called and it needs to kill the process
due to a timeout. In the future, we should detect and ignore those
errors, but for now, they're useful for debugging.

Also, improve documentation on workerClient and workerServer.

Change-Id: Ie2c870392d5e91674d3b1e32b2fa4f9de9ac3eb0
Reviewed-on: https://go-review.googlesource.com/c/go/+/275173
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Katie Hockman <katie@golang.org>
3 years ago[dev.fuzz] testing: fix duplicate logging when fuzzing
Katie Hockman [Tue, 1 Dec 2020 22:37:07 +0000 (17:37 -0500)]
[dev.fuzz] testing: fix duplicate logging when fuzzing

The workers were printing PASS/FAIL logs and
various others things, when that should be
the sole responsibility of the coordinator
process, which will have the aggregated data.

Change-Id: I7ac9883db62f0fe79ba1799cb88773c542a2a948
Reviewed-on: https://go-review.googlesource.com/c/go/+/274652
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
3 years ago[dev.fuzz] internal/fuzz: send inputs to workers with shared memory
Jay Conrod [Fri, 16 Oct 2020 21:42:39 +0000 (17:42 -0400)]
[dev.fuzz] internal/fuzz: send inputs to workers with shared memory

The coordinator process creates a temporary file for each worker. Both
coordinator and worker map the file into memory and use it for input
values. Access is synchronized with RPC over pipes.

Change-Id: I43c10d7291a8760a616b472d11c017a3a7bb19cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/263153
Reviewed-by: Katie Hockman <katie@golang.org>
Trust: Jay Conrod <jayconrod@google.com>

3 years ago[dev.fuzz] internal/fuzz: implement basic mutator and use in worker
Katie Hockman [Mon, 19 Oct 2020 17:48:28 +0000 (13:48 -0400)]
[dev.fuzz] internal/fuzz: implement basic mutator and use in worker

Note that this is an extremely basic mutator, and only
meant to act as a placeholder for future development.

Change-Id: I650691db44f30953345702aac93cbd1cadc21427
Reviewed-on: https://go-review.googlesource.com/c/go/+/263657
Trust: Katie Hockman <katie@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
3 years ago[dev.fuzz] testing: cleanup a few small things
Katie Hockman [Mon, 19 Oct 2020 15:04:37 +0000 (11:04 -0400)]
[dev.fuzz] testing: cleanup a few small things

Deletes the exported testing.Fuzz function
which would run a standalone fuzz target.
Similar to RunFuzzing and RunFuzzTargets,
which were previously removed, this will
likely be too complex to support.

Moves the deferred Exit in f.Fuzz higher up
the function so it is always run.

Change-Id: I9ea6210dc30dee8c2a943bfb8077225c369cfb95
Reviewed-on: https://go-review.googlesource.com/c/go/+/263642
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
3 years ago[dev.fuzz] testing: read corpus from testdata/corpus for each target
Katie Hockman [Tue, 6 Oct 2020 21:54:50 +0000 (17:54 -0400)]
[dev.fuzz] testing: read corpus from testdata/corpus for each target

This change also includes a small cleanup of the run()
function and additional tests for error conditions
in fuzz targets.

Change-Id: I2b7722b25a0d071182a84f1dc4b92e82a7ea34d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/256978
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Katie Hockman <katie@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
3 years ago[dev.fuzz] testing: remove testing.RunFuzzTargets
Katie Hockman [Wed, 14 Oct 2020 16:05:13 +0000 (12:05 -0400)]
[dev.fuzz] testing: remove testing.RunFuzzTargets

It is a legacy practice to expose these exported
testing functions, and is not needed for running
fuzz targets.

Change-Id: Ic300c9bfd15f4e71a1cea99f12c97d671a899f9b
Reviewed-on: https://go-review.googlesource.com/c/go/+/262258
Trust: Katie Hockman <katie@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
3 years ago[dev.fuzz] internal/fuzz: coordinate fuzzing across workers
Jay Conrod [Fri, 2 Oct 2020 20:05:33 +0000 (16:05 -0400)]
[dev.fuzz] internal/fuzz: coordinate fuzzing across workers

Package fuzz provides common fuzzing functionality for tests built
with "go test" and for programs that use fuzzing functionality in the
testing package.

Change-Id: I3901c6a993a9adb8a93733ae1838b86dd78c7036
Reviewed-on: https://go-review.googlesource.com/c/go/+/259259
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Trust: Katie Hockman <katie@golang.org>
Trust: Jay Conrod <jayconrod@google.com>

3 years ago[dev.fuzz] testing: exit after f.Fuzz function
Katie Hockman [Wed, 7 Oct 2020 18:08:53 +0000 (14:08 -0400)]
[dev.fuzz] testing: exit after f.Fuzz function

This change causes f.Fuzz to call runtime.GoExit
when it has finished running. This would mean that
any code after an f.Fuzz function within a fuzz
target would not be executed.

In the future, vet should fail if someone tries to
do this.

This change also adds the missing code that would
execute any cleanup functions added by f.Cleanup.

Change-Id: Ib4d1e6bcafbe189986d0667a1e87dabae67ee621
Reviewed-on: https://go-review.googlesource.com/c/go/+/260338
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Katie Hockman <katie@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
3 years ago[dev.fuzz] testing: fix error message checked in tests
Katie Hockman [Tue, 6 Oct 2020 21:13:26 +0000 (17:13 -0400)]
[dev.fuzz] testing: fix error message checked in tests

Change-Id: Ie40bcca896b95f575d7edd054fbe7a8029d2fc5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/259977
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Katie Hockman <katie@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
3 years ago[dev.fuzz] testing: panic if certain testing.F functions are called in Fuzz func
Katie Hockman [Mon, 5 Oct 2020 18:24:21 +0000 (14:24 -0400)]
[dev.fuzz] testing: panic if certain testing.F functions are called in Fuzz func

Change-Id: I8ee513b2b157e6033d4bc9607d0e65f42bd6801f
Reviewed-on: https://go-review.googlesource.com/c/go/+/259657
Trust: Katie Hockman <katie@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
3 years ago[dev.fuzz] testing: implement F.Fuzz to run seed corpus
Katie Hockman [Fri, 18 Sep 2020 14:13:23 +0000 (10:13 -0400)]
[dev.fuzz] testing: implement F.Fuzz to run seed corpus

Change-Id: Ibd204a5d0596c4f8acf598289055c17a836d9023
Reviewed-on: https://go-review.googlesource.com/c/go/+/255957
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Katie Hockman <katie@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
3 years ago[dev.fuzz] testing: add support for testing.F.Add of []byte
Katie Hockman [Tue, 15 Sep 2020 19:13:31 +0000 (15:13 -0400)]
[dev.fuzz] testing: add support for testing.F.Add of []byte

Change-Id: I183693fec6a643b2f27cc379a422e2b42d8eca90
Reviewed-on: https://go-review.googlesource.com/c/go/+/255339
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Trust: Katie Hockman <katie@golang.org>

3 years ago[dev.fuzz] testing: small cleanup to running targets
Katie Hockman [Thu, 17 Sep 2020 14:28:18 +0000 (10:28 -0400)]
[dev.fuzz] testing: small cleanup to running targets

Change-Id: Idcf90c5acbf7dbba2ea01d21d893214a5c2028c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/255517
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
3 years ago[dev.fuzz] testing: add script tests for fuzz targets
Katie Hockman [Fri, 11 Sep 2020 15:11:08 +0000 (11:11 -0400)]
[dev.fuzz] testing: add script tests for fuzz targets

Tests include:
  - matching fuzz targets
  - matching fuzz targets with -fuzz
  - chatty tests with -v
  - failing tests
  - skipped tests
  - passing tests
  - panic in tests

Change-Id: I54e63c8891b45cfae7212924e067e790f25ab411
Reviewed-on: https://go-review.googlesource.com/c/go/+/254360
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Trust: Jay Conrod <jayconrod@google.com>
Trust: Katie Hockman <katie@golang.org>

3 years ago[dev.fuzz] testing: add basic go command support for fuzzing
Katie Hockman [Thu, 27 Aug 2020 22:36:42 +0000 (18:36 -0400)]
[dev.fuzz] testing: add basic go command support for fuzzing

This change adds support for a -fuzz flag in the go command, and sets up
the groundwork for native fuzzing support. These functions are no-ops
for now, but will be built out and tested in future PRs.

Change-Id: I58e78eceada5799bcb73acc4ae5a20372badbf40
Reviewed-on: https://go-review.googlesource.com/c/go/+/251441
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
3 years agodoc/go1.16: document no language changes
Dmitri Shuralyov [Thu, 3 Dec 2020 17:07:52 +0000 (17:07 +0000)]
doc/go1.16: document no language changes

There are no language changes in Go 1.16, so document that.

For #40700.
Fixes #42976.

Change-Id: I80b0d2ce6cf550c00c0f026ee59ac9fbce6310be
Reviewed-on: https://go-review.googlesource.com/c/go/+/275117
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agoio/fs: add Sub
Russ Cox [Wed, 2 Dec 2020 17:49:20 +0000 (12:49 -0500)]
io/fs: add Sub

Sub provides a convenient way to refer to a subdirectory
automatically in future operations, like Unix's chdir(2).

The CL also includes updates to fstest to check Sub implementations.

As part of updating fstest, I changed the meaning of TestFS's
expected list to introduce a special case: if you list no expected files,
that means the FS must be empty. In general it's OK not to list all
the expected files, but if you list none, that's almost certainly a
mistake - if your FS were broken and empty, you wouldn't find out.
Making no expected files mean "must be empty" makes the mistake
less likely - if your file system ever worked, then your test will keep
it working.

That change found a testing bug: embedtest was making exactly
that mistake.

Fixes #42322.

Change-Id: I63fd4aa866b30061a0e51ca9a1927e576d6ec41e
Reviewed-on: https://go-review.googlesource.com/c/go/+/274856
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agocmd/go/internal/modload: fix minor errors in comments
Bryan C. Mills [Thu, 3 Dec 2020 21:14:07 +0000 (16:14 -0500)]
cmd/go/internal/modload: fix minor errors in comments

Change-Id: I38848e7bcd5dfa9f7feb415e1c54921768bf1ab8
Reviewed-on: https://go-review.googlesource.com/c/go/+/275295
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
3 years agoruntime: avoid receiving preemotion signal while exec'ing
Cherry Zhang [Thu, 3 Dec 2020 21:53:30 +0000 (16:53 -0500)]
runtime: avoid receiving preemotion signal while exec'ing

The iOS kernel has the same problem as the macOS kernel. Extend
the workaround of #41702 (CL 262438 and CL 262817) to iOS.

Updates #35851.

Change-Id: I7ccec00dc96643c08c5be8b385394856d0fa0f64
Reviewed-on: https://go-review.googlesource.com/c/go/+/275293
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agodoc/go1.16: preannounce dropping macOS 10.12 support
Dmitri Shuralyov [Thu, 3 Dec 2020 22:29:39 +0000 (17:29 -0500)]
doc/go1.16: preannounce dropping macOS 10.12 support

Go 1.16 will be the last to support macOS 10.12 Sierra.
Go 1.17 will require macOS 10.13 High Sierra.

For #23011.

Change-Id: I80052bdde4d9f1c5d71b67b85f65fb0b40856750
Reviewed-on: https://go-review.googlesource.com/c/go/+/275299
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agocmd/go, embed: exclude .* and _* from embedded directory trees
Russ Cox [Wed, 2 Dec 2020 20:09:12 +0000 (15:09 -0500)]
cmd/go, embed: exclude .* and _* from embedded directory trees

Discussion on #42328 led to a decision to exclude files matching
.* and _* from embedded directory results when embedding an
entire directory tree.

This CL implements that new behavior.

Fixes #42328.

Change-Id: I6188994e96348b3449c7d9d3d0d181cfbf2d4db1
Reviewed-on: https://go-review.googlesource.com/c/go/+/275092
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agodoc/go1.16: add reflect changes to release notes
Alberto Donizetti [Tue, 1 Dec 2020 13:12:22 +0000 (14:12 +0100)]
doc/go1.16: add reflect changes to release notes

For #40700
Fixes #42911

Change-Id: I1bd729f72ae3a29d190ffc34a40c3d0b59ebbbb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/274474
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years agodoc/go1.16: fix broken <code> tag
Filippo Valsorda [Fri, 4 Dec 2020 00:09:13 +0000 (01:09 +0100)]
doc/go1.16: fix broken <code> tag

For #40700

Change-Id: I0083db494284d6142e1b8b981fca4ac30af2012a
Reviewed-on: https://go-review.googlesource.com/c/go/+/275312
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Filippo Valsorda <filippo@golang.org>

3 years agodoc/go1.16: pre-announce GODEBUG=x509ignoreCN=0 removal in Go 1.17
Filippo Valsorda [Thu, 29 Oct 2020 23:04:00 +0000 (00:04 +0100)]
doc/go1.16: pre-announce GODEBUG=x509ignoreCN=0 removal in Go 1.17

For #40700
Updates #24151

Change-Id: Id63dcaad238f7534bfce8902b8cb3efd8db5942d
Reviewed-on: https://go-review.googlesource.com/c/go/+/266539
Trust: Filippo Valsorda <filippo@golang.org>
Trust: Katie Hockman <katie@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
3 years agocmd/compile: make sure address of offset(SP) is rematerializeable
Cherry Zhang [Thu, 3 Dec 2020 18:32:11 +0000 (13:32 -0500)]
cmd/compile: make sure address of offset(SP) is rematerializeable

An address of offset(SP) may point to the callee args area, and
may be used to move things into/out of the args/results. If an
address like that is spilled and picked up by the GC, it may hold
an arg/result live in the callee, which may not actually be live
(e.g. a result not initialized at function entry). Make sure
they are rematerializeable, so they are always short-lived and
never picked up by the GC.

This CL changes 386, PPC64, and Wasm. On AMD64 we already have
the rule (line 2159). On other architectures, we already have
similar rules like
(OffPtr [off] ptr:(SP)) => (MOVDaddr [int32(off)] ptr)
to avoid this problem. (Probably me in the past had run into
this...)

Fixes #42944.

Change-Id: Id2ec73ac08f8df1829a9a7ceb8f749d67fe86d1e
Reviewed-on: https://go-review.googlesource.com/c/go/+/275174
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
3 years agoruntime, time: strictly enforce when, period constraints
Michael Pratt [Wed, 2 Dec 2020 17:19:13 +0000 (12:19 -0500)]
runtime, time: strictly enforce when, period constraints

timer.when must always be positive. addtimer and modtimer already check
that it is non-negative; we expand it to include zero. Also upgrade from
pinning bad values to throwing, as these values shouldn't be possible to
pass (except as below).

timeSleep may overflow timer.nextwhen. This would previously have been
pinned by resetForSleep, now we fix it manually.

runOneTimer may overflow timer.when when adding timer.period. Detect
this and pin to maxWhen.

addtimer is now too strict to allow TestOverflowRuntimeTimer to test an
overflowed timer. Such a timer should not be possible; to help guard
against accidental inclusion siftup / siftdown will check timers as it
goes. This has been replaced with tests for period and sleep overflows.

Change-Id: I17f9739e27ebcb20d87945c635050316fb8e9226
Reviewed-on: https://go-review.googlesource.com/c/go/+/274853
Trust: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agotime, runtime: don't set timer when = 0
Michael Pratt [Tue, 1 Dec 2020 22:24:33 +0000 (17:24 -0500)]
time, runtime: don't set timer when = 0

timer when == 0, in the context of timer0When and timerModifiedEarliest,
is a sentinel value meaning there are no timers on the heap.
TestCheckRuntimeTimerOverflow reaching into the runtime to set a timer
to when = 0 when it is otherwise not possible breaks this invariant.

After golang.org/cl/258303, we will no longer detect and run this timer,
thus blocking any other timers lower on the heap from running. This
manifests as random timers failing to fire in other tests.

The need to set this overflowed timer to when = 0 is gone with the old
timer proc implementation, so we can simply remove it.

Fixes #42424

Change-Id: Iea32100136ad8ec1bedfa77b1e7d9ed868812838
Reviewed-on: https://go-review.googlesource.com/c/go/+/274632
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Michael Pratt <mpratt@google.com>

3 years agodoc/go1.16: update runtime and compiler sections
Austin Clements [Thu, 3 Dec 2020 18:53:41 +0000 (13:53 -0500)]
doc/go1.16: update runtime and compiler sections

This resolves all TODOs for the runtime and compiler and mentions
several other changes.

For #40700.
Fixes #42892.
Fixes #42894.

Change-Id: I18d14cfe572baf679ecf8b0a4e82c4b866da5a04
Reviewed-on: https://go-review.googlesource.com/c/go/+/275176
Trust: Austin Clements <austin@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
3 years agotest: match gofrontend error messages
Ian Lance Taylor [Thu, 3 Dec 2020 20:02:00 +0000 (12:02 -0800)]
test: match gofrontend error messages

fixedbugs/bug487.go:17:17: error: function result count mismatch
fixedbugs/bug487.go:18:16: error: function result count mismatch

fixedbugs/issue6977.go:37:26: error: duplicate method ‘m’
fixedbugs/issue6977.go:38:21: error: duplicate method ‘m’
fixedbugs/issue6977.go:39:26: error: duplicate method ‘m’
fixedbugs/issue6977.go:40:21: error: duplicate method ‘m’

Change-Id: Ie3c8a4650cd8f4c239bdceac25dc188a6a50ca34
Reviewed-on: https://go-review.googlesource.com/c/go/+/275178
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>