]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
13 months agomisc: remove misc/arm/a script
Austin Clements [Mon, 8 May 2023 16:07:21 +0000 (12:07 -0400)]
misc: remove misc/arm/a script

This appears to be a very old wrapper around adb for testing on
Android before we had the go_android_exec wrapper.

Change-Id: I847bb15c98febbcffc063f00719a084e5c99a18b
Reviewed-on: https://go-review.googlesource.com/c/go/+/493604
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
13 months agocmd/cgo: enable test with non-sensible build tag
Austin Clements [Mon, 8 May 2023 15:52:48 +0000 (11:52 -0400)]
cmd/cgo: enable test with non-sensible build tag

The build tag on this file is currently unsatisfiable. It was clearly
supposed to be "linux || freebsd || openbsd", but the test doesn't
actually compile on FreeBSD or OpenBSD because they don't define
SYS_gettid. Change the build tag to just "linux".

Change-Id: Ifaffac5438e1b94a8588b5a00435461aa171a6fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/493603
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agoos, syscall: support ill-formed UTF-16 strings on Windows
qmuntal [Fri, 5 May 2023 16:17:18 +0000 (18:17 +0200)]
os, syscall: support ill-formed UTF-16 strings on Windows

Windows UTF-16 strings can contain unpaired surrogates, which can't be
decoded into a valid UTF-8 string. This file defines a set of functions
that can be used to encode and decode potentially ill-formed UTF-16
strings by using the
[the WTF-8 encoding](https://simonsapin.github.io/wtf-8/).

WTF-8 is a strict superset of UTF-8, i.e. any string that is
well-formed in UTF-8 is also well-formed in WTF-8 and the content
is unchanged. Also, the conversion never fails and is lossless.

The benefit of using WTF-8 instead of UTF-8 when decoding a UTF-16
string is that the conversion is lossless even for ill-formed
UTF-16 strings. This property allows to read an ill-formed UTF-16
string, convert it to a Go string, and convert it back to the same
original UTF-16 string.

Fixes #59971

Change-Id: Id6007f6e537844913402b233e73d698688cd5ba6
Reviewed-on: https://go-review.googlesource.com/c/go/+/493036
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Paul Hampson <Paul.Hampson@Pobox.com>
13 months agocmd/go/internal/modindex: update index_format.txt
Bryan C. Mills [Thu, 27 Apr 2023 17:23:10 +0000 (13:23 -0400)]
cmd/go/internal/modindex: update index_format.txt

This incorporates the changes from CL 453603 and CL 416178.

Please review carefully: I did my best to read through the CLs, but
I'm not entirely confident I haven't made a mistake.

Fixes #59770.

Change-Id: Ib8937e55dcd11e3f75c16b28519d3d91df1d4da3
Reviewed-on: https://go-review.googlesource.com/c/go/+/492596
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
13 months agocmd/link: fix checks for supported linker flags with relative paths.
James Bartlett [Wed, 3 May 2023 18:27:05 +0000 (18:27 +0000)]
cmd/link: fix checks for supported linker flags with relative paths.

The existing way of checking for supported linker flags causes false negatives
when there are relative paths passed to go tool link. This fixes the issue by
calling the external linker in the current working directory, instead of
in a temporary directory.

Fixes #59952

Change-Id: I173bb8b44902f30dacefde1c202586f87667ab70
Reviewed-on: https://go-review.googlesource.com/c/go/+/491796
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
13 months agocmd/dist: use registerStdTestSpecially for normal Go tests only
Dmitri Shuralyov [Fri, 12 May 2023 17:00:45 +0000 (13:00 -0400)]
cmd/dist: use registerStdTestSpecially for normal Go tests only

It was my oversight in CL 463276 to skip registerStdTestSpecially
packages in the race bench test registration loop. Package testdir
has no benchmarks and doesn't need to be skipped. (And if it had
benchmarks, it's very unlikely they'd need any special handling.)

By now there are more cmd/cgo/internal/... packages that are registered
specially, and there isn't a need for their few benchmarks not to be
used for the purpose of race bench tests. If the 3 benchmarks in
cmd/cgo/internal/test were to require something special, then we can
add it to a new registerRaceBenchTestSpecially map with a comment, and
do register them specially in registerTests instead of forgetting to.

This restores the automatic 'go_test_bench:cmd/cgo/internal/test'
registration and reduces prevalence of registerStdTestSpecially a bit.

For #37486.
For #56844.

Change-Id: I1791fe5bf94cb4b4e0859c5fff4e7a3d5a23723e
Reviewed-on: https://go-review.googlesource.com/c/go/+/494656
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>

13 months agotest: add escape test for reflect.Value operations
Cherry Mui [Mon, 10 Oct 2022 22:05:16 +0000 (18:05 -0400)]
test: add escape test for reflect.Value operations

With CL 408826 reflect.Value does not always escape. We need to
make sure Value operations does (or does not) escape the Value
correctly. This CL adds a test.

There are still a few unfortunate cases, where some Value
operations escape more than necessary (comparing to a non-reflect
version of the code), but hard to fix. These are mostly that a
Value would escape conditionally (mostly on the type of the Value),
but currently we don't have a good way to express that.

Change-Id: I9fdfc7584670aa09c5a01f6b2803f2043aaddb65
Reviewed-on: https://go-review.googlesource.com/c/go/+/441938
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
13 months agoos, runtime: remove unused implementations of os.sigpipe
Ian Lance Taylor [Fri, 17 Mar 2023 20:30:22 +0000 (13:30 -0700)]
os, runtime: remove unused implementations of os.sigpipe

Clean up instances that are unused since CL 6450058.

Change-Id: I0e9ae28cfa83fcc8abda8f5eca9c7dfc2c1c4ad1
Reviewed-on: https://go-review.googlesource.com/c/go/+/477396
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Bypass: Ian Lance Taylor <iant@golang.org>

13 months agoreflect: make Value.IsZero not escape
Cherry Mui [Fri, 7 Oct 2022 22:11:10 +0000 (18:11 -0400)]
reflect: make Value.IsZero not escape

With CL 408826 reflect.Value not always escape. IsZero still
escapes the Value because in some cases it passes the Value
pointer to the equal function, which is function pointer. Equal
functions are compiler generated and never escapes, but the escape
analysis doesn't know. Add noescape to help.

Change-Id: Ica397c2be77cac9e8a46d03d70bac385b0aa9e82
Reviewed-on: https://go-review.googlesource.com/c/go/+/441937
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agoreflect: do not escape Value.Type
Cherry Mui [Fri, 17 Jun 2022 17:06:16 +0000 (13:06 -0400)]
reflect: do not escape Value.Type

Types are either static (for compiler-created types) or heap
allocated and always reachable (for reflection-created types, held
in the central map). So there is no need to escape types.

With CL 408826 reflect.Value does not always escape. Some functions
that escapes Value.typ would make the Value escape without this CL.

Had to add a special case for the inliner to keep (*Value).Type
still inlineable.

Change-Id: I7c14d35fd26328347b509a06eb5bd1534d40775f
Reviewed-on: https://go-review.googlesource.com/c/go/+/413474
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agoreflect: allow Value be stack allocated
Cherry Mui [Fri, 27 May 2022 19:44:40 +0000 (15:44 -0400)]
reflect: allow Value be stack allocated

Currently, reflect.ValueOf forces the referenced object to be heap
allocated. This CL makes it possible to be stack allocated. We
need to be careful to make sure the compiler's escape analysis can
do the right thing, e.g. channel send, map assignment, unsafe
pointer conversions.

Tests will be added in a later CL.

CL 408827 might help ensure the correctness.

Change-Id: I8663651370c7c8108584902235062dd2b3f65954
Reviewed-on: https://go-review.googlesource.com/c/go/+/408826
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
13 months agocmd/compile: remove post-inlining PGO graph dump
Michael Pratt [Fri, 12 May 2023 15:54:47 +0000 (11:54 -0400)]
cmd/compile: remove post-inlining PGO graph dump

