1
0
mirror of https://github.com/golang/go synced 2024-11-16 22:44:49 -07:00
Commit Graph

56522 Commits

Author SHA1 Message Date
Austin Clements
6d2309b576 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>
2023-05-12 13:32:40 +00:00
Austin Clements
c308e9b54c 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>
2023-05-12 12:35:09 +00:00
Austin Clements
b679e31cdb 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>
2023-05-12 12:35:07 +00:00
Austin Clements
3943fc14d3 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>
2023-05-12 12:35:05 +00:00
Austin Clements
b26c3927bd 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>
2023-05-12 12:35:03 +00:00
Austin Clements
689041160f 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>
2023-05-12 12:35:01 +00:00
Austin Clements
b6c75c5fb1 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>
2023-05-12 12:34:59 +00:00
Austin Clements
6693807668 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>
2023-05-12 12:00:09 +00:00
Austin Clements
0efbec91cd 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>
2023-05-12 12:00:07 +00:00
Austin Clements
2484e1331a 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>
2023-05-12 12:00:05 +00:00
Austin Clements
711609d55f 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>
2023-05-12 12:00:04 +00:00
Austin Clements
a3f69c778f 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>
2023-05-12 12:00:02 +00:00
Austin Clements
af64b75b67 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>
2023-05-12 12:00:00 +00:00
Austin Clements
a76b073712 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>
2023-05-12 11:59:58 +00:00
Austin Clements
bf6c55a8b3 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>
2023-05-12 11:59:56 +00:00
Ian Lance Taylor
a25688d406 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>
2023-05-12 01:46:05 +00:00
Mateusz Poliwczak
e2500be549 net: don't treat unknown sources as dns when there is a dns source
Change-Id: I3a6c3a804604b1e74a1ea6b66ab2c932a0ac973a
GitHub-Last-Rev: ea5403549a
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>
2023-05-11 23:49:19 +00:00
Mateusz Poliwczak
7db6d8a29d 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: cb0dac6448
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>
2023-05-11 23:47:00 +00:00
Guoqi Chen
42023d6f52 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>
2023-05-11 23:41:03 +00:00
Mateusz Poliwczak
1b630b5b00 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: 3aace0e661
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>
2023-05-11 23:39:53 +00:00
Chris O'Hara
41893389a6 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>
2023-05-11 23:29:04 +00:00
Michael Anthony Knyszek
7024712641 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>
2023-05-11 21:27:11 +00:00
Michael Anthony Knyszek
62bf7a4809 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>
2023-05-11 21:27:10 +00:00
Michael Anthony Knyszek
8992bb19ad 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>
2023-05-11 21:27:08 +00:00
Michael Pratt
7484dd30fd 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>
2023-05-11 20:54:05 +00:00
Michael Pratt
d740b365b7 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>
2023-05-11 20:54:03 +00:00
Cherry Mui
c2becd70c5 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>
2023-05-11 20:14:54 +00:00
Michael Anthony Knyszek
3e9876cd3a 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>
2023-05-11 19:07:33 +00:00
Michael Anthony Knyszek
a2737b1aab 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>
2023-05-11 19:07:04 +00:00
Michael Pratt
446ad131f6 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>
2023-05-11 18:32:33 +00:00
Constantin Konstantinidis
5a9b6432ec 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>
2023-05-11 18:19:17 +00:00
Michael Pratt
96add980ad 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>
2023-05-11 17:15:06 +00:00
Mateusz Poliwczak
472f623482 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: ade40fd3e3
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>
2023-05-11 16:17:04 +00:00
Mateusz Poliwczak
2e7d864f43 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: 29924c13a6
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>
2023-05-11 16:11:07 +00:00
Johan Brandhorst-Satzkorn
aff2f4a724 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>
2023-05-11 15:21:09 +00:00
Felix Geisendörfer
bc9e21351c 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>
2023-05-11 15:18:52 +00:00
Johan Brandhorst-Satzkorn
dc076eaf2e 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>
2023-05-11 14:42:30 +00:00
Than McIntosh
6b2ad9ef50 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>
2023-05-11 14:25:23 +00:00
David Chase
3ee12d5702 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>
2023-05-11 13:45:58 +00:00
David Chase
2e93fe0a9f 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>
2023-05-11 13:45:40 +00:00
David Chase
a2838ec5f2 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>
2023-05-11 04:50:30 +00:00
Russ Cox
48f8c5c037 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>
2023-05-11 01:52:24 +00:00
David Chase
1d92e0e3fa 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>
2023-05-11 01:43:28 +00:00
David Chase
6cf7602b71 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>
2023-05-11 01:43:04 +00:00
David Chase
b768a1fbb5 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>
2023-05-10 22:56:31 +00:00
David Chase
3d80d57c31 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>
2023-05-10 22:55:30 +00:00
David Chase
5deeca38c2 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>
2023-05-10 22:45:24 +00:00
David Chase
acba24ff8c 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>
2023-05-10 22:43:51 +00:00
David Chase
639957eb66 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>
2023-05-10 22:43:30 +00:00
David Chase
a851511947 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>
2023-05-10 21:44:37 +00:00