The RedirectEdges logic is fragile and not quite complete (doesn't
update in-edges), which adds overhead to maintaining this package.

In my opinion, the post-inlining graph doesn't provide as much value as
the pre-inlining graph. Even the latter I am not convinced should be in
the compiler rather than an external tool, but it is comparatively
easier to maintain.

Drop it for now. Perhaps we'll want it back in the future for tracking
follow-up optimizations, but for now keep things simple.

Change-Id: I3133a2eb97893a14a6770547f96a3f1796798d17
Reviewed-on: https://go-review.googlesource.com/c/go/+/494655
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>

13 months agocmd/compile/internal/pgo: remove node weights from IRNode
Michael Pratt [Fri, 12 May 2023 14:33:14 +0000 (10:33 -0400)]
cmd/compile/internal/pgo: remove node weights from IRNode

Actual PGO operation doesn't use these weights at all. They are
theoretically used when printing a dot graph for debugging, but that
doesn't actually work because these weights are always zero.

These fields are initialized by looking for a NodeMap entry with key
{CallerName: sym, CalleeName: "", CallSiteOffset: 0}. These entries will
never exist, as we never put entries in NodeMap without CalleeName.

Since they aren't really used and don't work, just remove them entirely,
which offers nice simplification.

This leaves IRNode with just a single field. I keep the type around as a
future CL will make the *ir.Func optional, allowing nodes with a name
but no IR.

Change-Id: I1646654cad1d0779ce071042768ffad2a7e6ff49
Reviewed-on: https://go-review.googlesource.com/c/go/+/494616
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>

13 months agotime: update windows zoneinfo_abbrs
Carlos Amedee [Mon, 8 May 2023 15:17:59 +0000 (11:17 -0400)]
time: update windows zoneinfo_abbrs

The primary branch of the github.com/unicode-org/cldr repository
has changed to main instead of master. This changes the branch used
to download the Windows zone file.

Ran:
go generate time

For #58113

Change-Id: Idb3dcaf44fc52d4b6abfed5a3ca6cd6f745dc3f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/493477
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Auto-Submit: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Carlos Amedee <carlos@golang.org>

13 months agocmd/cgo/internal/testcarchive: build on all platforms
Austin Clements [Fri, 12 May 2023 19:19:23 +0000 (15:19 -0400)]
cmd/cgo/internal/testcarchive: build on all platforms

This test package uses syscall.SIGSEGV and syscall.SIGPIPE, which are
defined on most, but not all platforms. Normally this test runs as
part of dist test, which only registers this test on platforms that
support c-archive build mode, which includes all platforms that define
these signals. But this doesn't help if you're just trying to type
check everything in cmd.

Add build constraints so that this package type checks on all
platforms.

Fixes #60164.
Updates #37486.

Change-Id: Id3f9ad4cc9f80146de16aedcf85d108a77215ae6
Reviewed-on: https://go-review.googlesource.com/c/go/+/494659
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Austin Clements <austin@google.com>
Auto-Submit: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agocmd/cgo/internal/testsanitizers: build on all platforms
Austin Clements [Fri, 12 May 2023 19:19:23 +0000 (15:19 -0400)]
cmd/cgo/internal/testsanitizers: build on all platforms

This test package uses the Pdeathsig field of syscall.SysProcAttr,
which is only available on a few platforms. Currently, dist test
checks for compatible platforms and only registers it as part of
all.bash on platforms where it can build. But this doesn't help if
you're just trying to type check everything in cmd.

Make this package pass type checking by moving the condition from dist
into build tags on the test package itself.

For #60164.
Updates #37486.

Change-Id: I58b12d547c323cec895320baa5fca1b82e99d1b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/494658
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>

13 months agonet: add tests for forceGoDNS and forceCgoDNS
Mateusz Poliwczak [Tue, 2 May 2023 18:40:56 +0000 (18:40 +0000)]
net: add tests for forceGoDNS and forceCgoDNS

There was a bug in forceCgoDNS (CL 479416), it was fixed by CL 487196, so
add a test case for it.

Change-Id: I2010374451ef236dc2898d9e9ea006eb8b40d02e
GitHub-Last-Rev: 34a84fad33404c66c3ee20cb63803214c42e991d
GitHub-Pull-Request: golang/go#59922
Reviewed-on: https://go-review.googlesource.com/c/go/+/491255
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
13 months agocmd/internal/bootstrap_test: update TestExperimentToolID for Go 1.21
Dmitri Shuralyov [Sun, 7 May 2023 02:52:06 +0000 (22:52 -0400)]
cmd/internal/bootstrap_test: update TestExperimentToolID for Go 1.21

This test is configured to run only when explicitly requested due to
being costly. Apply two updates so it can run on the toolchain today:

- overlay GOROOT/lib for zoneinfo.zip (similarly to CL 462279)
- stop expecting framepointer to be listed in the GOEXPERIMENT
  section of the compiler version (see CL 49252 and CL 249857)

I checked if by now there's another test that would report a problem
if the fix made in CL 186200 had regressed. Running all.bash locally
with GO_TEST_SHORT=0 GO_BUILDER_NAME=darwin-arm64-longtest passed ok,
while this manual test did catch the problem.

Also simplify the test implementation while here so it's less different
from TestRepeatBootstrap.

For #33091.

Change-Id: I14eea18c19c2e8996bcba31c80e03dcf679f56ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/493475
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
13 months agocmd/go: add a regression test for Git configurations with safe.bareRepository=explicit
Bryan C. Mills [Mon, 8 May 2023 13:15:25 +0000 (09:15 -0400)]
cmd/go: add a regression test for Git configurations with safe.bareRepository=explicit

Change-Id: I394265a4bf849ec89ac44c67aeaaaca801e46caa
Reviewed-on: https://go-review.googlesource.com/c/go/+/493476
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Emily Shaffer <emilyshaffer@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agocmd/go/internal/modload: reject the -modfile flag in workspace mode
Zeke Lu [Tue, 9 May 2023 23:25:50 +0000 (23:25 +0000)]
cmd/go/internal/modload: reject the -modfile flag in workspace mode

Currently, in workspace mode, the -modfile flag affects all the modules
listed in the go.work file. This is not desirable most of the time. And
when it results in an error, the error message does not help.

For example, when there are more than one modules listed in the go.work
file, running "go list -m -modfile=path/to/go.mod" gives this error:
  go: module example.com/foo appears multiple times in workspace

This change reject -modfile flag explicitly with this error message:
  go: -modfile cannot be used in workspace mode

While at here, correct some typos in the modload package.

Fixes #59996.

Change-Id: Iff4cd9f3974ea359889dd713a747b6932cf42dfd
GitHub-Last-Rev: 7dbc9c3f2f9bfe8acab088eb3266a08d8ec1ba16
GitHub-Pull-Request: golang/go#60033
Reviewed-on: https://go-review.googlesource.com/c/go/+/493315
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>

13 months agostrings: correct NewReader documentation
Jabar Asadi [Wed, 10 May 2023 21:44:14 +0000 (21:44 +0000)]
strings: correct NewReader documentation

The provided description for `NewReader` says that the underlying string is read-only. but the following example shows that this is not the case.
<br />

rd := strings.NewReader("this is a text")

rd.Reset("new text") <--- underlying string gets updated here

Change-Id: I95c7099c2e63670c84307d4317b702bf13a4025a
GitHub-Last-Rev: a16a60b0f1e25d19e05e664c5b41ca57c4fcd9b2
GitHub-Pull-Request: golang/go#60074
Reviewed-on: https://go-review.googlesource.com/c/go/+/493817
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

13 months agointernal/testdir: move to cmd/internal/testdir
Dmitri Shuralyov [Tue, 9 May 2023 13:50:19 +0000 (09:50 -0400)]
internal/testdir: move to cmd/internal/testdir

The effect and motivation is for the test to be selected when doing
'go test cmd' and not when doing 'go test std' since it's primarily
about testing the Go compiler and linker. Other than that, it's run
by all.bash and 'go test std cmd' as before.

For #56844.
Fixes #60059.

Change-Id: I2d499af013f9d9b8761fdf4573f8d27d80c1fccf
Reviewed-on: https://go-review.googlesource.com/c/go/+/493876
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
13 months agogo/types: minor refactoring of missingMethod following CL 494615
Rob Findley [Fri, 12 May 2023 15:31:28 +0000 (11:31 -0400)]
go/types: minor refactoring of missingMethod following CL 494615

Make the refactoring suggested by gri@ in that CL.

Change-Id: I6c363f3ba5aaa3c616d3982d998b989de7046a86
Reviewed-on: https://go-review.googlesource.com/c/go/+/494617
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agogo/types, types2: call recordInstance in instantiateSignature
Robert Griesemer [Thu, 11 May 2023 20:55:27 +0000 (13:55 -0700)]
go/types, types2: call recordInstance in instantiateSignature

This matches the pattern we use for type instantiations and
factors out the recordInstance and associated assert calls.

Change-Id: Ib7731c0e619aca42f418cb2d9a153785aaf014cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/494457
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>

13 months agogo/types, types2: be sure to type-check wrong methods in missingMethod
Rob Findley [Fri, 12 May 2023 14:27:33 +0000 (10:27 -0400)]
go/types, types2: be sure to type-check wrong methods in missingMethod

In the case of a wrong method, we were not ensuring that it was
type-checked before passing it to funcString.

Formatting the missing method error message requires a fully set-up
signature.

Fixes #59848

Change-Id: I1467e036afbbbdd00899bfd627a945500dc709c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/494615
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
13 months agocmd/go: diff .so files quietly in TestScript/build_plugin_reproducible
Dmitri Shuralyov [Fri, 12 May 2023 12:54:24 +0000 (08:54 -0400)]
cmd/go: diff .so files quietly in TestScript/build_plugin_reproducible

This avoids printing verbose binary data and making bell sounds when the
test fails. The binary data can be inspected via other means if needed.

For #58557.

Change-Id: Ia1c4f2c6b9ff2cf6f97611cf335b978fc7bb201f
Reviewed-on: https://go-review.googlesource.com/c/go/+/494577
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>

13 months agoruntime: remove unused skip arg from fpTracebackPCs
Felix Geisendörfer [Wed, 26 Apr 2023 07:36:53 +0000 (09:36 +0200)]
runtime: remove unused skip arg from fpTracebackPCs

This was accidentally left behind when moving the logic to set the skip
sentinel in pcBuf to the caller.

Change-Id: Id7565f6ea4df6b32cf18b99c700bca322998d182
Reviewed-on: https://go-review.googlesource.com/c/go/+/489095
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Felix Geisendörfer <felix.geisendoerfer@datadoghq.com>

13 months agoRevert "reflect: change rtype so that it (not *rtype) implements Type"
Austin Clements [Fri, 12 May 2023 12:59:19 +0000 (08:59 -0400)]
Revert "reflect: change rtype so that it (not *rtype) implements Type"

This reverts CL 487558, which is causing test failures in Google. See
b/282133554.

Change-Id: Icafa4ffc6aaa24a363abb90b8ae0b0183aca2b89
Reviewed-on: https://go-review.googlesource.com/c/go/+/494410
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Austin Clements <austin@google.com>

13 months agocmd/dist: drop goTest.dir
Austin Clements [Wed, 10 May 2023 20:31:46 +0000 (16:31 -0400)]
cmd/dist: drop goTest.dir

At this point all tests are regular packages in std or cmd, so we no
longer need goTest.dir.

Change-Id: I46a0c7b4464b0738e9959e41bf840ba1b73e3590
Reviewed-on: https://go-review.googlesource.com/c/go/+/494194
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
13 months agotest/bench: delete
Austin Clements [Wed, 10 May 2023 19:51:41 +0000 (15:51 -0400)]
test/bench: delete

Russ added test/bench/go1 in CL 5484071 to have a stable suite of
programs to use as benchmarks. For the compiler and runtime we had
back then, those were reasonable benchmarks, but the compiler and
runtime are now far more sophisticated and these benchmarks no longer
have good coverage. We also now have better benchmark suites
maintained outside the repo (e.g., golang.org/x/benchmarks). Keeping
test/bench/go1 at this point is actively misleading.

Indirectly related to #37486, as this also removes the last package
dist test runs outside of src/.

Change-Id: I2867ef303fe48a02acce58ace4ee682add8acdbf
Reviewed-on: https://go-review.googlesource.com/c/go/+/494193
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agomisc/reboot: move to cmd/internal/bootstrap_test
Austin Clements [Mon, 8 May 2023 20:31:23 +0000 (16:31 -0400)]
misc/reboot: move to cmd/internal/bootstrap_test

This is the last test run from misc by dist.

For #37486.

Change-Id: I1a70ded29ba0de548c9a16611ba987a258121e80
Reviewed-on: https://go-review.googlesource.com/c/go/+/493606
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
13 months agocmd/dist: drop host test support
Austin Clements [Fri, 5 May 2023 17:52:31 +0000 (13:52 -0400)]
cmd/dist: drop host test support

Host tests are used for emulated builders that use cross-compilation.
Today, this is the android-{386,amd64}-emu builders and all wasm
builders. These builders run all.bash on a linux/amd64 host to build
all packages and most tests for the emulated guest, and then run the
resulting test binaries inside the emulated guest. A small number of
test packages are “host tests”: these run on the host rather than the
guest because they invoke the Go toolchain themselves (which only
lives on the host) and run the resulting binaries in the guest.

However, this host test mechanism is barely used today, despite being
quite complex. This complexity is also causing significant friction to
implementing structured all.bash output.

As of this CL, the whole host test mechanism runs a total of 10 test
cases on a total of two builders (android-{386,amd64}-emu). There are
clearly several tests that are incorrectly being skipped, so we could
expand it to cover more test cases, but it would still apply to only
two builders. Furthermore, the two other Android builders
(android-{arm,arm64}-corellium) build the Go toolchain directly inside
Android and also have access to a C toolchain, so they are able to get
significantly better test coverage without the use of host tests. This
suggests that the android-*-emu builders could do the same. All of
these tests are cgo-related, so they don't run on the wasm hosts
anyway.

Given the incredibly low value of host tests today, they are not worth
their implementation complexity and the friction they cause. Hence,
this CL drops support for host tests. (This was also the last use of
rtSequential, so we drop support for sequential tests, too.)

Fixes #59999.

Change-Id: I3eaca853a8907abc8247709f15a0d19a872dd22d
Reviewed-on: https://go-review.googlesource.com/c/go/+/492986
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agocmd/dist,internal/testdir: more cooperative host test mechanism
Austin Clements [Fri, 5 May 2023 17:26:16 +0000 (13:26 -0400)]
cmd/dist,internal/testdir: more cooperative host test mechanism

On cross-compiling builder machines, we run internal/testdir on the
host, where it can access the Go toolchain to build binaries for the
guest and run them through an exec wrapper. Currently this uses dist
test's existing host test mechanism, which is quite complicated and we
are planning to eliminate (#59999).

Switch internal/testdir to use a more cooperative mechanism. With this
CL, dist still understands that it has to build and run the test using
the host GOOS/GOARCH, but rather than doing complicated manipulation
of environment variables itself, it passes the guest GOOS/GOARCH to
the test, which can easily inject it into its environment. This means
dist test can use "go test" directly, rather than having to split up
the build and run steps.

For #37486.

Change-Id: I556938c0b641960bb778b88b13f2b26256edc7c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/492985
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agotest,internal/testdir: don't set GOOS/GOARCH
Austin Clements [Mon, 8 May 2023 14:47:45 +0000 (10:47 -0400)]
test,internal/testdir: don't set GOOS/GOARCH

The test directory driver currently sets the GOOS/GOARCH environment
variables if they aren't set. This appears to be in service of a
single test, test/env.go, which was introduced in September 2008 along
with os.Getenv. It's not entirely clear what that test is even trying
to check, since runtime.GOOS isn't necessarily the same as $GOOS. We
keep the test around because golang.org/x/tools/go/ssa/interp uses it
as a test case, but we simplify the test and eliminate the need for
the driver to set GOOS/GOARCH.

Change-Id: I5acc0093b557c95d1f0a526d031210256a68222d
Reviewed-on: https://go-review.googlesource.com/c/go/+/493601
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
13 months agomisc: update go.mod comment
Austin Clements [Mon, 8 May 2023 15:28:31 +0000 (11:28 -0400)]
misc: update go.mod comment

We just moved all of the cgo tests out of misc, and this comment was
already a little stale. Update it.

Change-Id: Ide711cce53dbe6d9675de587c1d73514b063e952
Reviewed-on: https://go-review.googlesource.com/c/go/+/493600
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agomisc/swig: move tests to cmd/cgo/internal
Austin Clements [Thu, 4 May 2023 16:13:27 +0000 (12:13 -0400)]
misc/swig: move tests to cmd/cgo/internal

This moves the misc/swig test to cmd/cgo/internal.

This lets these tests access facilities in internal/testenv. It's also
now just a normal test that can run as part of the cmd tests.

For #37486.

Change-Id: Ibe5026219999d175aa0a310b9886bef3f6f9ed17
Reviewed-on: https://go-review.googlesource.com/c/go/+/492722
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
13 months agomisc/swig: restructure as a driver
Austin Clements [Mon, 8 May 2023 18:39:57 +0000 (14:39 -0400)]
misc/swig: restructure as a driver

Currently, the misc/swig tests directly use Swig and C++ and will fail
to build if either Swig or a C++ compiler are not present. Typically,
we hide this fact from users because dist test itself checks for Swig
and a C++ compiler before even attempting to run this test, though
users will see this is they try to go test ./... from misc.

However, we're about to move the misc/swig tests into the cmd module,
where they will be much more visible and much more likely to run
unintentionally. To prevent build errors, this CL restructures these
tests into a single pure Go test plus two test packages hidden in
testdata. This is relatively easy to do for this test because there
are only four test cases total. The pure Go test can check for the
necessary build tools before trying to build and run the tests in
testdata. This also gives us the opportunity to move the LTO variant
of these tests out of dist and into the test itself, simplifying dist.

For #37486.

Change-Id: Ibda089b4069e36866cb31867a7006c790be2d8b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/493599
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
13 months agocmd/go: fix swigOne action with -n
Austin Clements [Sat, 6 May 2023 19:27:02 +0000 (15:27 -0400)]
cmd/go: fix swigOne action with -n

Currently, if cmd/go builds a swig file with the -n (dry run) flag, it
will print the swig command invocation without executing it, but then
attempt to actually rename one of swig's output files, which will
fail. Make this rename conditional on -n. While we're here, we fix the
missing logging of the rename command with -x, too.

Change-Id: I1f6e6efc53dfe4ac5a42d26096679b97bc322827
Reviewed-on: https://go-review.googlesource.com/c/go/+/493255
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agomisc/cgo: move registerCgoTests tests to cmd/cgo/internal
Austin Clements [Thu, 4 May 2023 18:25:24 +0000 (14:25 -0400)]
misc/cgo: move registerCgoTests tests to cmd/cgo/internal

This moves the remaining cgo tests.

For #37486.

Change-Id: I99dea5a312a1974de338461a8b02242e5c1bae62
Reviewed-on: https://go-review.googlesource.com/c/go/+/492721
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
13 months agomisc/cgo/test: add cgo build constraints
Austin Clements [Sat, 6 May 2023 02:29:11 +0000 (22:29 -0400)]
misc/cgo/test: add cgo build constraints

We're about to move this package to cmd/cgo/internal, where it will
get caught up in the "CGO_ENABLED=0 go install cmd" done by make.bash.
Currently, building this package with CGO_ENABLED=0 fails because it
contains several source files that don't themselves import "C", but do
import a subdirectory where that package imports "C" and thus has no
exported API.

Fix the CGO_ENABLED=0 build of this package by adding the necessary
cgo build tags. Not all source files need it, but this CL makes
"CGO_ENABLED=0 go test -c" work in this package.

For #37486.

Change-Id: Id137cdfbdd950eea802413536d990ab642ebcd7e
Reviewed-on: https://go-review.googlesource.com/c/go/+/493215
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Austin Clements <austin@google.com>

13 months agomisc/cgo/test: fix vet error
Austin Clements [Sat, 6 May 2023 01:38:02 +0000 (21:38 -0400)]
misc/cgo/test: fix vet error

Vet's cgocall check fails on misc/cgo/test with "possibly passing Go
type with embedded pointer to C". This error is confusing, but the
cgocall check is looking for passing pointers to Go slices to C, which
is exactly what this test is doing. Normally we don't notice this
because vet doesn't run on misc, but we're about to move this test to
cmd/cgo/internal, where vet will start failing.

I'm not sure why we're passing a pointer to a slice here. It's
important that we call a C function with an unsafe.Pointer to memory
containing a pointer to test #25941 and that the result is this call
is then passed to another C function for #28540. This CL maintains
these two properties without the use of a slice.

For #37486.

Change-Id: I672a3c35931a59f99363050498d6f0c80fb6cd98
Reviewed-on: https://go-review.googlesource.com/c/go/+/493137
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
13 months agomisc/cgo: move easy tests to cmd/cgo/internal
Austin Clements [Thu, 4 May 2023 16:13:27 +0000 (12:13 -0400)]
misc/cgo: move easy tests to cmd/cgo/internal

This moves most misc/cgo tests to cmd/cgo/internal. This is mostly a
trivial rename and updating dist/test.go for the new paths, plus
excluding these packages from regular dist test registration. A few
tests were sensitive to what path they ran in, so we update those.

This will let these tests access facilities in internal/testenv.

For #37486.

Change-Id: I3ed417c7c22d9b667f2767c0cb1f59118fcd4af6
Reviewed-on: https://go-review.googlesource.com/c/go/+/492720
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agoruntime: remove crash_cgo_test CgoRaceSignal timeout
Ian Lance Taylor [Thu, 11 May 2023 21:01:02 +0000 (14:01 -0700)]
runtime: remove crash_cgo_test CgoRaceSignal timeout

The test had a 5 second timeout. Running the test on a Darwin system
sometimes took less than 5 seconds but often took up to 8 seconds.
We don't need a timeout anyhow. Instead, use testenv.Command to
run the program, which uses the test timeout.

Fixes #59807

Change-Id: Ibf3eda9702731bf98601782f4abd11c3caa0bf40
Reviewed-on: https://go-review.googlesource.com/c/go/+/494456
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
13 months agonet: don't treat unknown sources as dns when there is a dns source
Mateusz Poliwczak [Thu, 11 May 2023 17:27:02 +0000 (17:27 +0000)]
net: don't treat unknown sources as dns when there is a dns source

Change-Id: I3a6c3a804604b1e74a1ea6b66ab2c932a0ac973a
GitHub-Last-Rev: ea5403549a51a29a2799674d74425b480253d2f1
GitHub-Pull-Request: golang/go#60025
Reviewed-on: https://go-review.googlesource.com/c/go/+/493236
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Mateusz Poliwczak <mpoliwczak34@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agonet: clear /etc/hosts cache on fs.ErrNotExist and fs.ErrPermission errors
Mateusz Poliwczak [Thu, 11 May 2023 11:54:28 +0000 (11:54 +0000)]
net: clear /etc/hosts cache on fs.ErrNotExist and fs.ErrPermission errors

This was also the cause of my issues in CL 455275

Before:
root@arch:~/aa# $(time sleep 5 && mv /etc/hosts /tmp/hosts) &
[1] 2214
root@arch:~/aa# go run main.go
[232.223.232.123] <nil>
[232.223.232.123] <nil>
[232.223.232.123] <nil>
[232.223.232.123] <nil>
[232.223.232.123] <nil>
[232.223.232.123] <nil>
(....)

After:
root@arch:~/aa# $(time sleep 5 && mv /etc/hosts /tmp/hosts) &
[1] 2284
root@arch:~/aa# go run main.go
[232.223.232.123] <nil>
[232.223.232.123] <nil>
[232.223.232.123] <nil>
[232.223.232.123] <nil>
[232.223.232.123] <nil>
[] lookup sth on 127.0.0.53:53: server misbehaving
[] lookup sth on 127.0.0.53:53: server misbehaving

Change-Id: I3090fd8f3105db8c2d7c3bf5afe7b18ebca61cda
GitHub-Last-Rev: cb0dac6448bbc337cd015ad4b4b3d1da3f14a561
GitHub-Pull-Request: golang/go#59963
Reviewed-on: https://go-review.googlesource.com/c/go/+/492555
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Mateusz Poliwczak <mpoliwczak34@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
13 months agoruntime: save/fetch g register during VDSO on linux/loong64
Guoqi Chen [Tue, 28 Mar 2023 21:10:45 +0000 (05:10 +0800)]
runtime: save/fetch g register during VDSO on linux/loong64

Like arm64, ppc64 and risv64, on loong64, the G register may be temporarily
broken during a VDSO call. If a signal is received during a VDSO call, an
invalid G may be obtained.

See #34391.

Change-Id: Iaffa8cce4f0ef8ef74225c355ec3c20ed238025f
Reviewed-on: https://go-review.googlesource.com/c/go/+/426355
Reviewed-by: WANG Xuerui <git@xen0n.name>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: WANG Xuerui <git@xen0n.name>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
13 months agonet: return fallbackOrder immediately for some GOOS
Mateusz Poliwczak [Thu, 11 May 2023 07:57:33 +0000 (07:57 +0000)]
net: return fallbackOrder immediately for some GOOS

We don't need to check resolv.conf, nsswitch.conf on these systems.
Seems like this was the behaviour before CL 487196.

Change-Id: I34ef3510891c572772a222fbbe47693aa6c7cf38
GitHub-Last-Rev: 3aace0e6615b79bbf379e05ca3a353e194dc7c0b
GitHub-Pull-Request: golang/go#59946
Reviewed-on: https://go-review.googlesource.com/c/go/+/491995
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Mateusz Poliwczak <mpoliwczak34@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
13 months agosyscall: implement wasip1 SetNonblock and IsNonblock
Chris O'Hara [Mon, 8 May 2023 07:06:08 +0000 (17:06 +1000)]
syscall: implement wasip1 SetNonblock and IsNonblock

Allows for the NONBLOCK file descriptor flag to be set and queried
on wasip1.

syscall.SetNonblock uses the fd_fdstat_set_flags WASI system call
and unix.IsNonblock uses the fd_fdstat_get system call.

This is a prerequisite for non-blocking I/O support.

Change-Id: I2bf79fd57142b2ec53eed3977d9aac8c6337eb80
Reviewed-on: https://go-review.googlesource.com/c/go/+/493356
Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Julien Fabre <ju.pryz@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Achille Roussel <achille.roussel@gmail.com>
13 months agoruntime: remove unused traceFutileWakeup
Michael Anthony Knyszek [Wed, 10 May 2023 01:06:21 +0000 (01:06 +0000)]
runtime: remove unused traceFutileWakeup

Also, document traceEvFutileWakeup as not currently used.

Change-Id: I75831a43d39b6c6ceb5a9b6320c3ae9455681572
Reviewed-on: https://go-review.googlesource.com/c/go/+/494184
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
13 months agoruntime: hide trace.shutdown behind traceShuttingDown
Michael Anthony Knyszek [Tue, 9 May 2023 20:02:24 +0000 (20:02 +0000)]
runtime: hide trace.shutdown behind traceShuttingDown

Change-Id: I0b123e65f40570caeee611679d80dc27034d5a52
Reviewed-on: https://go-review.googlesource.com/c/go/+/494183
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

13 months agoruntime: replace trace.enabled with traceEnabled
Michael Anthony Knyszek [Tue, 9 May 2023 19:37:24 +0000 (19:37 +0000)]
runtime: replace trace.enabled with traceEnabled

[git-generate]
cd src/runtime
grep -l 'trace\.enabled' *.go | grep -v "trace.go" | xargs sed -i 's/trace\.enabled/traceEnabled()/g'

Change-Id: I14c7821c1134690b18c8abc0edd27abcdabcad72
Reviewed-on: https://go-review.googlesource.com/c/go/+/494181
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
13 months agocmd/compile/internal/pgo/internal/graph: delete dead code
Michael Pratt [Thu, 11 May 2023 19:27:12 +0000 (15:27 -0400)]
cmd/compile/internal/pgo/internal/graph: delete dead code

We don't use large swaths of this package. Delete the code. We can
always bring it back later if needed.

Change-Id: I6b39a73ed9c48d2d5b37c14763d7bb7956f3ef43
Reviewed-on: https://go-review.googlesource.com/c/go/+/494438
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
13 months agocmd/compile/internal/pgo: move pprof graph to internal package
Michael Pratt [Thu, 11 May 2023 18:27:25 +0000 (14:27 -0400)]
cmd/compile/internal/pgo: move pprof graph to internal package

graph.go is a simplified fork of github.com/google/pprof/internal/graph,
which is used as an intermediate data structure to construct the final
graph exported by package pgo (IRGraph).

Exporting both is a bit confusing as the former is unused outside of the
package. Since the naming is also similar, move graph.go to its own
package entirely.

Change-Id: I2bccb3ddb6c3f63afb869ea9cf34d2a261cad058
Reviewed-on: https://go-review.googlesource.com/c/go/+/494437
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Michael Pratt <mpratt@google.com>

13 months agocmd/link: check DWARF section sizes separately
Cherry Mui [Thu, 11 May 2023 18:31:31 +0000 (14:31 -0400)]
cmd/link: check DWARF section sizes separately

Currently, we check the total size of all data+DWARF sections
doesn't exceed 2 GB, which doesn't make sense. We should check
data and DWARF separately. And for DWARF, check each section
separately, as we use section offset for references.

Change-Id: I723cde6a2f46e55cc5cb0621926722272581eb48
Reviewed-on: https://go-review.googlesource.com/c/go/+/494439
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>

13 months agoruntime: add traceEnabled function
Michael Anthony Knyszek [Tue, 9 May 2023 19:36:13 +0000 (19:36 +0000)]
runtime: add traceEnabled function

This change introduces the trivial traceEnabled function to help tighten
up the execution tracer's API in preparation for the execution trace
redesign GOEXPERIMENT.

A follow-up change will refactor the runtime to use it.

Change-Id: I19c8728e30aefe543b4a826d95446affa14897e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/494180
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
13 months agoruntime: hide trace lock init details
Michael Anthony Knyszek [Tue, 9 May 2023 19:48:29 +0000 (19:48 +0000)]
runtime: hide trace lock init details

This change is in service of hiding more execution trace implementation
details for big changes to come.

Change-Id: I49b9716a7bf285d23c86b58912a05eff4ddc2213
Reviewed-on: https://go-review.googlesource.com/c/go/+/494182
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agocmd/compile: remove "WORK IN PROGRESS" from package pgo
Michael Pratt [Wed, 10 May 2023 21:40:01 +0000 (17:40 -0400)]
cmd/compile: remove "WORK IN PROGRESS" from package pgo

Work continues on PGO, but the existing support is certainly working.

Change-Id: Ic6724b9b3f174f24662468000d771f7651bb18b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/494435
Auto-Submit: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Commit-Queue: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agoos: make Chtimes accept empty time values to skip file time modification
Constantin Konstantinidis [Mon, 19 Oct 2020 17:19:17 +0000 (19:19 +0200)]
os: make Chtimes accept empty time values to skip file time modification

Empty time value time.Time{} leaves the corresponding time of the file
unchanged.

Fixes #32558

Change-Id: I1aff42f30668ff505ecec2e9509d8f2b8e4b1b6a
Reviewed-on: https://go-review.googlesource.com/c/go/+/219638
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
13 months agoRevert "runtime: rename getcallerfp to getfp"
Michael Pratt [Thu, 11 May 2023 17:01:44 +0000 (17:01 +0000)]
Revert "runtime: rename getcallerfp to getfp"

This reverts CL 481617.

Reason for revert: breaks test build on Windows

Change-Id: Ifc1a323b0cc521e7a5a1f7de7b3da667f5fee375
Reviewed-on: https://go-review.googlesource.com/c/go/+/494377
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agonet: force cgo for myhostname and mdns nss modules for LookupAddr on unix
Mateusz Poliwczak [Sun, 7 May 2023 16:46:42 +0000 (16:46 +0000)]
net: force cgo for myhostname and mdns nss modules for LookupAddr on unix

Currently there is a small bug in the LookupAddr for unix systems
that causes the use of go resolver instead of the cgo one.
Example for nss myhostname:

func main() {
        fmt.Println(net.LookupAddr(os.Args[1]))
}

root@arch:~# cat /etc/nsswitch.conf | grep host
hosts:          myhostname dns
root@arch:~# GODEBUG=netdns=+3 go run main.go 192.168.1.200
go package net: confVal.netCgo = false  netGo = false
go package net: dynamic selection of DNS resolver
go package net: hostLookupOrder() = dns
[] lookup 200.1.168.192.in-addr.arpa. on 8.8.8.8:53: no such host
root@arch:~# GODEBUG=netdns=go+3 go run main.go 192.168.1.200
go package net: confVal.netCgo = false  netGo = true
go package net: GODEBUG setting forcing use of Go's resolver
go package net: hostLookupOrder() = dns
[] lookup 200.1.168.192.in-addr.arpa. on 8.8.8.8:53: no such host
root@arch:~# GODEBUG=netdns=cgo+3 go run main.go 192.168.1.200
go package net: confVal.netCgo = true  netGo = false
go package net: using cgo DNS resolver
go package net: hostLookupOrder() = cgo
[arch] <nil>

The problem come from that we are only checking for hostnames that the
myhostname can resolve, but not for the addrs that it can also.

man  nss-myhostname:
       Please keep in mind that nss-myhostname (and nss-resolve) also
       resolve in the other direction — from locally attached IP
       addresses to hostnames.

Change-Id: Ic18a9f99a2214b2938463e9a95f7f3ca5db1c01b
GitHub-Last-Rev: ade40fd3e3057de418b9b6a79f79fb9a53fb6c09
GitHub-Pull-Request: golang/go#59921
Reviewed-on: https://go-review.googlesource.com/c/go/+/491235
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Mateusz Poliwczak <mpoliwczak34@gmail.com>

13 months agonet: use the lookupOrder for go resolver LookupAddr
Mateusz Poliwczak [Sun, 7 May 2023 13:51:15 +0000 (13:51 +0000)]
net: use the lookupOrder for go resolver LookupAddr

To mach the cgo version behaviour and the LookupHost (go resolver).

Change-Id: I7dc3424d508a62e67f20c7810743399c35a9b60c
GitHub-Last-Rev: 29924c13a6c0598bf58b7fc3fae74b10bab0f0ee
GitHub-Pull-Request: golang/go#60024
Reviewed-on: https://go-review.googlesource.com/c/go/+/493235
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
13 months agocmd/compile: remove go:wasmimport restriction
Johan Brandhorst-Satzkorn [Wed, 26 Apr 2023 15:18:10 +0000 (08:18 -0700)]
cmd/compile: remove go:wasmimport restriction

Removes the package restriction on go:wasmimport, allowing the
use of it globally and in user code.

Fixes #59149

Change-Id: Ib26f628dc8dafb31388005b50449e91b47dab447
Reviewed-on: https://go-review.googlesource.com/c/go/+/489255
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
13 months agoruntime: rename getcallerfp to getfp
Felix Geisendörfer [Mon, 3 Apr 2023 23:10:55 +0000 (01:10 +0200)]
runtime: rename getcallerfp to getfp

The previous name was wrong due to the mistaken assumption that calling
f->g->getcallerpc and f->g->getcallersp would respectively return the
pc/sp at g. However, they are actually referring to their caller's
caller, i.e. f.

Rename getcallerfp to getfp in order to stay consistent with this
naming convention.

Also see discussion on CL 463835.

For #16638

Change-Id: I07990645da78819efd3db92f643326652ee516f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/481617
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Felix Geisendörfer <felix.geisendoerfer@datadoghq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agomisc/wasm: add wasmedge to wasip1 script
Johan Brandhorst-Satzkorn [Wed, 10 May 2023 03:32:19 +0000 (20:32 -0700)]
misc/wasm: add wasmedge to wasip1 script

The wasmedge runtime will be used to test our wasip1
implementation against the WASI runtime from wasmedge.org.

For #60097

Change-Id: Ib0e886de46240b4d43d02ec8a7bc7cea0730c162
Reviewed-on: https://go-review.googlesource.com/c/go/+/494120
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>

13 months agocmd/compile: remove debugging option InlineSCCOnePass from inliner
Than McIntosh [Mon, 1 May 2023 19:23:42 +0000 (15:23 -0400)]
cmd/compile: remove debugging option InlineSCCOnePass from inliner

Delete the "InlineSCCOnePass" debugging flag and the inliner fallback
code that kicks in if it is used. The change it was intended to guard
has been working on tip for some time, no need for the fallback any
more.

Updates #58905.

Change-Id: I2e1dbc7640902d9402213db5ad338be03deb96c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/492015
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agointernal/reflectlite: common up types, remove code
David Chase [Wed, 26 Apr 2023 19:30:04 +0000 (15:30 -0400)]
internal/reflectlite: common up types, remove code

Change-Id: I4d3ef025b935e52c47896f69814ba2f1a504d749
Reviewed-on: https://go-review.googlesource.com/c/go/+/489375
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: David Chase <drchase@google.com>

13 months agoruntime: move per-type types to internal/abi
David Chase [Tue, 25 Apr 2023 23:14:05 +0000 (19:14 -0400)]
runtime: move per-type types to internal/abi

Change-Id: I1f031f0f83a94bebe41d3978a91a903dc5bcda66
Reviewed-on: https://go-review.googlesource.com/c/go/+/489276
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agoruntime: redefine _type to abi.Type; add rtype for methods.
David Chase [Mon, 24 Apr 2023 19:45:33 +0000 (15:45 -0400)]
runtime: redefine _type to abi.Type; add rtype for methods.

Change-Id: I1c478b704d84811caa209006c657dda82d9c4cf9
Reviewed-on: https://go-review.googlesource.com/c/go/+/488435
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
13 months agointernal/bisect: copy parser changes from CL 494177
Russ Cox [Wed, 10 May 2023 19:51:46 +0000 (15:51 -0400)]
internal/bisect: copy parser changes from CL 494177

x/tools/cmd/bisect is changing to emit hex skips for robustness.
Update this copy of internal/bisect to understand them.

Change-Id: Ie9445714e8e9fb594e656db2f94dcde9b6ce82d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/494178
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agoreflect: change rtype so that it (not *rtype) implements Type
David Chase [Fri, 21 Apr 2023 17:40:58 +0000 (13:40 -0400)]
reflect: change rtype so that it (not *rtype) implements Type

The abi.Type field was changed to *abi.Type, thus the
bitwise representation is the same, many casts are now
avoided and replace by either rtype{afoo} or rfoo.Type.

Change-Id: Ie7643edc714a0e56027c2875498a4dfe989cf7dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/487558
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agoreflect: replacing almost all use of *rtype with *abi.Type
David Chase [Thu, 20 Apr 2023 21:13:11 +0000 (17:13 -0400)]
reflect: replacing almost all use of *rtype with *abi.Type

Change-Id: I3601525b10237d828c449c62a3447f66cb6f025e
Reviewed-on: https://go-review.googlesource.com/c/go/+/487557
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agoreflect: move funcType to abi/type.go
David Chase [Wed, 19 Apr 2023 17:49:04 +0000 (13:49 -0400)]
reflect: move funcType to abi/type.go

Change-Id: I381229ba67a39487cdcc60da1c73d33b0a7d494a
Reviewed-on: https://go-review.googlesource.com/c/go/+/487556
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: David Chase <drchase@google.com>

13 months agoreflect: prepare fieldnames for moving to abi/type.go
David Chase [Wed, 19 Apr 2023 17:47:53 +0000 (13:47 -0400)]
reflect: prepare fieldnames for moving to abi/type.go

Change-Id: Ia8e88029d29a1210dc7a321578e61336e235f35a
Reviewed-on: https://go-review.googlesource.com/c/go/+/487555
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
13 months agointernal/abi,reflectlite,reflect,runtime: common up chan type
David Chase [Fri, 14 Apr 2023 22:18:01 +0000 (18:18 -0400)]
internal/abi,reflectlite,reflect,runtime: common up chan type

Change-Id: I085b61c544b85d70fabb1c0d9fe91207826dd21a
Reviewed-on: https://go-review.googlesource.com/c/go/+/484858
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
13 months agoreflect: move more types, constants, functions into internal/abi
David Chase [Fri, 14 Apr 2023 18:11:45 +0000 (14:11 -0400)]
reflect: move more types, constants, functions into internal/abi

Change-Id: Ib9cd15576896225e7c5e6fda11f1a77f6993a91a
Reviewed-on: https://go-review.googlesource.com/c/go/+/484857
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
13 months agointernal/reflectlite, runtime: move more constants and types into internal/abi
David Chase [Fri, 14 Apr 2023 18:09:12 +0000 (14:09 -0400)]
internal/reflectlite, runtime: move more constants and types into internal/abi

Change-Id: If5da1057ead34eb3e4c7f42bbe6ad3d350b97725
Reviewed-on: https://go-review.googlesource.com/c/go/+/484856
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agointernal/abi: common up ArrayType
David Chase [Tue, 7 Feb 2023 22:43:34 +0000 (17:43 -0500)]
internal/abi: common up ArrayType

This refactoring is more problematic because the client
package wrap abi.Type, thus the self-referential fields
within ArrayType need to be downcast to the client wrappers
in several places.  It's not clear to me this is worthwhile;
this CL is for additional comment, before I attempt similar
changes for other self-referential types.

Change-Id: I41e517e6d851b32560c41676b91b76d7eb17c951
Reviewed-on: https://go-review.googlesource.com/c/go/+/466236
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
13 months agointernal/abi: common up some offset/size functions
David Chase [Mon, 13 Feb 2023 23:52:16 +0000 (18:52 -0500)]
internal/abi: common up some offset/size functions

Change-Id: I92eeed20af35c7dec309457a80b8fd44eb70b57f
Reviewed-on: https://go-review.googlesource.com/c/go/+/467876
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
13 months agocmd/link: clean up per-binary slice creation in ld
David Chase [Thu, 19 Jan 2023 18:12:54 +0000 (13:12 -0500)]
cmd/link: clean up per-binary slice creation in ld

A code cleanup opportunity noticed while trying to make slices
be aligned.

Change-Id: I34a807b4cf67d9b4a136c83714a34ffe71dcb166
Reviewed-on: https://go-review.googlesource.com/c/go/+/462757
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agointernal/abi: common up Method, Imethod, UncommonType types
David Chase [Mon, 23 Jan 2023 22:34:18 +0000 (17:34 -0500)]
internal/abi: common up Method, Imethod, UncommonType types

was two commits, the first contained a lot of intermediate work,
better this way.

Change-Id: I7c5b79ef78b21a85828c8aaf9baeae86bb144db7
Reviewed-on: https://go-review.googlesource.com/c/go/+/463118
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agointernal/godebug: make test godebug calls not vary
David Chase [Tue, 9 May 2023 21:23:39 +0000 (17:23 -0400)]
internal/godebug: make test godebug calls not vary

I think there may be an issue in bisect search with
change set elements not actually being independent,
to be explored later.  For now, modify the test to
remove that property.

Change-Id: I4b171bc024795d950cf4663374ad1dfc4e2952fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/494036
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
13 months agohtml: convert fuzz test to native Go fuzzing
Tobias Klauser [Wed, 10 May 2023 15:08:59 +0000 (17:08 +0200)]
html: convert fuzz test to native Go fuzzing

Convert the existing gofuzz based fuzz test to a testing.F based fuzz
test.

Change-Id: Ieae69ba7fb17bd54d95c7bb2f4ed04c323c9f15f
Reviewed-on: https://go-review.googlesource.com/c/go/+/494195
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>

13 months agocmd/compile: add ability to print extra information in bisect output
Russ Cox [Tue, 9 May 2023 16:09:45 +0000 (12:09 -0400)]
cmd/compile: add ability to print extra information in bisect output

Change-Id: I619c21ab9754f67b69215cfed238a3e489c7fbcf
Reviewed-on: https://go-review.googlesource.com/c/go/+/493955
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>

13 months agonet/http: let ErrNotSupported match errors.ErrUnsupported
Ian Lance Taylor [Wed, 10 May 2023 19:47:06 +0000 (12:47 -0700)]
net/http: let ErrNotSupported match errors.ErrUnsupported

For #41198

Change-Id: Ibb030e94618a1f594cfd98ddea214ad7a88d2e73
Reviewed-on: https://go-review.googlesource.com/c/go/+/494122
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agogo/types, types2: move xlist next to targs in Checker.arguments signature
Robert Griesemer [Wed, 10 May 2023 16:06:33 +0000 (09:06 -0700)]
go/types, types2: move xlist next to targs in Checker.arguments signature

targs and xlist belong together (xlist contains the type expressions for
each of the type arguments).

Also, in builtins.go, rename xlist to alist2 to avoid some confusion.

Preparation for adding more parameters to the Checker.arguments signature.

Change-Id: I960501cfd2b88410ec0d581a6520a4e80fcdc56a
Reviewed-on: https://go-review.googlesource.com/c/go/+/494121
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
13 months agocmd/compile: add De Morgan's rewrite rule
Stefan [Wed, 10 May 2023 01:34:47 +0000 (01:34 +0000)]
cmd/compile: add De Morgan's rewrite rule

Adds rules that rewrites statements such as ~P&~Q as ~(P|Q) and ~P|~Q as ~(P&Q), removing an extraneous instruction.

Change-Id: Icedb97df741680ddf9799df79df78657173aa500
GitHub-Last-Rev: f22e2350c95e9052e990b2351c3c2b0af810e381
GitHub-Pull-Request: golang/go#60018
Reviewed-on: https://go-review.googlesource.com/c/go/+/493175
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Stefan M <st3f4nm4d4@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
13 months agogo/types, types2: control type inference in Checker.funcInst via infer argument
Robert Griesemer [Tue, 9 May 2023 22:40:36 +0000 (15:40 -0700)]
go/types, types2: control type inference in Checker.funcInst via infer argument

If the infer argument is true, funcInst behaves as before.
If infer is false and there are not enough type arguments,
rather then inferring the missing arguments and instantiating
the function, funcInst returns the found type arguments.

This permits the use of funcInst (and all the checks it does)
to collect the type arguments for partially instantiated
generic functions used as arguments to other functions.

For #59338.

Change-Id: I049034dfde52bd7ff4ae72964ff1708e154e5042
Reviewed-on: https://go-review.googlesource.com/c/go/+/494118
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
13 months agocmd/go/internal: update documentation of go test and go generate
Shogo Hida [Wed, 10 May 2023 14:41:06 +0000 (14:41 +0000)]
cmd/go/internal: update documentation of go test and go generate

Fixes #57050

Change-Id: I46cac667ff78ac171c878f4366f8f01f58f1d27d
GitHub-Last-Rev: 697c255ece18cd4772b76d62991474a7da2536d8
GitHub-Pull-Request: golang/go#57814
Reviewed-on: https://go-review.googlesource.com/c/go/+/461683
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
13 months agocmd/go/internal/modload: skip reading go.mod files for imports in 'go mod tidy' of...
Bryan C. Mills [Fri, 5 May 2023 20:50:56 +0000 (16:50 -0400)]
cmd/go/internal/modload: skip reading go.mod files for imports in 'go mod tidy' of modules before 'go 1.21'

This eliminate a network access in 'go mod tidy' of an already-tidy
module, which would otherwise be needed to fetch go.mod checksums for
the test dependencies whose go.mod checksums were omitted in Go
releases between Go 1.17 and 1.20 due to bug #56222.

For modules between 'go 1.17' and 'go 1.20' we intentionally preserve
the old 'go mod tidy' output (omitting go.sum entries for the go.mod
files of test dependencies of external packages). We should also avoid
performing extra sumdb lookups for checksums that would be discarded
anyway.

Updates #56222.

Change-Id: I7f0f1c8e902db0e3414c819621c4b99052f503f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/492741
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agocmd/internal/obj/riscv: regenerate instruction encoding table
Meng Zhuo [Sat, 6 May 2023 09:34:41 +0000 (17:34 +0800)]
cmd/internal/obj/riscv: regenerate instruction encoding table

This CL updates riscv instructions by
https://github.com/riscv/riscv-opcodes

which adds instruction:
APAUSE

And removes the following unused instructions:
AFENCEI
AFMVQX
AFMVXQ
AHFENCEGVMA
AHFENCEVVMA
ASLLIRV32
ASRAIRV32
ASRLIRV32
AURET

Change-Id: I314570c643af3e6bbc9d2cd471b6b39985bcbdff
Reviewed-on: https://go-review.googlesource.com/c/go/+/409415
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: M Zhuo <mzh@golangcn.org>

13 months agogo/types, types2: explicitly look for nil type arguments in infer
Robert Griesemer [Tue, 9 May 2023 21:02:07 +0000 (14:02 -0700)]
go/types, types2: explicitly look for nil type arguments in infer

Don't assume we have all type arguments if the number of type arguments
matches the number of type parameters. Instead, look explicitly for nil
type arguments in the provided targs.

Preparation for type inference with type arguments provided for type
parameters of generic function arguments passed to other functions.

For #59338.

Change-Id: I00918cd5ed06ae3277b4e41a3641063e0f53fef0
Reviewed-on: https://go-review.googlesource.com/c/go/+/494115
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>

13 months agoencoding/csv: update doc comment of Read method
IvoGoman [Tue, 9 May 2023 20:46:23 +0000 (20:46 +0000)]
encoding/csv: update doc comment of Read method

This updates the doc comment to reflect the behavior of the method.
On error the method returns a partial result.

Fixes #59991

Change-Id: I71e9dfa37e0488c85abd3eeede2a1a34cb74239b
GitHub-Last-Rev: 389488e5364dc939f0cbd11f99eb56001b5237a2
GitHub-Pull-Request: golang/go#60084
Reviewed-on: https://go-review.googlesource.com/c/go/+/494055
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>

13 months agoall: fix a lot of comments
cui fliter [Fri, 5 May 2023 16:11:33 +0000 (00:11 +0800)]
all: fix a lot of comments

Fix comments, including duplicate is, wrong phrases and articles, misspellings, etc.

Change-Id: I8bfea53b9b275e649757cc4bee6a8a026ed9c7a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/493035
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: shuang cui <imcusg@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

13 months agolog/slog: test built-in handlers with slogtest
Jonathan Amsterdam [Mon, 24 Apr 2023 18:19:20 +0000 (14:19 -0400)]
log/slog: test built-in handlers with slogtest

Test the built-in handlers using the testing/slogtest package.

Change-Id: I6464b6730293461c38b84fb2bf33cdd09173dd6e
Reviewed-on: https://go-review.googlesource.com/c/go/+/488255
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agolog/slog: add json struct tags to Source
Jonathan Amsterdam [Tue, 9 May 2023 20:22:09 +0000 (16:22 -0400)]
log/slog: add json struct tags to Source

Add tags to the fields of Source that lower-cases their names for JSON.
The implementation still treats Source specially for performance, but
now the result would be identical if it did not.

Change-Id: I5fd2e500f1a301db62af87be8b877ecd954a26ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/494035
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agocmd: use slices.Equal to simplify code
cui fliter [Thu, 4 May 2023 11:30:53 +0000 (19:30 +0800)]
cmd: use slices.Equal to simplify code

#57433 added slices.Equal, using it can reduce the amount of code

Change-Id: I70d14b6c4c24da641a34ed36c900d9291033f526
Reviewed-on: https://go-review.googlesource.com/c/go/+/492576
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: shuang cui <imcusg@gmail.com>

13 months agoruntime: fix misaligned SP for libfuzzer entry
Keith Randall [Tue, 9 May 2023 22:55:45 +0000 (15:55 -0700)]
runtime: fix misaligned SP for libfuzzer entry

libfuzzer is written in C and so requires by the C abi that SP be
aligned correctly mod 16. Normally CALLs need to have SP aligned to 0
mod 16, but because we're simulating a CALL (which pushes a return
address) with a JMP (which doesn't), we need to align to 8 mod 16
before JMPing.

This is not causing any current problems that I know of. All the
functions called from this callsite that I checked don't rely on
correct alignment.  So this CL is just futureproofing.

Update #49075

Change-Id: I13fcbe9aaf2853056a6d44dc3aa64b7db689e144
Reviewed-on: https://go-review.googlesource.com/c/go/+/494117
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
13 months agosyscall,internal/poll: move pipe check from syscall.Seek to callers
qmuntal [Tue, 9 May 2023 14:16:42 +0000 (16:16 +0200)]
syscall,internal/poll: move pipe check from syscall.Seek to callers

On Windows, syscall.Seek is a thin wrapper over SetFilePointerEx [1],
which does not work on pipes, although it doesn't return an error on
that case. To avoid this undefined behavior, Seek defensively
calls GetFileType and errors if the type is FILE_TYPE_PIPE.

The problem with this approach is that Seek is a low level
foundational function that can be called many times for the same file,
and the additional cgo call (GetFileType) will artificially slow
down seek operations. I've seen GetFileType to account for 10% of cpu
time in seek-intensive workloads.

A better approach, implemented in this CL, would be to move the check
one level up, where many times the file type is already known so the
GetFileType is unnecessary.

The drawback is that syscall.Seek has had this behavior since pipes
where first introduced to Windows in
https://codereview.appspot.com/1715046 and someone could be relying on
it. On the other hand, this behavior is not documented, so we couldn't
be breaking any contract.

[1] https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-setfilepointerex

Change-Id: I7602182f9d08632e22a8a1635bc8ad9ad35a5056
Reviewed-on: https://go-review.googlesource.com/c/go/+/493626
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
13 months agointernal/bisect: adjust stack PCs relative to Callers[2]
David Chase [Tue, 9 May 2023 19:03:48 +0000 (15:03 -0400)]
internal/bisect: adjust stack PCs relative to Callers[2]

This is necessary to make hashes be consistent across runs,
otherwise ASLR messes up search.

Change-Id: Icf668dfe4c2008709f7767397b6700d0d5439287
Reviewed-on: https://go-review.googlesource.com/c/go/+/493857
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: David Chase <drchase@google.com>

13 months agocmd/go: fix cgo prefix mapping for non-vendored modules
qmuntal [Tue, 9 May 2023 11:02:26 +0000 (13:02 +0200)]
cmd/go: fix cgo prefix mapping for non-vendored modules

Regression introduced in CL 478455.

Change-Id: I8083a0accb047188dde1a3d408df2aafaf4a5356
Reviewed-on: https://go-review.googlesource.com/c/go/+/493835
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>