1
0
mirror of https://github.com/golang/go synced 2024-09-30 14:18:32 -06:00
Commit Graph

46512 Commits

Author SHA1 Message Date
cuiweixie
1985507257 cmd/compile/internal/ppc64: delete useless break
Change-Id: I32ab2f2dcc5e8357b8e832bc40f688a88550007f
Reviewed-on: https://go-review.googlesource.com/c/go/+/436650
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2022-09-29 23:48:20 +00:00
cuiweixie
1b5110268b internal: use io.SeekStart, io.SeekCurrent, and io.SeekEnd
Change-Id: I23ab738b73bc33d3b0b10013c3fadd95b5b24681
Reviewed-on: https://go-review.googlesource.com/c/go/+/436719
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-29 23:45:29 +00:00
cuiweixie
daf1612dc7 internal: use time.Since instead of time.Now().Sub
Change-Id: I536c7fad84a63e96658c6930a5a77fd70edca33c
Reviewed-on: https://go-review.googlesource.com/c/go/+/436718
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-29 23:45:27 +00:00
cuiweixie
b8ed88db8d compress: remove useless break statement
Change-Id: Ia2b376d134d4fd273924de2e4cdee9eba5a15c57
Reviewed-on: https://go-review.googlesource.com/c/go/+/436707
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-29 22:59:14 +00:00
cui fliter
1d65566148 cmd/fix: use strings.Cut
Change-Id: Ibee86b4c5dc9a18df9bdc65b0ec8339ee1cac7a9
GitHub-Last-Rev: 336580707c
GitHub-Pull-Request: golang/go#55911
Reviewed-on: https://go-review.googlesource.com/c/go/+/435739
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-29 22:58:43 +00:00
cui fliter
c69d6d8b3e cmd: fix a few function names on comments
Change-Id: Ia0896bd1edf2558821244fecd1c297b599472f47
GitHub-Last-Rev: cfd1e1091a
GitHub-Pull-Request: golang/go#55944
Reviewed-on: https://go-review.googlesource.com/c/go/+/436637
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-29 22:58:11 +00:00
cui fliter
84c188008e crypto: fix a few function names on comments
Change-Id: I06f85f78c4c802142fc9207b100753decd568274
GitHub-Last-Rev: 4ad4c0f5e9
GitHub-Pull-Request: golang/go#55945
Reviewed-on: https://go-review.googlesource.com/c/go/+/436639
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-09-29 22:56:49 +00:00
hopehook
972496ae6e all: use strings.Builder where appropriate
Change-Id: I164d350ca480640996055dedf38d962921c474a6
Reviewed-on: https://go-review.googlesource.com/c/go/+/435975
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: hopehook <hopehook@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-29 22:56:00 +00:00
hopehook
b78b84cd23 sync/atomic: rename "ifaceWords" to "efaceWords"
Rename "ifaceWords" to "efaceWords", since we are defining
an empty interface.

Change-Id: I7151fb730a081a800e6dd28bcba831787ee9d6a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/432815
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: hopehook <hopehook@golangcn.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-09-29 22:55:09 +00:00
Mikael Urankar
bf0a1ffbe2 syscall: add support for freebsd/riscv64
Updates #53466

Change-Id: I3c156400a105e711d6da0980854c08bf2f7e415a
Reviewed-on: https://go-review.googlesource.com/c/go/+/431655
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Mikaël Urankar <mikael.urankar@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Joel Sing <joel@sing.id.au>
Reviewed-by: Dmitri Goutnik <dgoutnik@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
2022-09-29 22:39:46 +00:00
Nobuki Fujii
a14ac8635f testing: update description of Setenv
Add the description of Setenv that it cannot use if the test have
parallel ancestors.

Fixes #55128

Change-Id: Ia5a1deaa1a3116d1ebb439600a7d316c7d155412
Reviewed-on: https://go-review.googlesource.com/c/go/+/434115
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-29 22:16:42 +00:00
cuiweixie
e7a3d87dda cmd/compile/internal/ir: delete unused code
Change-Id: I4f7581d1f4cd8a305acc02454e032c0788d39283
Reviewed-on: https://go-review.googlesource.com/c/go/+/436646
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-29 22:03:56 +00:00
cuiweixie
32a52e0399 cmd/go: using strings.CutPrefix replace strings.HasPrefix and strings.TrimPrefix
Change-Id: I143d05c24a3e897d0f3ee78dd16954c32ceae091
Reviewed-on: https://go-review.googlesource.com/c/go/+/435137
Run-TryBot: xie cui <523516579@qq.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
2022-09-29 21:28:10 +00:00
cuiweixie
2b45aebe14 net/http: using strings.CutPrefix replace strings.HasPrefix and strings.TrimPrefix
Change-Id: I0b7b6e4e9d2539e4fcb5c08430ba5a74733fad3c
Reviewed-on: https://go-review.googlesource.com/c/go/+/435136
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: xie cui <523516579@qq.com>
2022-09-29 21:28:08 +00:00
Keith Randall
59bc93535b cmd/compile: keep typecheck results in syntax tree
Saves on both space and cost of map operations. Saves about 3% in compile time.

name                      old time/op       new time/op       delta
Template                        251ms ± 2%        244ms ± 1%   -2.78%  (p=0.000 n=8+8)
Unicode                         149ms ± 5%        135ms ± 2%   -9.03%  (p=0.000 n=10+10)
GoTypes                         1.38s ± 1%        1.35s ± 1%   -2.29%  (p=0.000 n=10+10)
Compiler                        115ms ± 2%        112ms ± 2%   -2.50%  (p=0.001 n=10+9)
SSA                             11.9s ± 0%        11.4s ± 0%   -4.04%  (p=0.000 n=9+10)
Flate                           153ms ± 1%        148ms ± 1%   -3.32%  (p=0.000 n=10+9)
GoParser                        284ms ± 2%        280ms ± 1%   -1.70%  (p=0.002 n=10+10)
Tar                             209ms ± 2%        205ms ± 2%   -1.98%  (p=0.004 n=9+10)
XML                             287ms ± 2%        281ms ± 1%   -2.06%  (p=0.000 n=10+10)
LinkCompiler                    508ms ± 2%        501ms ± 2%   -1.31%  (p=0.024 n=9+9)
ExternalLinkCompiler            2.66s ± 3%        2.63s ± 4%     ~     (p=0.280 n=10+10)
LinkWithoutDebugCompiler        338ms ± 3%        330ms ± 3%   -2.21%  (p=0.009 n=10+10)
StdCmd                          21.5s ± 1%        20.8s ± 1%   -3.27%  (p=0.000 n=9+9)
[Geo mean]                      615ms             597ms        -2.91%

name                      old user-time/op  new user-time/op  delta
Template                        344ms ± 2%        324ms ± 3%   -6.01%  (p=0.000 n=9+9)
Unicode                         215ms ±11%        192ms ± 2%  -10.84%  (p=0.000 n=10+9)
GoTypes                         1.99s ± 2%        1.93s ± 2%   -2.73%  (p=0.000 n=10+10)
Compiler                        142ms ± 4%        140ms ± 3%   -1.89%  (p=0.031 n=9+9)
SSA                             17.4s ± 1%        17.0s ± 5%     ~     (p=0.113 n=9+10)
Flate                           200ms ± 4%        196ms ± 6%     ~     (p=0.190 n=10+10)
GoParser                        388ms ± 3%        378ms ± 4%   -2.59%  (p=0.004 n=9+10)
Tar                             278ms ± 8%        277ms ± 2%     ~     (p=0.315 n=10+10)
XML                             387ms ± 2%        381ms ± 2%   -1.63%  (p=0.005 n=8+8)
LinkCompiler                    784ms ± 4%        778ms ± 2%     ~     (p=0.436 n=10+10)
ExternalLinkCompiler            2.45s ± 1%        2.42s ± 1%   -1.11%  (p=0.001 n=10+9)
LinkWithoutDebugCompiler        374ms ± 3%        366ms ± 2%   -2.15%  (p=0.010 n=10+9)
[Geo mean]                      600ms             583ms        -2.91%

Change-Id: I9552a70d6a2ad500e9acd8815762b761be3c2ff9
Reviewed-on: https://go-review.googlesource.com/c/go/+/432897
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2022-09-29 20:55:01 +00:00
cuiweixie
e3ac2152f2 bufio: use strings.Builder
Change-Id: Ia8d6cea75b32c8839837c1bb1e13cde9b236abdd
Reviewed-on: https://go-review.googlesource.com/c/go/+/435939
Run-TryBot: xie cui <523516579@qq.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-29 20:47:53 +00:00
cuiweixie
45c2421dc6 archive/zip: use strings.TrimPrefix
Change-Id: I2854b5e7b48c4c189df84cb7281b7b7de780eebd
Reviewed-on: https://go-review.googlesource.com/c/go/+/435938
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-09-29 20:45:56 +00:00
cuiweixie
1371efcd69 net/http: remove deadstore statement
Change-Id: Icfa3fd519df48f8d7d7aa3795535fd7e6aaa159f
Reviewed-on: https://go-review.googlesource.com/c/go/+/435936
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-29 20:43:52 +00:00
cuiweixie
4973c16f3c net: delete unused code
Change-Id: Id4c3a140d9619796aee1ba3214f7d5fce040b4e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/435935
Auto-Submit: Ian Lance Taylor <iant@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>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-09-29 20:43:19 +00:00
cuiweixie
879f595f7e net/http: use time.Compare
Change-Id: I4730673130bdfbda9987dcb5869f421082f92150
Reviewed-on: https://go-review.googlesource.com/c/go/+/435615
Reviewed-by: Dmitri Shuralyov <dmitshur@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>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-29 20:42:38 +00:00
Paul E. Murphy
27d4cdd1a6 debug/elf: fix typo in R_PPC64_TPREL34 and R_PPC64_DTPREL34
The suffix should be 34 not 28. I misread the name because the
reloc listed before these two in the ABI is named "R_PC64_PCREL28".

Updates #54345

Change-Id: Ie8238f55e441c787d70ead58e0a177c650f8b89e
Reviewed-on: https://go-review.googlesource.com/c/go/+/435415
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-29 19:54:44 +00:00
Robert Griesemer
545adcfe89 go/types, types2: use "generic" rather than "parameterized" in error messages
Fix a couple of places where we still use "parameterized".

Change-Id: I2c70356d4e363ee709c5ef19ec8786956d5e9001
Reviewed-on: https://go-review.googlesource.com/c/go/+/436815
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-09-29 19:35:55 +00:00
Bryan C. Mills
dd42a84fb3 cmd: add skips as needed to get tests to pass on js/wasm
For #54219.

Change-Id: I9767f46a5b44beeee62a3d53c4de4f6acb6b6e73
Reviewed-on: https://go-review.googlesource.com/c/go/+/436816
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
2022-09-29 19:23:50 +00:00
Bryan C. Mills
ce3a5c0d10 os/exec: avoid leaking a process in TestDoubleStartLeavesPipesOpen
Updates #52580.
For #50436.

Change-Id: I0929055ffca1ca429f6ebec7d877f4268bd1fda2
Reviewed-on: https://go-review.googlesource.com/c/go/+/436656
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2022-09-29 18:49:15 +00:00
Damien Neil
4a0a2b33df errors, fmt: add support for wrapping multiple errors
An error which implements an "Unwrap() []error" method wraps all the
non-nil errors in the returned []error.

We replace the concept of the "error chain" inspected by errors.Is
and errors.As with the "error tree". Is and As perform a pre-order,
depth-first traversal of an error's tree. As returns the first
matching result, if any.

The new errors.Join function returns an error wrapping a list of errors.

The fmt.Errorf function now supports multiple instances of the %w verb.

For #53435.

Change-Id: Ib7402e70b68e28af8f201d2b66bd8e87ccfb5283
Reviewed-on: https://go-review.googlesource.com/c/go/+/432898
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
2022-09-29 18:40:40 +00:00
Tobias Klauser
36f046d934 cmd/go/internal/lockedfile/internal/filelock: remove unused type token
Change-Id: If815d17851e4e4eac026417b820f15d11939d9cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/436595
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-29 18:20:11 +00:00
Russ Cox
2ff5fbfbd4 cmd/compile: limit goroutine count to parallelism
When the compiler crashes, it is not uncommon to see many hundreds
of goroutines all blocked waiting their turn to be one of the nWorkers
goroutines that is allowed to run. All these goroutine stacks are not a
terribly efficient use of memory, and they also make the crash dumps
hard to read.

Introduce a manager goroutine to hand out work to at most nWorker
goroutines, maintaining pending work in a local slice, rather than
having all those blocked goroutines hanging around waiting to run.

Change-Id: I46cb4e1afd6392805f359e14554ebc17d538bcba
Reviewed-on: https://go-review.googlesource.com/c/go/+/431956
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-29 16:23:56 +00:00
Than McIntosh
9861e8b2fd cmd/{cover,go}: avoid use of os.PathListSeparator in cmd/cover flag
Rework the mechanism for passing a list of output files from cmd/go to
cmd/cover when running new-style package-scope coverage
instrumentation (-pkgcfg mode). The old scheme passed a single string
with all output files joined together with os.PathListSeparator, but
this scheme is not viable on plan9, where strings containing the
separator character are not permitted when running exec.Command().
Instead, switch cmd/cover to use an arguments file (a file containing
a list of names) to specify names of instrumented output files. This
fixes the cmd/cover test failures on the plan9 builders.

Updates #51430.

Change-Id: I919f5e0a79500e28648fb9177225a9b938e4fdee
Reviewed-on: https://go-review.googlesource.com/c/go/+/436675
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
2022-09-29 14:51:21 +00:00
Robert Griesemer
e22af33b48 go/types, types2: more concise error messages for cycle errors
If a cycle has length 1, don't enumerate the single cycle entry;
instead just mention "refers to itself". For instance, for an
invalid recursive type T we now report:

	invalid recursive type: T refers to itself

instead of:

	invalid recursive type T
		T refers to
		T

Adjust tests to check for the different error messages.

Change-Id: I5bd46f62fac0cf167f0d0c9a55f952981d294ff4
Reviewed-on: https://go-review.googlesource.com/c/go/+/436295
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
2022-09-29 14:21:33 +00:00
Than McIntosh
ecd112c0d1 runtime/coverage: apis to emit counter data under user control
Add hooks/apis to support writing of coverage counter data and
meta-data under user control (from within an executing "-cover"
binary), so as to provide a way to obtain coverage data from programs
that do not terminate. This patch also adds a hook for clearing the
coverage counter data for a running program, something that can be
helpful when the intent is to capture coverage info from a specific
window of program execution.

Updates #51430.

Change-Id: I34ee6cee52e5597fa3698b8b04f1b34a2a2a418f
Reviewed-on: https://go-review.googlesource.com/c/go/+/401236
Reviewed-by: David Chase <drchase@google.com>
2022-09-29 14:14:24 +00:00
Than McIntosh
f2ee341468 cmd{cover,covdata,go}: better coverage for tests that build tools
Some of the unit tests in Go's "cmd" tree wind up building a separate
copy of the tool being tested, then exercise the freshly built tool as
a way of doing regression tests. The intent is to make sure that "go
test" is testing the current state of the source code, as opposed to
whatever happened to be current when "go install <tool>" was last run.

Doing things this way is unfriendly for coverage testing. If I run "go
test -cover cmd/mumble", and the cmd/mumble test harness builds a
fresh copy of mumble.exe, any runs of that new executable won't
generate coverage data.

This patch updates the test harnesses to use the unit test executable
as a stand-in for the tool itself, so that if "go test -cover" is in
effect, we get the effect of building the tool executable for coverage
as well. Doing this brings up the overall test coverage number for
cmd/cover quite dramatically:

before change:

  $ go test -cover .
  ok  	cmd/cover	1.100s	coverage: 1.5% of statements

after change:

  $ go test -cover .
  ok  	cmd/cover	1.299s	coverage: 84.2% of statements

Getting this to work requires a small change in the Go command as
well, to set GOCOVERDIR prior to executing a test binary.

Updates #51430.

Change-Id: Ifcf0ea85773b80fcda794aae3702403ec8e0b733
Reviewed-on: https://go-review.googlesource.com/c/go/+/404299
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-29 14:13:50 +00:00
Than McIntosh
9d6dc32edd runtime/coverage: improve unit tests
Add a testpoint to cover support routines used to help
implement "go test -cover".

Change-Id: Ic28bf884a4e0d2c0a6d8fd04fc29c0c949227f21
Reviewed-on: https://go-review.googlesource.com/c/go/+/432315
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-29 14:13:26 +00:00
cuiweixie
690851ee3e crypto: use fmt.Appendf
Change-Id: I022a221e2d73cd8c70e8e04b7046c388748646a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/435696
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-29 09:14:45 +00:00
cuiweixie
8d3631fcef cmd/nm: use print-style not printf-style
Change-Id: Ic977026a99a825954117902051e59928de9ccbdb
Reviewed-on: https://go-review.googlesource.com/c/go/+/435947
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-09-29 09:05:07 +00:00
cuiweixie
a57639a2b2 cmd/cgo: use strings.TrimSuffix
Change-Id: I97b5592c678c350fd77069d7c40a98864733707a
Reviewed-on: https://go-review.googlesource.com/c/go/+/435946
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-29 09:05:05 +00:00
cuiweixie
ea2a2c0c22 cmd/cgo: delete unused code
Change-Id: I6007cc6363e22ffa5f9a8f0441a642fd85127397
Reviewed-on: https://go-review.googlesource.com/c/go/+/435945
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@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>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
2022-09-29 09:05:04 +00:00
cuiweixie
50cc2238fb cmd/cgo: use strings.Contains instead of strings.Index
Change-Id: Iaa623dae50ccae36ad44af25899c6453b6108046
Reviewed-on: https://go-review.googlesource.com/c/go/+/435944
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
2022-09-29 09:05:02 +00:00
cuiweixie
09daf313b2 cmd/asm: use strings.TrimSuffix
Change-Id: If08ce3f8534f5fb7ce97ec124bfeff937e65f63b
Reviewed-on: https://go-review.googlesource.com/c/go/+/435943
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-09-29 09:05:01 +00:00
cuiweixie
090ec611df cmd/asm: delete unused func newAddr
Change-Id: I62f38aa07e9c6e2f0947d23adc7a1b453277c790
Reviewed-on: https://go-review.googlesource.com/c/go/+/435942
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-09-29 09:04:59 +00:00
cuiweixie
58093e8e2b cmd/asm: optimize if statement to return directly
Change-Id: Ieb8fb7c623ecd8b9ddd15cdb6eb2c6326a9bbd3b
Reviewed-on: https://go-review.googlesource.com/c/go/+/435941
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-09-29 09:04:58 +00:00
cuiweixie
c4a3fae27e cmd/asm: use opd.String() instead of fmt.Sprintf
Change-Id: Idbade74025bddb26ec3c10527de5af5dc2b8c1cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/435940
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-29 09:04:56 +00:00
Bryan C. Mills
223a563f58 os/exec: refactor goroutine error reporting
Use a separate channel to report the final error of the copying
goroutines, receiving a value only when all of the copying goroutines
have completed. In a followup change (CL 401835), that will allow
waiters to select on goroutine completion alongside other events (such
as Context cancellation).

Also mildly refactor the watchCtx helper method so that its structure
better matches what will be needed to implement WaitDelay.

For #50436.

Change-Id: I54b3997fb6931d204814d8382f0a388a67b520f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/435995
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
2022-09-29 02:34:30 +00:00
Bryan C. Mills
4d6ca68a85 os/exec: do not close pipes on a double-Start error
This fixes a bug introduced in CL 401834 in which calling Start twice
with pipes attached to a command would spuriously close those pipes
when returning the error from the second Start call.

For #50436.

Change-Id: I3563cc99c0a0987752190fef95da3e9927a76fda
Reviewed-on: https://go-review.googlesource.com/c/go/+/436095
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
2022-09-29 02:28:26 +00:00
Roland Shoemaker
13d48bb6a1 encoding/gob: add top level security doc
Add a slightly expanded version of the Decoder type comment to the top
level package doc, which explains that this package is not designed
to be hardened against adversarial inputs.

Change-Id: I8b83433838c8235eb06ded99041fdf726c811ee5
Reviewed-on: https://go-review.googlesource.com/c/go/+/436096
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2022-09-29 00:30:21 +00:00
Robert Griesemer
ffdfa9ff41 go/types, types2: consistently use "cause" instead of "reason" for error details (cleanup)
There were many more uses of the variable name "cause" than "reason"
to hold error message details. Consistently use "cause" throughout.

Accordingly, s/MissingMethodReason/MissingMethodCause/.

Change-Id: I171d784faabc66a4c58ba8944784204687595203
Reviewed-on: https://go-review.googlesource.com/c/go/+/435418
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>
Reviewed-by: Robert Griesemer <gri@google.com>
2022-09-28 23:46:58 +00:00
Robert Griesemer
5612215d32 go/types, types2: remove (C/c)ompilerErrorMessages flag - not needed anymore
Fixes #55326.

Change-Id: Ic300976ddf504224faadc5bae21736fe94dac6bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/435416
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
2022-09-28 23:46:46 +00:00
Robert Griesemer
8c29881dd1 cmd/compile: use "shifted operand %s (type %s) must be integer" for some shift errors
This matches what go/types and types2 report and it also matches
the compiler errors reported for some related shift problems.

For #55326.

Change-Id: Iee40e8d988d5a7f9ff2c49f019884d02485c9fdf
Reviewed-on: https://go-review.googlesource.com/c/go/+/436177
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-28 22:28:41 +00:00
Robert Griesemer
7997e5f254 cmd/compile: use "cannot use %s as %s value in %s: %s" error message
This is close to what the compiler used to say, except now we say
"as T value" rather than "as type T" which is closer to the truth
(we cannot use a value as a type, after all). Also, place the primary
error and the explanation (cause) on a single line.

Make respective (single line) adjustment to the matching "cannot
convert" error.

Adjust various tests.

For #55326.

Change-Id: Ib646cf906b11f4129b7ed0c38cf16471f9266b88
Reviewed-on: https://go-review.googlesource.com/c/go/+/436176
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-28 22:28:39 +00:00
Robert Griesemer
435652b468 go/types, types2: use "assignment mismatch: x variables but y values" error message
This matches current compiler behavior.

For #55326.

Change-Id: I7197cf4ce21e614291a1a2e1048dd78d0a232b64
Reviewed-on: https://go-review.googlesource.com/c/go/+/436175
Reviewed-by: 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>
Run-TryBot: Robert Griesemer <gri@google.com>
2022-09-28 20:43:36 +00:00
Alan Donovan
f1d281fe4d go/ast: record start and end of file in File.File{Start,End}
This change causes the parser to record the positions of the first
and last character in the file in new ast.File fields FileStart
and FileEnd.

The behavior of the existing Pos() and End() methods,
which record the span of declarations, must remain unchanged
for compatibility.

Fixes golang/go#53202

Change-Id: I250b19e69f41e3590292c3fe6dea1943ec98f629
Reviewed-on: https://go-review.googlesource.com/c/go/+/427955
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-09-28 20:37:59 +00:00
Tobias Klauser
dbf174d4b9 cmd/dist: test cmd module on js/wasm
Most tests will be skipped anyway because 'go build' is not available,
but this ensures cmd will be build tested by TryBots for js/wasm.

For #25911
For #35220
For #54219

Change-Id: I09c75905c36311810eb1ae75eeee2fa6102c1c0d
Reviewed-on: https://go-review.googlesource.com/c/go/+/435237
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-28 18:39:27 +00:00
cui fliter
ae3abf16e4 cmd/compile/internal/base: replace io/ioutil with os package
Change-Id: Ide7618b65fcff7947809051d51b993d330e35717
GitHub-Last-Rev: 298853a820
GitHub-Pull-Request: golang/go#55914
Reviewed-on: https://go-review.googlesource.com/c/go/+/435537
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-09-28 18:13:41 +00:00
Nobuki Fujii
d6ca24477a testing: fail if T.Setenv is called via T.Run in a parallel test
The existing implementation can call to T.Setenv in T.Run even after
calling to T.Parallel, so I changed it to cause a panic in that case.

Fixes #55128

Change-Id: Ib89d998ff56f00f96a5ca218af071bd35fdae53a
Reviewed-on: https://go-review.googlesource.com/c/go/+/431101
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
2022-09-28 17:18:17 +00:00
cuiweixie
7f7f27f992 cmd/go: using strings.CutSuffix replace strings.HasSuffix and strings.TrimSuffix
Change-Id: I79854419091d6c5c5c2922a1f45a3c5589673f11
Reviewed-on: https://go-review.googlesource.com/c/go/+/435138
Run-TryBot: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
2022-09-28 16:47:59 +00:00
Joel Sing
bc73996fac cmd/link/internal/loadelf: add additional relocations for riscv64
These relocations are produced by clang/llvm.

Change-Id: I4820e7ed805d1b7341023b263c167a285ca32cf5
Reviewed-on: https://go-review.googlesource.com/c/go/+/431755
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-28 16:43:13 +00:00
Zeke Lu
d7e663d909 os/signal: disable GNU readline to deflake TestTerminalSignal
Fixes #55903.

Change-Id: I992865277fb6526929d6c7db2b3b8d22ca0760f2
GitHub-Last-Rev: fc6f28e17c
GitHub-Pull-Request: golang/go#55904
Reviewed-on: https://go-review.googlesource.com/c/go/+/435735
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
2022-09-28 16:30:21 +00:00
Archana R
4350c4a131 cmd/internal/obj/ppc64: remove unnecessary opcodes
This CL removes some opcode placeholders that do not correspond
to any existing instructions and hence create confusion. Some
instructions that are no longer valid like LDMX are also removed.
Any references to this instruction in ISA 3.0 are considered
as documentation errata.

Change-Id: Ib71a657099723bbe1db88873233ee573b5c42fe7
Reviewed-on: https://go-review.googlesource.com/c/go/+/429860
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Paul Murphy <murp@ibm.com>
Run-TryBot: Archana Ravindar <aravind5@in.ibm.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Archana Ravindar <aravind5@in.ibm.com>
2022-09-28 15:27:05 +00:00
cui fliter
190973eb60 all: fix some typos
Change-Id: I8b28aebbb9494b2c877139a4584a5a42253e3bea
GitHub-Last-Rev: e3703fd3a5
GitHub-Pull-Request: golang/go#55902
Reviewed-on: https://go-review.googlesource.com/c/go/+/435617
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-09-28 15:13:20 +00:00
Lynn Boger
6e1b769377 cmd/compile: remove some lines from PPC64.rules
In CL 429035 Keith suggested removing some
rules that were covered by generic rules. This
follows up on that comment.

Change-Id: I57b6c9ae0cd85f33a0eb2fef8356575d3d7820fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/430417
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2022-09-28 14:15:04 +00:00
Than McIntosh
53773a5d08 cmd/go: support new hybrid coverage instrumentation
If GOEXPERIMENT=coverageredesign is in effect, introduce a new
top-level '-cover' option to "go build" to turn on new-style hybrid
code coverage instrumentation. Similarly, use the new instrumentation
for "go test -cover".

The main effects of "-cover" under the hood are to instrument files at
the package level using cmd/cover and to pass additional options to
the compiler when building instrumented packages.

The previous workflow for "go tool -cover mypkg" would expand to a
series of "go tool cover" commands (one per file) followed by a single
package compilation command to build the rewritten sources.

With the new workflow, the Go command will pass all of the Go files in
a package to the cover tool as a chunk (along with a config file
containing other parameters), then the cover tool will write
instrumented versions of the sources along with another "output"
config with info on coverage variable names for the the compiler. The
Go command will then kick off the compiler on the modified source
files, also passing in the config file generated by cmd/cover.

Updates #51430.

Change-Id: Id65621ff6a8c70a30168c1412c2d6f805ff3b9e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/355452
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-28 11:50:58 +00:00
Than McIntosh
b32689f6c3 cmd/go: refactor package references in Builder.build
Refactor references to "a.Package" in Builder.build to be consistent,
e.g. all via the "p" helper variable. No change in functionality, this
is just intended to make the code more readable/consistent (since
prior to this point we had a random mix of "p" and "a.Package").

Change-Id: Ifea5ff9b314c39a0cf6e688511907d08cc56c603
Reviewed-on: https://go-review.googlesource.com/c/go/+/424819
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
2022-09-28 11:49:14 +00:00
Than McIntosh
06e8022ed4 cmd/go: add hook to check for GOEXPERIMENT in script tests
Add a new hook to allow script tests to check whether a specific
GOEXPERIMENT is enabled.

Updates #51430.

Change-Id: Icdf39f845ff2c8b10c634d49e9c27bc90e7984f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/402174
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-28 11:49:00 +00:00
Than McIntosh
5f18e46328 cmd/cover: add hybrid instrumentation mode
Add a new mode of coverage instrumentation that works as a hybrid
between purely tool-based and purely compiler-based. The cmd/cover
tool still does source-to-source rewriting, but it also generates
information to be used by the compiler to do things like marking
meta-data vars as read-only.

In hybrid mode, the cmd/cover tool is invoked not on a single source
file but on all the files in a package, and is passed a config file
containing the import path of the package in question, along with
other parameters needed for the run. It writes a series of modified
files and an output config file to be passed to the compiler when
compiling the modified files.

Not completely useful by itself, still needs a corresponding set of
changes in the Go command and in the compiler.

Updates #51430.

Change-Id: I0fcbd93a9a8fc25064187b159152486a2549ea54
Reviewed-on: https://go-review.googlesource.com/c/go/+/395896
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-28 11:48:40 +00:00
Than McIntosh
87db4ffada runtime/coverage: runtime routines to emit coverage data
This patch fleshes out the runtime support for emitting coverage data
at the end of a run of an instrumented binary. Data is emitted in the
form of a pair of files, a meta-out-file and counter-data-outfile,
each written to the dir GOCOVERDIR. The meta-out-file is emitted only
if required; no need to emit again if an existing meta-data file with
the same hash and length is present.

Updates #51430.

Change-Id: I59d20a4b8c05910c933ee29527972f8e401b1685
Reviewed-on: https://go-review.googlesource.com/c/go/+/355451
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
2022-09-28 11:48:10 +00:00
Than McIntosh
7a74829858 cmd/covdata: add tools to read/manipulate coverage data files
Add a set of helper packages for reading collections of related
meta-data and counter-data files ("pods") produced by runs of
coverage-instrumented binaries, and a new tool program (cmd/covdata)
for dumping and/or manipulating coverage data files.

Currently "go tool covdata" subcommands include 'merge', 'intersect',
'percent', 'pkglist', 'subtract', 'debugdump', and 'textfmt'
(conversion to the legacy "go tool cover" format).

Updates #51430.

Change-Id: I44167c578f574b4636ab8726e726388531fd3258
Reviewed-on: https://go-review.googlesource.com/c/go/+/357609
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2022-09-28 11:47:16 +00:00
Robert Griesemer
dbe56ff6c7 go/types, types2: use "invalid operation: x rel y (cause)" for comparison error messages
Matches compiler behavior and is consistent with what we do with other
binary operations.

While at it, also use parentheses rather than a colon for a couple of
errors caused by not having a core type.

For #55326.

Change-Id: I0a5cec1a31ffda98d363e5528791965a1ccb5842
Reviewed-on: https://go-review.googlesource.com/c/go/+/435618
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
2022-09-28 10:36:02 +00:00
Ian Lance Taylor
2c4c2a5106 time: add comment explaining >>33 in Now
Change-Id: I022b617cd345b412bee0b50a862676a1dca94e01
Reviewed-on: https://go-review.googlesource.com/c/go/+/418376
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-09-28 09:05:54 +00:00
Mikael Urankar
d268504fd9 cmd/nm, runtime/cgo: add cgo support for freebsd/riscv64
Updates #53466

Change-Id: I08ea279c905e265a579b6b3e23aee012165beaee
Reviewed-on: https://go-review.googlesource.com/c/go/+/431658
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Goutnik <dgoutnik@gmail.com>
2022-09-28 05:38:32 +00:00
Mikael Urankar
a48fc816e7 cmd/dist: enable cgo tests on freebsd/riscv64
Updates #53466

Change-Id: I17a41adb93c22fa84a7bdcec9d8c65001c5a8ba9
Reviewed-on: https://go-review.googlesource.com/c/go/+/431657
Reviewed-by: Dmitri Goutnik <dgoutnik@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-28 04:13:48 +00:00
cuiweixie
56fb2cff9f crypto: use bytes.Clone
Change-Id: I92e110023739c6f8f7815c7e47ad7639c4e8812d
Reviewed-on: https://go-review.googlesource.com/c/go/+/435279
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: xie cui <523516579@qq.com>
2022-09-28 03:55:33 +00:00
cuiweixie
acc5e3a0c2 net/textproto: use bytes.Clone
Change-Id: Ic73d667a98df3f2d1705a67e7e8625c6ba65cc0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/435284
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
2022-09-28 03:55:14 +00:00
cuiweixie
a59e614aa1 internal: use bytes.Clone
Change-Id: Ia96ddd520a7bd2fd53bff55315c6fac04ae96a2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/435282
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
2022-09-28 03:44:27 +00:00
cuiweixie
09919ac339 encoding/xml: use bytes.Clone
Change-Id: I3218b1e3f8869f579facddb29471df13c835dc66
Reviewed-on: https://go-review.googlesource.com/c/go/+/435281
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2022-09-28 03:44:25 +00:00
Mikael Urankar
9aa7107cb5 runtime: add support for freebsd/riscv64
Updates #53466

Change-Id: I42ca5f1d0f20b5ecfcfba70d298566b6c851fefc
Reviewed-on: https://go-review.googlesource.com/c/go/+/431656
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Goutnik <dgoutnik@gmail.com>
2022-09-28 03:17:13 +00:00
cuiweixie
12bf9ff8dc database: use bytes.Clone
Change-Id: I66aad199884cffd51946f53f01580a3a353f5c97
Reviewed-on: https://go-review.googlesource.com/c/go/+/435280
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
2022-09-28 03:16:54 +00:00
Roland Shoemaker
61ed6d5c33 crypto/rsa,crypto/internal/boring: fix PSS salt handling
Fix the coversion between our sentinel salt length variables and the
BoringSSL versions in SignRSAPSS. We previously set -1 (hash length
equals salt length) when 0 was passed when we should've been setting
-2. This now matches the conversion that happens in VerifyRSAPSS. Also
adds a note documenting why we do this.

Additionally in non-Boring mode, properly handle passing of salt lengths
with a negative value which aren't one of the magic constants, returning
an error instead of panicking.

See https://commondatastorage.googleapis.com/chromium-boringssl-docs/rsa.h.html#RSA_sign_pss_mgf1
for the BoringSSL docs.

Fixes #54803

Change-Id: Id1bd14dcf0ef4733867367257830ed43e25ef882
Reviewed-on: https://go-review.googlesource.com/c/go/+/426659
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Roland Shoemaker <roland@golang.org>
2022-09-27 23:19:20 +00:00
Robert Griesemer
b2137e7dad go/types, types2: use 2nd operand position for comparison type mismatch errors
When a comparison is invalid due to mismatched types, we only know
when we see the 2nd operand; so use that operand's position for the
error message. This matches compiler behavior.

For #55326.

Change-Id: I79450756bbdd2b4bb90ed4e960a451be0197b186
Reviewed-on: https://go-review.googlesource.com/c/go/+/435555
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-27 23:19:02 +00:00
Zeke Lu
fa13731a45 debug/elf: return error on reading from SHT_NOBITS sections
An SHT_NOBITS section contains no bytes and occupies no space in the
file. This change makes it return an error on reading from this section
so that it will force the caller to check for an SHT_NNOBITS section.

We have considered another option to return "nil, nil" for the Data
method. It's abandoned because it might lead a program to simply do
the wrong thing, thinking that the section is empty.

Please note that it breaks programs which expect a byte slice with the
length described by the sh_size field. There are two reasons to
introduce this breaking change: 1. SHT_NOBITS means no data and it's
unnecessary to allocate memory for it; 2. it could result in an OOM if
the file is corrupted and has a huge sh_size.

Fixes #54967.

Change-Id: I0c3ed4e097214fe88413d726a89122105ad45d4f
GitHub-Last-Rev: 994c12d9da
GitHub-Pull-Request: golang/go#54994
Reviewed-on: https://go-review.googlesource.com/c/go/+/429601
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-09-27 22:16:32 +00:00
Ian Lance Taylor
a451713286 crypto/x509: use unsafe.Slice
Change-Id: I40fdfbd5cfb9f5ccb80d55bca28ff9ba1ec490f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/435285
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-27 22:00:10 +00:00
Robert Griesemer
7398c3c0c6 cmd/compile: use "method T.m already declared" for method redeclaration errors
Compromise between old compiler error "T.m redeclared in this block"
(where the "in this block" is not particularly helpful) and the old
type-checker error "method m already declared for type T ...".
In the case where we have position information for the original
declaration, the error message is "method T.m already declared at
<position>". The new message is both shorter and more precise.

For #55326.

Change-Id: Id4a7f326fe631b11db9e8030eccb417c72d6c7db
Reviewed-on: https://go-review.googlesource.com/c/go/+/435016
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-09-27 21:59:19 +00:00
Robert Griesemer
b16501c08b go/types, types2: use "unknown field f in struct literal of type S" in error messages
This is a compromise of the error reported by the compiler (quotes
around field name removed) and the error reported by the type checkers
(added mention of struct type).

For #55326.

Change-Id: Iac4fb5c717f17c6713e90d327d39e68d3be40074
Reviewed-on: https://go-review.googlesource.com/c/go/+/434815
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2022-09-27 21:59:09 +00:00
Robert Griesemer
3b5188ed2c go/types, types2: use "multiple-value" instead "n-valued" in error messages
This matches current compiler behavior.

For #55326.

Change-Id: I9ebe2914323072b5454fb9af2d15c9dd2d711bad
Reviewed-on: https://go-review.googlesource.com/c/go/+/434735
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2022-09-27 21:14:06 +00:00
Robert Griesemer
605148c0fb go/types, types2: uniformly use "cannot convert X to type T"
This matches current compiler behavior.

For #55326.

Change-Id: I660bd15f13a8d9eb00fafa937f8261e664b0e065
Reviewed-on: https://go-review.googlesource.com/c/go/+/433276
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
2022-09-27 21:14:03 +00:00
Robert Griesemer
4360fd8d6f go/types, types2: use "and not used" instead of "but not used" in error messages
This matches longstanding compiler behavior.

Also, for unused packages, report:

`"pkg" imported and not used`
`"pkg" imported as X and not used`

This matches the other `X declared and not used` errors.

For #55326.

Change-Id: Ie71cf662fb5f4648449c64fc51bede298a1bdcbf
Reviewed-on: https://go-review.googlesource.com/c/go/+/432557
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
2022-09-27 21:10:19 +00:00
Paul E. Murphy
871a3a409a cmd/compile: rework PPC64 Mul64uhilo lowering rules
Remove OpPPC64LoweredMuluhilo as this operation can be done
more efficiently with MULHDU and MULLD directly. This has the
benefit of not needing to use tuple select operations, and giving
the scheduler more freedom to place these operations.

The primary reason to avoid using tuples here is to to avoid
suboptimal scheduling when carry ops (e.x ADDC/ADDE) are used in
the same block as 64->128b multiples. CL 432275 modifies the
scheduling priorities which may cause non-flag/non-carry generating
tuple ops to interfere with carry opcodes. Thus resulting in excess
saving and restoring of the XER register.

This allows CL 432275 to adjust the scheduling priorities without
having to workaround odd tuple scheduling behavior.

Change-Id: Id04ef009ec4b86416e5436f2b44ae1474e73720e
Reviewed-on: https://go-review.googlesource.com/c/go/+/434855
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-09-27 21:00:51 +00:00
David Chase
caa8e1f977 cmd/compile: make a type-specialized copy of encoding/binary.ReadUvarint
This is to get better escape analysis for a frequently-allocated object.

Change-Id: I1942a4e1c3cd1f0fa870bc8433a0165c18ce9c75
Reviewed-on: https://go-review.googlesource.com/c/go/+/435336
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-09-27 20:58:46 +00:00
David Chase
e8afb29111 cmd/compile: introduce "temporary" readers for more storage reuse
Change-Id: Id05d6099624284a9c1583b066d1a703e806b1e22
Reviewed-on: https://go-review.googlesource.com/c/go/+/433037
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2022-09-27 20:36:31 +00:00
Keith Randall
6485e8f503 cmd/compile: use stricter rule for possible partial overlap
Partial overlaps can only happen for strict sub-pieces of larger arrays.
That's a much stronger condition than the current optimization rules.

Update #54467

Change-Id: I11e539b71099e50175f37ee78fddf69283f83ee5
Reviewed-on: https://go-review.googlesource.com/c/go/+/433056
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-09-27 20:09:33 +00:00
Alan Donovan
92a94a7024 go/scanner: emit implicit semicolon tokens in correct order
Prior to this change, the scanner, in ScanComments mode, would emit
the implicit SEMICOLON token generated by a newline ahead of any
immediately preceding comment "tokens". For example:

 foo /*a*/ /*b*/ /*c*/ \n   =>  [IDENT SEMICOLON COMMENT COMMENT COMMENT]

Now, tokens and comments are emitted by the scanner in lexical order
of their start position. SEMICOLON tokens corresponding to newlines
always have the position of the newline (even in the special case
in which the newline is in the middle of a general comment /*\n*/).

The scanner no longer needs to look ahead, possibly across multiple
comments, for a newline, when it encounters a comment.
The scanner semicolon tests have been rewritten to be less magical.

The parser must now expect line comments before an implicit semicolon.
Line comments for an explicit semicolon still appear after.
The new assertions in the parser TestLeadAndLineComments are
not changes to behavior.

Fixes golang/go#54941

Change-Id: Iffe97fd10e9e0b52882da8659307698ccb31c093
Reviewed-on: https://go-review.googlesource.com/c/go/+/429635
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Alan Donovan <adonovan@google.com>
2022-09-27 19:47:49 +00:00
cuiweixie
86ca550f40 bufio: use bytes.Clone
Change-Id: Ic21d979da8be1a6047b9bcd65b5ee71ca2ef7548
Reviewed-on: https://go-review.googlesource.com/c/go/+/435278
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-27 19:42:34 +00:00
Than McIntosh
bf5805eae4 cmd/link: fix coverage counter issue on AIX
Update the linker's XCOFF writer to handle coverage counter sections
properly; they need to be treated as bss, not data. Fixes a problem
with the aix-ppc64 builder introduced in CL 401235), e.g.
"runtime.covctrs: A symbol with type XTY_SD must be in a .text or
.data section".

Updates #51430.

Change-Id: I3fc385a37e2549c46cc7cc3b4718af989a36752a
Reviewed-on: https://go-review.googlesource.com/c/go/+/435335
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: David Chase <drchase@google.com>
2022-09-27 18:33:46 +00:00
Tobias Klauser
f15b81a80f cmd/internal/pkgpath: use MustHaveExec in TestToSymbolFunc
ToSymbolFunc executes a command using exec.Command.

Change-Id: Ic6c274bdc23050d021ec98ba67748338ac34f12c
Reviewed-on: https://go-review.googlesource.com/c/go/+/435236
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
2022-09-27 18:26:59 +00:00
Tobias Klauser
17078f5860 cmd/api: skip tests on platforms that cannot exec
These tests execute commands using exec.Command.

Change-Id: I2708d6d24762fe2b2a902b1b221cc67392bf5c41
Reviewed-on: https://go-review.googlesource.com/c/go/+/435235
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
2022-09-27 18:26:56 +00:00
Paul E. Murphy
edd1273b84 cmd/link: refactor usage of SymLocalentry helper functions
PPC64 ELFv2 uses the st_other field of a symbol to specify an offset
from the global entry point to its local entry point. Similarly, some
values (i.e 1) may also require additional linker support which is
missing today.

For now, generate an error if we encounter unsupported local entry
values on PPC64, and update the Localentry values to use bytes, not
32b instruction words.

Similarly, ELFv2 1.5 also updates the wording of values 2-6. They
now map to a specific number of bytes.

Change-Id: Id1b71c3b0fea982bdcfb7eac91d9f93e04ae43f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/431876
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-09-27 17:29:05 +00:00
cuiweixie
6c3567873c runtime: using bytes.CutPrefix
Change-Id: I3f2dae17496b5b4efbdc022802f941a616abd87a
Reviewed-on: https://go-review.googlesource.com/c/go/+/435276
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: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-27 17:14:59 +00:00
Keith Randall
b52783c1e9 cmd/compile: abstract type type+value obtained from types2
In preparation for encoding it in a more efficient way.

Change-Id: I299dd2befc3d07107a1b7b49225bbb9f2e48a343
Reviewed-on: https://go-review.googlesource.com/c/go/+/432896
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-09-27 17:08:05 +00:00
Carlo Alberto Ferraris
dcb90152a4 bytes,strings: optimize Repeat
When generating long strings or slices with Repeat we
currently reuse intermediate states as a way to quickly
build exponentially longer results.

This works well as long as the intermediate states fit into
the processor D-cache. If they don't we start thrashing the
D-cache by reading in the whole intermediate state over and
over on each iteration.

Instead, once we reach a large enough intermediate state (that
allows the memcpy operation to perform at peak) we cap the
size of chunk of the state that is used as source for subsequent
appends. This ensures that this smaller source chunk is always
present in the D-cache, and the append operation does not need
to read the state contents from memory.

Currently the cap is set to 8KB, a number derived via
experimentation to yield the highest performance across a
a large range of result sizes. Slightly higher caps also
produced similar results: 8KB was chosen as the smallest one
in this performance plateau with the intention to minimize
D-cache pollution.

For result sizes larger than the fastest cache levels we get
significantly higher performance compared to the current
implementation:
strings:
name                            old speed      new speed      delta
RepeatLarge/256/1-16            1.73GB/s ± 1%  1.73GB/s ± 0%      ~     (p=0.556 n=5+4)
RepeatLarge/256/16-16           2.02GB/s ± 0%  1.95GB/s ± 8%      ~     (p=0.222 n=5+5)
RepeatLarge/512/1-16            2.30GB/s ±13%  2.47GB/s ± 1%      ~     (p=0.548 n=5+5)
RepeatLarge/512/16-16           2.38GB/s ±16%  2.77GB/s ± 1%   +16.27%  (p=0.032 n=5+5)
RepeatLarge/1024/1-16           3.17GB/s ± 1%  3.18GB/s ± 0%      ~     (p=0.730 n=4+5)
RepeatLarge/1024/16-16          3.39GB/s ± 2%  3.38GB/s ± 1%      ~     (p=0.548 n=5+5)
RepeatLarge/2048/1-16           3.32GB/s ± 2%  3.32GB/s ± 2%      ~     (p=1.000 n=5+5)
RepeatLarge/2048/16-16          3.41GB/s ± 4%  3.46GB/s ± 2%      ~     (p=0.310 n=5+5)
RepeatLarge/4096/1-16           3.60GB/s ± 4%  3.67GB/s ± 3%      ~     (p=0.690 n=5+5)
RepeatLarge/4096/16-16          3.74GB/s ± 3%  3.71GB/s ± 5%      ~     (p=0.690 n=5+5)
RepeatLarge/8192/1-16           3.94GB/s ± 4%  4.01GB/s ± 1%      ~     (p=0.222 n=5+5)
RepeatLarge/8192/16-16          3.94GB/s ± 6%  4.05GB/s ± 1%      ~     (p=0.222 n=5+5)
RepeatLarge/8192/4097-16        4.25GB/s ± 6%  4.32GB/s ± 3%      ~     (p=0.690 n=5+5)
RepeatLarge/16384/1-16          4.96GB/s ± 1%  5.02GB/s ± 2%      ~     (p=0.421 n=5+5)
RepeatLarge/16384/16-16         4.99GB/s ± 2%  5.07GB/s ± 1%      ~     (p=0.421 n=5+5)
RepeatLarge/16384/4097-16       5.15GB/s ± 3%  5.17GB/s ± 1%      ~     (p=1.000 n=5+5)
RepeatLarge/32768/1-16          5.44GB/s ± 2%  5.42GB/s ± 1%      ~     (p=0.841 n=5+5)
RepeatLarge/32768/16-16         5.46GB/s ± 4%  5.44GB/s ± 1%      ~     (p=0.905 n=5+4)
RepeatLarge/32768/4097-16       4.84GB/s ± 2%  4.59GB/s ±12%    -5.05%  (p=0.032 n=5+5)
RepeatLarge/65536/1-16          5.85GB/s ± 0%  5.84GB/s ± 1%      ~     (p=0.690 n=5+5)
RepeatLarge/65536/16-16         5.81GB/s ± 2%  5.84GB/s ± 2%      ~     (p=0.421 n=5+5)
RepeatLarge/65536/4097-16       5.38GB/s ± 6%  5.45GB/s ± 1%      ~     (p=1.000 n=5+5)
RepeatLarge/131072/1-16         6.20GB/s ± 1%  6.31GB/s ± 1%    +1.80%  (p=0.008 n=5+5)
RepeatLarge/131072/16-16        6.12GB/s ± 3%  6.25GB/s ± 3%      ~     (p=0.095 n=5+5)
RepeatLarge/131072/4097-16      5.95GB/s ± 1%  5.85GB/s ±10%      ~     (p=1.000 n=5+5)
RepeatLarge/262144/1-16         6.33GB/s ± 1%  6.56GB/s ± 0%    +3.62%  (p=0.016 n=5+4)
RepeatLarge/262144/16-16        6.42GB/s ± 0%  6.65GB/s ± 1%    +3.58%  (p=0.016 n=4+5)
RepeatLarge/262144/4097-16      6.31GB/s ± 1%  6.44GB/s ± 1%    +1.94%  (p=0.008 n=5+5)
RepeatLarge/524288/1-16         6.23GB/s ± 1%  6.92GB/s ± 3%   +11.02%  (p=0.008 n=5+5)
RepeatLarge/524288/16-16        6.24GB/s ± 1%  6.97GB/s ± 2%   +11.77%  (p=0.016 n=4+5)
RepeatLarge/524288/4097-16      6.14GB/s ± 2%  6.73GB/s ± 3%    +9.50%  (p=0.008 n=5+5)
RepeatLarge/1048576/1-16        5.23GB/s ± 1%  6.53GB/s ± 6%   +24.85%  (p=0.008 n=5+5)
RepeatLarge/1048576/16-16       5.21GB/s ± 1%  6.56GB/s ± 4%   +25.93%  (p=0.008 n=5+5)
RepeatLarge/1048576/4097-16     5.22GB/s ± 1%  6.26GB/s ± 2%   +20.09%  (p=0.008 n=5+5)
RepeatLarge/2097152/1-16        3.95GB/s ± 1%  5.96GB/s ± 1%   +51.01%  (p=0.008 n=5+5)
RepeatLarge/2097152/16-16       3.94GB/s ± 1%  5.98GB/s ± 2%   +51.99%  (p=0.008 n=5+5)
RepeatLarge/2097152/4097-16     4.94GB/s ± 1%  5.71GB/s ± 2%   +15.63%  (p=0.008 n=5+5)
RepeatLarge/4194304/1-16        3.10GB/s ± 1%  5.89GB/s ± 1%   +89.90%  (p=0.008 n=5+5)
RepeatLarge/4194304/16-16       3.09GB/s ± 1%  5.86GB/s ± 1%   +89.89%  (p=0.008 n=5+5)
RepeatLarge/4194304/4097-16     3.13GB/s ± 1%  5.89GB/s ± 1%   +88.36%  (p=0.008 n=5+5)
RepeatLarge/8388608/1-16        3.06GB/s ± 1%  6.31GB/s ±16%  +105.84%  (p=0.008 n=5+5)
RepeatLarge/8388608/16-16       3.08GB/s ± 1%  6.62GB/s ± 1%  +114.66%  (p=0.008 n=5+5)
RepeatLarge/8388608/4097-16     3.13GB/s ± 2%  6.87GB/s ± 1%  +119.62%  (p=0.008 n=5+5)
RepeatLarge/16777216/1-16       3.21GB/s ± 3%  5.88GB/s ± 1%   +83.27%  (p=0.008 n=5+5)
RepeatLarge/16777216/16-16      3.23GB/s ± 2%  5.84GB/s ± 2%   +80.49%  (p=0.008 n=5+5)
RepeatLarge/16777216/4097-16    3.30GB/s ± 6%  5.88GB/s ± 2%   +78.18%  (p=0.008 n=5+5)
RepeatLarge/33554432/1-16       3.71GB/s ± 3%  5.91GB/s ± 2%   +59.17%  (p=0.008 n=5+5)
RepeatLarge/33554432/16-16      3.67GB/s ± 3%  5.91GB/s ± 2%   +61.13%  (p=0.008 n=5+5)
RepeatLarge/33554432/4097-16    3.71GB/s ± 1%  5.77GB/s ± 6%   +55.51%  (p=0.008 n=5+5)
RepeatLarge/67108864/1-16       4.61GB/s ±11%  6.00GB/s ± 5%   +30.15%  (p=0.008 n=5+5)
RepeatLarge/67108864/16-16      4.62GB/s ± 7%  6.11GB/s ± 2%   +32.35%  (p=0.008 n=5+5)
RepeatLarge/67108864/4097-16    4.71GB/s ± 2%  6.24GB/s ± 2%   +32.60%  (p=0.008 n=5+5)
RepeatLarge/134217728/1-16      4.53GB/s ± 8%  6.28GB/s ±11%   +38.57%  (p=0.008 n=5+5)
RepeatLarge/134217728/16-16     4.78GB/s ± 3%  6.36GB/s ± 3%   +33.16%  (p=0.008 n=5+5)
RepeatLarge/134217728/4097-16   4.73GB/s ± 6%  6.46GB/s ± 3%   +36.63%  (p=0.008 n=5+5)
RepeatLarge/268435456/1-16      4.09GB/s ±25%  6.37GB/s ±19%   +56.00%  (p=0.008 n=5+5)
RepeatLarge/268435456/16-16     4.50GB/s ± 4%  6.86GB/s ± 0%   +52.49%  (p=0.016 n=5+4)
RepeatLarge/268435456/4097-16   4.73GB/s ± 5%  6.90GB/s ± 0%   +45.94%  (p=0.008 n=5+5)
RepeatLarge/536870912/1-16      4.38GB/s ±36%  6.52GB/s ± 8%   +48.68%  (p=0.008 n=5+5)
RepeatLarge/536870912/16-16     4.69GB/s ±12%  6.90GB/s ± 1%   +46.97%  (p=0.008 n=5+5)
RepeatLarge/536870912/4097-16   4.87GB/s ± 8%  6.98GB/s ± 0%   +43.36%  (p=0.008 n=5+5)
RepeatLarge/1073741824/1-16     3.87GB/s ±28%  6.96GB/s ± 1%   +79.94%  (p=0.016 n=5+4)
RepeatLarge/1073741824/16-16    4.79GB/s ± 9%  6.93GB/s ± 0%   +44.79%  (p=0.008 n=5+5)
RepeatLarge/1073741824/4097-16  4.65GB/s ± 8%  7.02GB/s ± 1%   +51.02%  (p=0.008 n=5+5)

bytes:
name                            old speed      new speed      delta
RepeatLarge/256/1-16            1.93GB/s ± 1%  1.84GB/s ± 1%    -4.81%  (p=0.000 n=10+10)
RepeatLarge/256/16-16           2.25GB/s ± 2%  2.15GB/s ± 1%    -4.45%  (p=0.000 n=9+8)
RepeatLarge/512/1-16            2.71GB/s ± 1%  2.62GB/s ± 1%    -3.27%  (p=0.000 n=10+9)
RepeatLarge/512/16-16           2.96GB/s ± 4%  2.91GB/s ± 1%      ~     (p=0.243 n=9+10)
RepeatLarge/1024/1-16           3.35GB/s ± 1%  3.27GB/s ± 1%    -2.61%  (p=0.000 n=9+10)
RepeatLarge/1024/16-16          3.56GB/s ± 2%  3.52GB/s ± 1%    -1.10%  (p=0.010 n=10+9)
RepeatLarge/2048/1-16           3.52GB/s ± 1%  3.45GB/s ± 1%    -1.92%  (p=0.000 n=10+10)
RepeatLarge/2048/16-16          3.61GB/s ± 1%  3.58GB/s ± 0%    -0.82%  (p=0.008 n=9+8)
RepeatLarge/4096/1-16           3.85GB/s ± 2%  3.80GB/s ± 2%      ~     (p=0.165 n=10+10)
RepeatLarge/4096/16-16          3.88GB/s ± 3%  3.84GB/s ± 4%      ~     (p=0.393 n=10+10)
RepeatLarge/8192/1-16           4.12GB/s ± 2%  4.04GB/s ± 1%    -1.96%  (p=0.000 n=10+10)
RepeatLarge/8192/16-16          4.11GB/s ± 2%  4.09GB/s ± 1%      ~     (p=0.278 n=9+10)
RepeatLarge/8192/4097-16        4.38GB/s ± 1%  4.39GB/s ± 4%      ~     (p=0.720 n=9+10)
RepeatLarge/16384/1-16          5.06GB/s ± 2%  4.95GB/s ± 3%    -2.29%  (p=0.001 n=10+9)
RepeatLarge/16384/16-16         5.11GB/s ± 3%  5.06GB/s ± 3%      ~     (p=0.315 n=10+9)
RepeatLarge/16384/4097-16       5.22GB/s ± 3%  5.26GB/s ± 3%      ~     (p=0.211 n=9+10)
RepeatLarge/32768/1-16          5.54GB/s ± 2%  5.50GB/s ± 3%      ~     (p=0.353 n=10+10)
RepeatLarge/32768/16-16         5.55GB/s ± 1%  5.60GB/s ± 1%    +0.91%  (p=0.035 n=10+9)
RepeatLarge/32768/4097-16       4.88GB/s ± 2%  4.85GB/s ± 2%      ~     (p=0.447 n=10+9)
RepeatLarge/65536/1-16          5.86GB/s ± 1%  5.93GB/s ± 2%    +1.18%  (p=0.043 n=8+10)
RepeatLarge/65536/16-16         5.83GB/s ± 2%  5.98GB/s ± 1%    +2.67%  (p=0.000 n=10+10)
RepeatLarge/65536/4097-16       5.57GB/s ± 0%  5.56GB/s ± 3%      ~     (p=0.696 n=8+10)
RepeatLarge/131072/1-16         6.23GB/s ± 1%  6.38GB/s ± 2%    +2.51%  (p=0.000 n=9+10)
RepeatLarge/131072/16-16        6.21GB/s ± 2%  6.37GB/s ± 1%    +2.72%  (p=0.000 n=9+10)
RepeatLarge/131072/4097-16      6.04GB/s ± 1%  6.09GB/s ± 3%      ~     (p=0.356 n=9+10)
RepeatLarge/262144/1-16         6.47GB/s ± 1%  6.63GB/s ± 2%    +2.57%  (p=0.003 n=10+10)
RepeatLarge/262144/16-16        6.45GB/s ± 2%  6.69GB/s ± 2%    +3.65%  (p=0.000 n=10+10)
RepeatLarge/262144/4097-16      6.35GB/s ± 1%  6.51GB/s ± 2%    +2.48%  (p=0.000 n=9+10)
RepeatLarge/524288/1-16         6.21GB/s ± 2%  6.95GB/s ± 1%   +11.95%  (p=0.000 n=10+10)
RepeatLarge/524288/16-16        6.24GB/s ± 2%  6.93GB/s ± 2%   +11.11%  (p=0.000 n=10+10)
RepeatLarge/524288/4097-16      6.18GB/s ± 2%  6.82GB/s ± 1%   +10.39%  (p=0.000 n=9+10)
RepeatLarge/1048576/1-16        5.34GB/s ± 2%  6.41GB/s ± 2%   +20.05%  (p=0.000 n=10+10)
RepeatLarge/1048576/16-16       5.33GB/s ± 1%  6.45GB/s ± 2%   +20.84%  (p=0.000 n=10+9)
RepeatLarge/1048576/4097-16     5.28GB/s ± 1%  6.17GB/s ± 2%   +16.75%  (p=0.000 n=10+10)
RepeatLarge/2097152/1-16        4.04GB/s ± 1%  6.21GB/s ± 1%   +53.89%  (p=0.000 n=9+8)
RepeatLarge/2097152/16-16       4.02GB/s ± 1%  6.20GB/s ± 2%   +54.37%  (p=0.000 n=10+9)
RepeatLarge/2097152/4097-16     4.94GB/s ± 1%  6.04GB/s ± 1%   +22.36%  (p=0.000 n=10+10)
RepeatLarge/4194304/1-16        3.10GB/s ± 1%  5.74GB/s ± 0%   +85.04%  (p=0.000 n=10+9)
RepeatLarge/4194304/16-16       3.10GB/s ± 2%  5.72GB/s ± 1%   +84.26%  (p=0.000 n=9+10)
RepeatLarge/4194304/4097-16     3.03GB/s ± 4%  5.61GB/s ± 1%   +85.06%  (p=0.000 n=10+9)
RepeatLarge/8388608/1-16        3.08GB/s ± 2%  6.25GB/s ± 1%  +103.09%  (p=0.000 n=9+9)
RepeatLarge/8388608/16-16       3.07GB/s ± 2%  6.26GB/s ± 3%  +104.07%  (p=0.000 n=10+9)
RepeatLarge/8388608/4097-16     3.08GB/s ± 2%  6.23GB/s ± 2%  +102.09%  (p=0.000 n=9+10)
RepeatLarge/16777216/1-16       3.25GB/s ± 2%  5.78GB/s ± 3%   +78.03%  (p=0.000 n=9+9)
RepeatLarge/16777216/16-16      3.25GB/s ± 1%  5.75GB/s ± 1%   +77.21%  (p=0.000 n=9+10)
RepeatLarge/16777216/4097-16    3.29GB/s ± 3%  5.72GB/s ± 2%   +73.74%  (p=0.000 n=10+10)
RepeatLarge/33554432/1-16       3.68GB/s ± 2%  5.90GB/s ± 1%   +60.20%  (p=0.000 n=10+10)
RepeatLarge/33554432/16-16      3.69GB/s ± 3%  5.88GB/s ± 1%   +59.54%  (p=0.000 n=10+9)
RepeatLarge/33554432/4097-16    3.74GB/s ± 1%  5.94GB/s ± 2%   +58.68%  (p=0.000 n=7+10)
RepeatLarge/67108864/1-16       4.62GB/s ±12%  6.11GB/s ± 3%   +32.23%  (p=0.000 n=10+9)
RepeatLarge/67108864/16-16      4.77GB/s ± 2%  6.09GB/s ± 2%   +27.88%  (p=0.000 n=9+9)
RepeatLarge/67108864/4097-16    4.78GB/s ± 1%  6.19GB/s ± 1%   +29.51%  (p=0.000 n=9+10)
RepeatLarge/134217728/1-16      4.60GB/s ±16%  6.52GB/s ± 9%   +41.67%  (p=0.000 n=10+10)
RepeatLarge/134217728/16-16     4.80GB/s ± 4%  6.81GB/s ± 2%   +41.82%  (p=0.000 n=10+9)
RepeatLarge/134217728/4097-16   4.79GB/s ± 4%  6.81GB/s ± 2%   +42.31%  (p=0.000 n=9+10)
RepeatLarge/268435456/1-16      4.43GB/s ±25%  6.27GB/s ±14%   +41.52%  (p=0.000 n=10+10)
RepeatLarge/268435456/16-16     4.75GB/s ± 4%  6.68GB/s ± 4%   +40.50%  (p=0.000 n=9+10)
RepeatLarge/268435456/4097-16   4.75GB/s ± 3%  6.58GB/s ± 4%   +38.68%  (p=0.000 n=9+10)
RepeatLarge/536870912/1-16      4.96GB/s ± 9%  6.39GB/s ±16%   +28.90%  (p=0.000 n=8+10)
RepeatLarge/536870912/16-16     4.66GB/s ± 6%  6.57GB/s ± 7%   +40.82%  (p=0.000 n=10+9)
RepeatLarge/536870912/4097-16   4.68GB/s ±11%  6.88GB/s ± 3%   +47.01%  (p=0.000 n=10+9)
RepeatLarge/1073741824/1-16     4.39GB/s ±23%  6.57GB/s ± 5%   +49.75%  (p=0.000 n=10+8)
RepeatLarge/1073741824/16-16    4.73GB/s ±13%  6.89GB/s ± 1%   +45.68%  (p=0.000 n=9+8)
RepeatLarge/1073741824/4097-16  4.97GB/s ±15%  6.73GB/s ± 9%   +35.45%  (p=0.000 n=10+10)

The results above come from a Intel i9-9980HK (256KB L2) with
TurboBoost disabled.

Change-Id: I79dd57da0429aee9020ffd7bc458a034b999b740
Reviewed-on: https://go-review.googlesource.com/c/go/+/419054
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-27 16:55:15 +00:00
Zeke Lu
7d157fd0eb debug/elf: suport files with >= 65280 (0xff00) sections
The spec https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html
states:

1. e_shnum: If the number of sections is greater than or equal to
SHN_LORESERVE (0xff00), this member has the value zero and the actual
number of section header table entries is contained in the sh_size
field of the section header at index 0.

2. e_shstrndx: If the section name string table section index is
greater than or equal to SHN_LORESERVE (0xff00), this member has the
value SHN_XINDEX (0xffff) and the actual index of the section name
string table section is contained in the sh_link field of the section
header at index 0.

This CL makes these changes to support files with >= 0xff00 sections:

1. if shoff > 0 && shnum == 0, read sh_size from the initial section
header entry as shnum.
2. if shstrndx == SHN_XINDEX, read sh_link from the initial section
header entry as shstrndx.

It returns an error if the type of the initial section is not SHT_NULL.

A file with >= 0xff00 sections is too big to include in the repository,
so the test case constructs one on the fly, with some of the sections
zeroed out.

While here, remove the unnecessary use of reflect.DeepEqual in the test.

Fixes #55294.

Change-Id: I15ec43612c7cce6e8decfe4e81da3a5b16de47f7
GitHub-Last-Rev: 797c16480b
GitHub-Pull-Request: golang/go#55295
Reviewed-on: https://go-review.googlesource.com/c/go/+/432255
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@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>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-27 16:50:30 +00:00
Than McIntosh
1e4989c336 cmd: relocate search.MatchPattern to cmd/internal/pkgpattern
Relocate cmd/go's search.MatchPattern helper routine to a new package
in cmd/internal from its current location, as to allow it to be used
in other tools that accept package pattern command line flags. No
change in functionality along the way.

Updates #51430.

Change-Id: I726e974ccd66a055bb5a94497b36b8d68d47cad1
Reviewed-on: https://go-review.googlesource.com/c/go/+/432757
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-27 16:43:40 +00:00
doujiang24
fb6c210dc3 runtime/trace: add missing events for the locked g in extra M.
Extra Ms may lead to the "no consistent ordering of events possible" error when parsing trace file with cgo enabled, since:
1. The gs in the extra Ms may be in `_Gdead` status while starting trace by invoking `runtime.StartTrace`,
2. and these gs will trigger `traceEvGoSysExit` events in `runtime.exitsyscall` when invoking go functions from c,
3. then, the events of those gs are under non-consistent ordering, due to missing the previous events.

Add two events, `traceEvGoCreate` and `traceEvGoInSyscall`, in `runtime.StartTrace`, will make the trace parser happy.

Fixes #29707

Change-Id: I2fd9d1713cda22f0ddb36efe1ab351f88da10881
GitHub-Last-Rev: 7bbfddb81b
GitHub-Pull-Request: golang/go#54974
Reviewed-on: https://go-review.googlesource.com/c/go/+/429858
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Michael Pratt <mpratt@google.com>
2022-09-27 16:37:51 +00:00
cui fliter
48a58c5d2c cmd/go/internal: use strings.CutSuffix
Updates #42537

Change-Id: I2d4c5e911c8a2ddfe9a976896b05d3cd8be61f6b
GitHub-Last-Rev: a87597d8a7
GitHub-Pull-Request: golang/go#55830
Reviewed-on: https://go-review.googlesource.com/c/go/+/433275
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-27 16:36:36 +00:00
Ian Lance Taylor
b0f8e20d04 reflect: clarify that Value.Comparable checks the value
For #46746

Change-Id: Ic7a31ddf7cd6bf6dd0db6b9eb3fee68fc180f72e
Reviewed-on: https://go-review.googlesource.com/c/go/+/435277
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-27 16:24:53 +00:00
Ian Lance Taylor
c929a5b855 debug/dwarf: don't crash on invalid range/rnglist offset
No test case because the problem can only happen for invalid data. Let
the fuzzer find cases like this.

Fixes #53529

Change-Id: I318c87795e545fe5a006d16b4d361cd4bf5d502d
Reviewed-on: https://go-review.googlesource.com/c/go/+/434936
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
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: Than McIntosh <thanm@google.com>
2022-09-27 16:08:16 +00:00
Andy Pan
d9d2ef991c net/http: fix the potential leak of textproto.Reader from pool
Fixes #55835

Change-Id: I6109bab2941b859e8cfef22f65a6a3a5f977a8d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/433835
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-27 16:01:59 +00:00
Joel Sing
e978ef36e3 image/gif,image/jpeg,image/png: skip FuzzDecode in testing short mode
The image/gif.FuzzDecode takes an excessive amount of time to run on various
builders - skip these in testing short mode. Likewise for image/jpeg and
image/png.

Fixes #55839

Change-Id: I1049d06b9dcbbc7dbc4f53d3c49b64e2254eabbd
Reviewed-on: https://go-review.googlesource.com/c/go/+/435175
Reviewed-by: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-27 15:57:34 +00:00
cuiweixie
789e798f04 internal/goroot: using strings.CutPrefix replace strings.HasPrefix and strings.TrimPrefix
Change-Id: I63b2af955e2ada6d20e72c10797576d93bbc7e71
Reviewed-on: https://go-review.googlesource.com/c/go/+/435135
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-27 15:53:49 +00:00
TomCao New Macbook Pro
fac5338a6c all: replace [0-9] with \d in regexps
1. replace [0-9] with \d in regexps
2. replace [a-zA-Z0-9_] with \w in regexps

Change-Id: I9e260538252a0c1071e76aeb1c5f885c6843a431
GitHub-Last-Rev: 286e1a4619
GitHub-Pull-Request: golang/go#54874
Reviewed-on: https://go-review.googlesource.com/c/go/+/428435
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-27 14:14:42 +00:00
Than McIntosh
550864e5d2 runtime: add cgo guard for exit hooks test
Add an additional guard to ensure that we don't try to run the "-race"
variant of the exit hooks test when CGO is explicitly turned off via
CGO_ENABLED=0 (this fixes a failure on the no-cgo builder caused
by CL 354790).

Change-Id: I9dc7fbd71962e9a098916da69d9119a753f27116
Reviewed-on: https://go-review.googlesource.com/c/go/+/434935
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-27 13:46:23 +00:00
cui fliter
f6e1677428 cmd/go/internal: use time.DateTime constant
Use the newly defined time.Datetime constant instead of a string literal.

Updates #52746

Change-Id: I2722415ecc67fd2adfdab2eaba3298774032bff3
GitHub-Last-Rev: 65d3aa9bc2
GitHub-Pull-Request: golang/go#55833
Reviewed-on: https://go-review.googlesource.com/c/go/+/433277
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-27 12:49:31 +00:00
Than McIntosh
e6d9057e2f cmd/compile: add coverage fixup mode
Adds a -coveragecfg=<configfile> command line option to the compiler
to help support a cooperative "tool and compiler" mode for coverage
instrumentation. In this mode the cmd/cover tool generates most of the
counter instrumentation via source-to-source rewriting, but the
compiler fixes up the result if passed the "-coveragecfg" option. The
fixups include:

  - reclassifying counter variables (special storage class)
  - marking meta-data variables are read-only
  - adding in an init call to do registation

Updates #51430.

Change-Id: Iead72b85209725ee044542374465f118a3ee72e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/395895
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-27 10:30:53 +00:00
Than McIntosh
072c7d4969 cmd/compile,cmd/link: hooks for identifying coverage counters
Add a new "coverage counter" classification for variables to be used
for storing code coverage counter values (somewhat in the same way
that we identify fuzzer counters). Tagging such variables allows us to
aggregate them in the linker, and to treat updates specially.

Updates #51430.

Change-Id: Ib49fb05736ffece98bcc2f7a7c37e991b7f67bbb
Reviewed-on: https://go-review.googlesource.com/c/go/+/401235
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-27 10:29:51 +00:00
cui fliter
361f5eba9f all: use strings.CutPrefix
Updates #42537

Change-Id: Ice23d7d36bbede27551cbc086119694f6a3b5e4a
GitHub-Last-Rev: 0d65208313
GitHub-Pull-Request: golang/go#55347
Reviewed-on: https://go-review.googlesource.com/c/go/+/432895
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-27 07:35:19 +00:00
Robert Griesemer
17f83e3473 go/types, types2: report "undefined: p.x" instead of "x not declared by package p"
This matches the compiler's long-standing behavior.

For #55326.

Change-Id: Icd946b031b1b6e65498fb52bceb4a53807732463
Reviewed-on: https://go-review.googlesource.com/c/go/+/432556
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-26 23:54:36 +00:00
Robert Griesemer
2da95e0ec8 go/types, types2: report "undefined: x" instead of "undeclared name: x"
This matches the compiler's long-standing behavior.

For #55326.

Change-Id: I90696a11f0b7d1f4be95a4b9a6f01844df2a2347
Reviewed-on: https://go-review.googlesource.com/c/go/+/432555
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-26 23:54:26 +00:00
Isaiah Becker-Mayer
b8d8c9e79f sync: clarify Cond.Wait documentation
The previous wording was unclear and seemingly contradictory.

Change-Id: I0781dc4525948f4e8e5698271362a82387688f81
GitHub-Last-Rev: c1e032fa94
GitHub-Pull-Request: golang/go#53516
Reviewed-on: https://go-review.googlesource.com/c/go/+/413774
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-26 21:58:42 +00:00
Than McIntosh
07bdf1dc54 runtime: add an exit hook facility
Add a new API (not public/exported) for registering a function with
the runtime that should be called when program execution terminates,
to be used in the new code coverage re-implementation. The API looks
like

  func addExitHook(f func(), runOnNonZeroExit bool)

The first argument is the function to be run, second argument controls
whether the function is invoked even if there is a call to os.Exit
with a non-zero status. Exit hooks are run in reverse order of
registration, e.g. the first hook to be registered will be the last to
run. Exit hook functions are not allowed to panic or to make calls to
os.Exit.

Updates #51430.

Change-Id: I906f8c5184b7c1666f05a62cfc7833bf1a4300c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/354790
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-09-26 21:49:14 +00:00
Than McIntosh
cf83a490e4 runtime: add hook to register coverage-instrumented packages
Add support to the runtime for registering coverage-instrumented
packages, using a new hook that can be called from the init function
of an instrumented package. The hook records the meta-data symbol for
the package (chaining it onto a list), and returns a package ID to be
used to identify functions in the package. This new hook is not yet
called; that will be added in a subsequent patch. The list of
registered meta-data objects will be used (again in a future patch) as
part of coverage data file writing.

Special handling is required for packages such as "runtime" or
"internal/cpu", where functions in the package execute before the
package "init" func runs. For these packages hard-code the package ID,
then record the position of the package in the overall list so that we
can fix things up later on.

Updates #51430.

Change-Id: I6ca3ddf535197442a2603c6d7a0a9798b8496f40
Reviewed-on: https://go-review.googlesource.com/c/go/+/401234
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
2022-09-26 21:48:50 +00:00
Than McIntosh
efa3f1749f internal/coverage: add apis for reading/writing counter data
Add utilities for reading and writing of counter data files as part of
the new code coverage implementation.

Trivia note: currently the contents of counter data files are emitted
in little-endian form, which for the counters is somewhat painful in
that we need to visit each counter value and properly encode it. It
might be better to instead emit counters in native endianity and then
teach the tools to decode properly in the case of an endianity
mismatch.

Updates #51430.

Change-Id: I124fdcb40fc339a48b64b35264bf24c3be50ddd4
Reviewed-on: https://go-review.googlesource.com/c/go/+/359403
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
2022-09-26 21:48:18 +00:00
cuiweixie
63668a5155 reflect: create funcTypes using StructOf
follow the TODO to use StructOf, this cl can save the used memory.
for example, old code alloc [128]*rtype for func with 65 arguments(in+out),
this cl change to alloc [65]*rtype to save memory.

Change-Id: I1494bb6b3524d0d46869c3f24a628fec88119d8b
Reviewed-on: https://go-review.googlesource.com/c/go/+/425314
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-09-26 21:39:25 +00:00
Robert Griesemer
22f4471599 go/types, types2: use "invalid recursive type" instead of "illegal cycle" in error messages
This matches long-standing compiler behavior.

For #55326.

Change-Id: Ic5aa0dfb08d035f2c33532cc463c73a55cc020a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/433055
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-09-26 21:33:48 +00:00
Robert Griesemer
4c5a6f9555 go/types, types2: provide error codes where they were missing
We need a better approach eventually, but this is ok for now.
In go/types, always use _UnsupportedFeature for unavailable
version-specific features.

Change-Id: I15b47e34eda167db3133bd481aa2f55cf3662c31
Reviewed-on: https://go-review.googlesource.com/c/go/+/433195
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-09-26 21:33:33 +00:00
Than McIntosh
84f95aa811 internal/coverage: add coverage meta-data decoder
Add a coverage meta-data decoder, which provides APIs for reading
encoded coverage meta-data and expanding it usable form. This package
is intended to be used in the coverage tooling that reads data files
emitted from coverage runs. Along with the new decoding package is a
unit test that runs the encode/decode paths together to check to make
sure that "decode(encode(X)) == X".

Updates #51430.

Change-Id: I81d27d8da0b2fcfa5039114a6e35a4b463d19b3c
Reviewed-on: https://go-review.googlesource.com/c/go/+/353454
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-26 20:52:13 +00:00
Than McIntosh
f951f697c4 internal/coverage: add coverage meta-data encoder
Add a new package with APIs for encoding coverage meta-data. This
provides support for accumulating information about each function
during the compilation process, and then encoding and emitting a
payload for a coverage meta-data symbol.  Not yet connected to the
rest of the coverage machinery (that will appear in a later patch).

Updates #51430.

Change-Id: I61054ce87f205b25fb1bfedaa740fd7425c34de4
Reviewed-on: https://go-review.googlesource.com/c/go/+/353453
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-26 20:51:52 +00:00
Than McIntosh
a3434b71a3 cmd: add a new goexperiment for redesigned code coverage
Add a new "coverageredesign" GOEXPERIMENT (currently off by default),
for gating the use of the new code coverage design/implementation.

Updates #51430.

Change-Id: Ia61da869fcd0d61c6163f734e2fe5e3705f37a91
Reviewed-on: https://go-review.googlesource.com/c/go/+/395894
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Austin Clements <austin@google.com>
2022-09-26 20:50:18 +00:00
cuiweixie
52f9c6fdb0 syscall: check if to is nil to prevent panic from WSASendto
to is an optional pointer to sockaddr, as written in the doc:
https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasendto

For #55845

Change-Id: Ia685cec8d9bc9ff313f598db9d2213a1f409757a
Reviewed-on: https://go-review.googlesource.com/c/go/+/434535
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2022-09-26 20:42:40 +00:00
Zeke Lu
4da2bc2eeb internal/saferio: handle potential total size overflow in SliceCap
Before the change, "SliceCap((*int64)(nil), 1<<62)" returns 1<<62.
That's because "uintptr(c)*size" overflows and gives 0 which is less
than the "chunk". SliceCap should return -1 in this case.

Change-Id: I4e99224c8ac0fc72032c6be86d7318d33d083cd8
GitHub-Last-Rev: ca30bcce45
GitHub-Pull-Request: golang/go#55870
Reviewed-on: https://go-review.googlesource.com/c/go/+/434335
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2022-09-26 20:36:02 +00:00
Bryan C. Mills
bd8a5b00fc os/exec: split parent I/O pipes by whether they are pumped by user code or internal goroutines
The pipes pumped by goroutines can be closed as soon as their
respective goroutines are done.

The pipes pumped by user code, however, are documented to be closed in
Wait. When we add the WaitDelay field, it isn't obvious that we should
terminate the user-pumped pipes when the WaitDelay expires, since Wait
itself isn't going to wait for those user-controlled goroutines to
complete.

(It's a bit more complicated than that because the documentation
currently states that Wait must not be called while the pipes are
being read — but it isn't obvious to me that that advice is entirely
correct.)

For #50436.

Change-Id: I97909c91d2097fb75138a360747168c08609696d
Reviewed-on: https://go-review.googlesource.com/c/go/+/401894
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
2022-09-26 17:26:59 +00:00
Bryan C. Mills
b8d4a14a66 os/exec: clean up pipe-closing logic
Change the childFiles field to a local variable, since it was
populated during Start and (as far as I can determine) has no purpose
after Start returns.

Rename closeAfterStart and closeAfterWait to childIOFiles and
parentIOPipes respectively. That makes their contents clearer, and also
helps to clarify what should happen on error (when, for example, Wait
shouldn't be called at all).

Use a deferred call instead of individual calls to close child (and,
if necessary, pipe) FDs after Start. That helps to clarify the
invariants around when they are closed, and also makes the function a
bit more robust for future refactoring.

Also nil out the slices containing the file closers so that they can
be collected earlier.

This CL is intended as a pure refactor in preparation for #50436.

Change-Id: I05d13fa91d539b95b84b2ba923c1733f9a6203e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/401834
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
2022-09-26 17:26:56 +00:00
Joel Sing
1163acf3ea internal/cpu: deduplicate arm64 ISAR parsing code
Deduplicate code for parsing system registers - this matches what is done
in golang.org/x/sys/cpu.

Change-Id: If3524eb2e361179c68678f8214230d7068fe4c60
Reviewed-on: https://go-review.googlesource.com/c/go/+/422217
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-26 16:42:53 +00:00
Joel Sing
95a5e20d8f internal/cpu: enable arm64 SHA512 detection for freebsd/openbsd
Change-Id: I1f21654b50d7b0cd8e1f854efe2724b72f067449
Reviewed-on: https://go-review.googlesource.com/c/go/+/422216
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Joel Sing <joel@sing.id.au>
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Yuval Pavel Zholkover <paulzhol@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-09-26 16:42:07 +00:00
cuiweixie
c3728b7502 reflect: simplify Value.Comparable
using Type.Comparable to simplify the Value.Comparable,
and return true directly when exit the for loop of kind == array and elements type is interface or array or struct.

Change-Id: Ib0b06a70642ba24c9215c69e7d619960fbeeed90
Reviewed-on: https://go-review.googlesource.com/c/go/+/426457
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: xie cui <523516579@qq.com>
2022-09-26 16:36:07 +00:00
Tobias Klauser
deaec39323 cmd/go/internal/mmap: fix build for js/wasm
Even though there isn't much point in building cmd/go for js/wasm given
it relies on executing sub-processes, this change is trivial enough and
makes cmd/go build for js/wasm again.

Fixes #54219

Change-Id: I91e3adec0f31a4e261af89b4cc829711828ac2ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/433480
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-09-26 16:33:32 +00:00
Tobias Klauser
eab78849fc cmd/go/internal, go/build: remove unused errGoBuildWithoutBuild
Last use was removed by CL 240607.

Change-Id: Icfe9e477c6035823bd676a2ff28e1ac202dd991e
Reviewed-on: https://go-review.googlesource.com/c/go/+/431662
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
2022-09-26 16:28:50 +00:00
Andy Pan
5036ed26bd syscall: check if to is nil to prevent panic from Sendto
Fixes #55845

Change-Id: If30263b7d34829c40e6606846115ec520f351f2c
Reviewed-on: https://go-review.googlesource.com/c/go/+/433504
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-26 14:30:17 +00:00
Than McIntosh
1e91ffc897 cmd/go: avoid internal errors on "go test -testwork"
Fix up the package test harness to avoid errors of the form

  go_test.go:NNN: internal testsuite error: path(".") with no tempdir

when the "-testwork" flag is passed when running "go test".

Fixes #55874.

Change-Id: I76cc39902f51a62cb4cd0da8794b97d620fb4873
Reviewed-on: https://go-review.googlesource.com/c/go/+/434455
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-26 14:16:42 +00:00
Ian Lance Taylor
a0441c7ae3 encoding/gob: use saferio.SliceCap when decoding a slice
This avoids allocating an overly large slice for corrupt input.

Change the saferio.SliceCap function to take a pointer to the element type,
so that we can handle slices of interface types. This revealed that a
couple of existing calls were actually incorrect, passing the slice type
rather than the element type.

No test case because the problem can only happen for invalid data. Let
the fuzzer find cases like this.

Fixes #55338

Change-Id: I3c1724183cc275d4981379773b0b8faa01a9cbd2
Reviewed-on: https://go-review.googlesource.com/c/go/+/433296
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-09-25 01:18:43 +00:00
cuiweixie
336ce966e4 cmd/compile: use "missing method m" instead of "missing m method"
For #55326

Change-Id: I3d0ff7f820f7b2009d1b226abf701b2337fe8cbc
Reviewed-on: https://go-review.googlesource.com/c/go/+/432635
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: xie cui <523516579@qq.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2022-09-24 17:04:15 +00:00
Tobias Klauser
e5deb1556b Revert "net/netip: use slice-to-array conversions"
This reverts commit 3dcf6e2c29.

Reason for revert: breaks the longtest builders for x/tools

Change-Id: I6b6d5afbe46890b6a59829e3d5ab50d885661696
Reviewed-on: https://go-review.googlesource.com/c/go/+/433478
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-23 22:21:53 +00:00
Damien Neil
7c84234142 net/http/httputil: avoid query parameter smuggling
Query parameter smuggling occurs when a proxy's interpretation
of query parameters differs from that of a downstream server.
Change ReverseProxy to avoid forwarding ignored query parameters.

Remove unparsable query parameters from the outbound request

   * if req.Form != nil after calling ReverseProxy.Director; and
   * before calling ReverseProxy.Rewrite.

This change preserves the existing behavior of forwarding the
raw query untouched if a Director hook does not parse the query
by calling Request.ParseForm (possibly indirectly).

Fixes #54663
Fixes CVE-2022-2880

Change-Id: If1621f6b0e73a49d79059dae9e6b256e0ff18ca9
Reviewed-on: https://go-review.googlesource.com/c/go/+/432976
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
2022-09-23 21:06:17 +00:00
Tobias Klauser
3dcf6e2c29 net/netip: use slice-to-array conversions
Use slice-to-array conversions in AddrFromSlice and
(*Addr).UnmarshalBinary. This allows allows to use AddrFrom16 and drop
the redundant ipv6Slice helper.

For #46505

Change-Id: I0e3a7d8825ad438115b7f23ee97cc74eec41a826
Reviewed-on: https://go-review.googlesource.com/c/go/+/432735
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-23 20:32:51 +00:00
Robert Griesemer
c58bfeeb04 cmd/compile: use "init... cycle" instead of "init... loop" in error messages
For #55326.

Change-Id: Ia3c1124305986dcd49ac769e700055b263cfbd59
Reviewed-on: https://go-review.googlesource.com/c/go/+/432615
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
2022-09-23 20:27:09 +00:00
Robert Griesemer
5d213a3dc7 cmd/compile: handle go.mod error msg reference in noder, not type checker
Currently, for version errors, types2 adds the helpful hint

(-lang was set to go1.xx; check go.mod)

where 1.xx is the respective language version, to the error message.
This requires that the type checker knows that it was invoked by the
compiler, which is done through the Config.CompilerErrorMessages flag.

This change looks for version errors being returned by the type checker
and then adds the hint at that point, external to the type checker.
This removes a dependency on the Config.CompilerErrorMessages. Once
we have removed all dependencies on Config.CompilerErrorMessages we
can remove it.

For #55326.

Change-Id: I1f9b2e472c49fe785a2075e26c4b3d9b8fcdbf4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/432559
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>
2022-09-23 20:27:07 +00:00
Damien Neil
2f3008386f cmd: update vendored golang.org/x/tools for multiple error wrapping
Updates vet to permit errors with an Unwrap method returning []error
and multiple %w verbs in fmt.Errorf.

For #53435.

Change-Id: If097715f86c5a03ed606e6d4fb048e17b154b489
Reviewed-on: https://go-review.googlesource.com/c/go/+/433057
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
2022-09-23 15:58:01 +00:00
Tobias Klauser
68fa3696b6 cmd/compile/internal/ir: add missing import to mknode.go
CL 426257 changed ioutil.WriteFile to os.WriteFile but didn't add the
corresponding import for package os.

Change-Id: I7be32138463b44aabc8e36ce353f6dc1376cbe60
Reviewed-on: https://go-review.googlesource.com/c/go/+/433415
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-23 15:14:20 +00:00
Cuong Manh Le
7ed6073da0 cmd/compile: update bottomUpVisitor.visit comments
Change-Id: I83a62b15c5946cfe61afc53c2c528aa3a62f815e
Reviewed-on: https://go-review.googlesource.com/c/go/+/429975
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-09-23 15:09:44 +00:00
Russ Cox
65deb9c3ce text/template/parse: fix confusion about markers near right delims
Fixes #52527.
Fixes #55336.

Change-Id: I8f5c521c693e74451a558788909e7e4ad1cc797a
Reviewed-on: https://go-review.googlesource.com/c/go/+/433036
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-09-23 15:03:43 +00:00
Joe Tsai
2551324cd0 path/filepath: optimize isReservedName
A linear search through a list of 22 strings takes ~80ns.
A quick check for 3-4 byte strings reduces this check to 2ns
for a vast majority of inputs.
In the event of a name match, the new logic is either just
as fast (for "CON") or 10x faster (for "LPT9").

Change-Id: I412fa73beebd7c81dc95f9ed12c35ca1d5d6baf0
Reviewed-on: https://go-review.googlesource.com/c/go/+/433175
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-23 04:34:52 +00:00
Russ Cox
c2ede92a0d runtime/pprof: force use of 4-column profiles in pprof memprofile output
Pprof's converter from legacy text format to protobuf format
assumes that if the alloc and inuse stats are equal, then what's
really going on is that the program makes no distinction, and it
reads them as a two-column profile: objects and bytes.

Most of the time, some sampled object has been freed, and alloc != inuse.
In that case, pprof reads the profile as a four-column profile, with
alloc_objects, alloc_bytes, inuse_objects, inuse_bytes.

The 2-column form causes problems in a few ways. One is that if
you are reading the proto form and expect samples with the 4-column
names, they're not there. Another is that pprof's profile merger insists
on having the same number of columns and same names. This means
that

	pprof *.memprofile

works most of the time but fails if one of the memory profiles hit
the unlikely condition that alloc == inuse, since now its converted
form differs from the others.

Most programs should simply not be using this output form at all,
but cmd/compile and cmd/link still do, because x/tools/cmd/compilebench
reads some extra values from the text form that we have not yet added
to the proto form.

For the programs still writing this form, the easiest way to avoid the
column collapse issues is to ensure that the header never reports
alloc == inuse. The actual values in the header are ignored by pprof now,
except for the equality check (they should sum to the other values in the
file, so they are technically redundant). Because the actual values are not
used except for the equality check, we could hard-code different values
like 0 and 1, but just in case, to break as little as possible, this CL only
adjusts the values when they would otherwise be equal. In that case it
adds 1 to allocBytes. For most profiles, where alloc != inuse already, there
is no effect at all.

Change-Id: Ia563e402573d0f6eb81ae496645db27c08f9fe31
Reviewed-on: https://go-review.googlesource.com/c/go/+/432758
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
2022-09-23 01:07:03 +00:00
Cherry Mui
ddaf68200a cmd/internal/objfile: read file/line information for ELF PIE binaries
For PIE binaries, the .gopclntab section doesn't have the usual
name, but .data.rel.ro.gopclntab. Try the relro version as well.
If both failed (e.g. for externally linked PIE binaries), try
runtime.pclntab symbol.

This should make cmd/objdump able to print the file/line
information for PIE binaries.

I attempted to do this a few years ago, but that wasn't enough,
because the pclntab itself contains dynamic relocations which are
not applied by the tool. As of Go 1.18 the pclntab is mostly
position independent and does not contain dynamic relocations, so
this should be possible now.

Fixes #17883.
Updates #46639.

Change-Id: I85dc3d50ffcc1a4b187a349479a6a162de1ab2b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/227483
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-22 23:46:28 +00:00
Cuong Manh Le
533cd80315 cmd/compile/internal/walk: remove reduceSlice
After CL 22425, there're two optimizations for slice expr which are
never applied during walk pass:

	s[i:len(s)]
        s[i:j:cap(s)]

The order pass have already rewritten len/cap expression to use autotmp,
thus the same safe expression check will never fire. The code can now be
simplified by moving the only case left from reduceSlice to walkSlice,
then removing reduceSlice entirely.

Passes toolstash-check.

Change-Id: Ia8cfb15c8e96c186a214c17b42d0fee51b0d3a1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/432695
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-22 21:36:44 +00:00
Bryan C. Mills
42a46206b9 cmd/go: omit VCS stamping during bootstrap
cmd/dist can't easily hard-code -buildvcs=false because not all
versions of cmd/go supported for bootstrapping recognize that flag.

However, we don't want to stamp the bootstrap binaries: the stamping
is redundant with the VERSION file writted during bootstrapping (which
is why it is normally omitted for standard-library packages and
commands), and it may also interfere with building the Go repo from a
source tarball or zip file.

Fixes #54852.

Change-Id: If223f094af137c4c202d6bf622619bd2da397ec4
Reviewed-on: https://go-review.googlesource.com/c/go/+/432435
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-22 18:55:06 +00:00
Kevin Chen
88a6a4d1ba cmd/compile/internal/syntax: remove TypeList syntax in comment
Change-Id: Ic4df6a8e198b069a9f3a28710fa40f29bd658b06
GitHub-Last-Rev: 51040eb5e5
GitHub-Pull-Request: golang/go#55345
Reviewed-on: https://go-review.googlesource.com/c/go/+/432795
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-09-22 18:43:28 +00:00
cuiweixie
ebaa5ff39e crypto/tls: convert Conn.activeCall to atomic type
Change-Id: I5b063070a17bdeed57e73bfb76125b94268b3bc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/426088
Run-TryBot: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2022-09-22 18:24:49 +00:00
Damien Neil
d7df872267 all: tidy std module
Change-Id: I7350a608a198073673fb9b7e9b91dae6f1c861b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/432495
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
2022-09-21 20:59:10 +00:00
Damien Neil
4412230503 net/http: add tracing to TestTransportReuseConnection_Gzip_*
These tests are flaky; add some additional logging in hopes
it will aid in debugging.

For #53373

Change-Id: I971a2815f50932a9700ef8c2f684c5416951e6de
Reviewed-on: https://go-review.googlesource.com/c/go/+/432375
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-21 15:39:17 +00:00
Damien Neil
e246cf626d net/http: accept HEAD requests with a body
RFC 7231 permits HEAD requests to contain a body, although it does
state there are no defined semantics for payloads of HEAD requests
and that some servers may reject HEAD requests with a payload.

Accept HEAD requests with a body.

Fix a bug where a HEAD request with a chunked body would interpret
the body as the headers for the next request on the connection.

For #53960.

Change-Id: I83f7112fdedabd6d6291cd956151d718ee6942cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/418614
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-21 15:30:20 +00:00
Damien Neil
493ebc3590 all: update vendored golang.org/x/net
Pull in HTTP/2 fix needed for net/http test case.

	f8f703f979 http2: accept HEAD requests with a body

For #53960

Change-Id: I59bbd83977daced5ed21ec5345af8cdb607e532e
Reviewed-on: https://go-review.googlesource.com/c/go/+/432197
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-09-21 15:07:53 +00:00
Shulhan
68370187fa math: show value of integer constants in comments
Fixes #51282

Change-Id: I5b0d68165b727a427bd4a42663b2fa0070ced22f
Reviewed-on: https://go-review.googlesource.com/c/go/+/343990
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-21 14:07:39 +00:00
Charlie Vieth
c70fd4b30a bytes, strings: add ASCII fast path to EqualFold
This commit adds an ASCII fast path to bytes/strings EqualFold that
roughly doubles performance when all characters are ASCII.

It also changes strings.EqualFold to use `for range` for the first
string since this is ~10% faster than using utf8.DecodeRuneInString for
both (see #31666).

Performance (similar results on arm64 and amd64):

name                        old time/op  new time/op  delta
EqualFold/Tests-10           238ns ± 0%   172ns ± 1%  -27.91%  (p=0.000 n=10+10)
EqualFold/ASCII-10          20.5ns ± 0%   9.7ns ± 0%  -52.73%  (p=0.000 n=10+10)
EqualFold/UnicodePrefix-10  86.5ns ± 0%  77.6ns ± 0%  -10.37%  (p=0.000 n=10+10)
EqualFold/UnicodeSuffix-10  86.8ns ± 2%  71.3ns ± 0%  -17.88%  (p=0.000 n=10+8)

Change-Id: I058f3f97a08dc04d65af895674d85420f920abe1
Reviewed-on: https://go-review.googlesource.com/c/go/+/425459
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@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>
2022-09-21 14:00:37 +00:00
Joe Tsai
9c916c7901 fmt: rely on utf8.AppendRune
This is both simpler and more performant.
The need for fmt.fmtC to manually check for utf8.MaxRune
is subtle to avoid overflow when converting uint64 to rune,
so a test case was added to exercise this edge case.

Change-Id: I0f2e6cce91dcd4cc6b88190c29807ca1c58e999d
Reviewed-on: https://go-review.googlesource.com/c/go/+/412335
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
2022-09-21 13:54:31 +00:00
Ian Lance Taylor
d11c58eedb runtime: treat SI_TKILL like SI_USER on Linux
On Linux a signal sent using tgkill will have si_code == SI_TKILL,
not SI_USER. Treat the two cases the same. Add a Linux-specific test.

Change the test to use the C pause function rather than sleeping
for a second, as that achieves the same effect.

This is a roll forward of CL 431255 which was rolled back in CL 431715.
This new version skips flaky tests on more systems, and marks a new method
nosplit.

Change-Id: Ibf2d3e6fc43d63d0a71afa8fcca6a11fda03f291
Reviewed-on: https://go-review.googlesource.com/c/go/+/432136
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-21 01:56:24 +00:00
Keith Randall
fec83c8a7d Revert "cmd/compile: enable carry chain scheduling for arm64"
This reverts commit 4c414c7673.

Reason for revert: breaks ppc64 build (see issue 55254)

Change-Id: I096ffa0e6535d31d9dd4079b48bb201b20220d76
Reviewed-on: https://go-review.googlesource.com/c/go/+/432196
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2022-09-20 20:51:20 +00:00
Joe Tsai
bcd44b61d3 time: optimize Parse for []byte arguments
When one has a []byte on hand, but desires to call the Parse function,
the conversion from []byte to string would allocate.
This occurs frequently through UnmarshalText and UnmarshalJSON.

This changes it such that the input string never escapes from
any of the Parse functions. Together with the compiler optimization
where the compiler stack allocates any string smaller than 32B
this makes most valid inputs for Parse(layout, string(input))
not require an allocation for the input string.

This optimization works well for most RFC3339 timestamps.
All timestamps with second resolution
(e.g., 2000-01-01T00:00:00Z or 2000-01-01T00:00:00+23:59)
or timestamps with nanosecond resolution in UTC
(e.g., 2000-01-01T00:00:00.123456789Z)
are less than 32B and benefit from this optimization.
Unfortunately, nanosecond timestamps with non-UTC timezones
(e.g., 2000-01-01T00:00:00.123456789+23:59)
do not benefit since they are 35B long.

Previously, this was not possible since the input leaked
to the error and calls to FixedZone with the zone name,
which causes the prover to give up and heap copy the []byte.
We fix this by copying the input string in both cases.
The advantage of this change is that you can now call Parse
with a []byte without allocating (most of the times).
The detriment is that the timezone and error path has an extra allocation.
Handling of timezones were already expensive (3 allocations and 160B allocated),
so the additional cost of another string allocation is relatively minor.
We should optimize for the common case, rather than the exceptional case.

Performance:

    name                  old time/op  new time/op  delta
    ParseRFC3339UTCBytes  54.4ns ± 1%  40.3ns ± 1%  -25.91%  (p=0.000 n=9+10)

Now that parsing of RFC3339 has been heavily optimized in CL 425197,
the performance gains by this optimization becomes relatively more notable.

Related to CL 345488.

Change-Id: I2a8a9cd6354b3bd46c2f57818ed2646a2e485f36
Reviewed-on: https://go-review.googlesource.com/c/go/+/429862
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-20 16:21:31 +00:00
Tobias Klauser
1e96f42c2a syscall: drop compatibility for FreeBSD < 10.0
Change-Id: Idd8cee84215e61817a86915160c91242670798af
Reviewed-on: https://go-review.googlesource.com/c/go/+/431663
Reviewed-by: Yuval Pavel Zholkover <paulzhol@gmail.com>
Reviewed-by: Dmitri Goutnik <dgoutnik@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
2022-09-20 15:46:41 +00:00
Tobias Klauser
b5fcb35b31 cmd/cgo: mention //go:build line in godoc
Say "//go:build" instead of "// +build" in the package level godoc
comment.

Change-Id: I4700227a03197ffbe29e4de04d068b4c63bb5bf0
Reviewed-on: https://go-review.googlesource.com/c/go/+/431856
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-20 15:46:03 +00:00
Erik Pellizzon
1eeb257b88 crypto: use encoding append functions
Replace custom append functions in the hash functions with the implementation of the encoding/binary package that do the same thing.
The binary bigendian functions are already used in other parts of the code in the crypto package.

Change-Id: I76d2dbe143fc72a3b4ac06be312caf72bd71378a
GitHub-Last-Rev: 1c6c68279e
GitHub-Pull-Request: golang/go#55085
Reviewed-on: https://go-review.googlesource.com/c/go/+/431035
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-20 02:58:09 +00:00
Andy Pan
f8c659b62f all: replace package ioutil with os and io in src
For #45557

Change-Id: I56824135d86452603dd4ed4bab0e24c201bb0683
Reviewed-on: https://go-review.googlesource.com/c/go/+/426257
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-20 02:13:02 +00:00
thinkofher
1e7e160d07 mime/multipart: use %w when wrapping error in NextPart
Use "%w" instead of "%v" as format verb for error value in the NextPart
method. This way it will be possible to use common go error utilities
from std library when parsing from custom io.Readers.

This issue was discovered during attempts to use
http.Request.ParseMultipartForm together with http.MaxBytesHandler.

Change-Id: Idb82510fb536b66b51ed1d943737c4828f07c2f2
GitHub-Last-Rev: 8bc49c945c
GitHub-Pull-Request: golang/go#55133
Reviewed-on: https://go-review.googlesource.com/c/go/+/431675
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Damien Neil <dneil@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>
Reviewed-by: Damien Neil <dneil@google.com>
2022-09-20 02:11:38 +00:00
eric fang
4c414c7673 cmd/compile: enable carry chain scheduling for arm64
This is a follow up of CL 393656 on arm64.

Benchmarks:
name                                  old time/op    new time/op    delta
ScalarMult/P256-8                       42.0µs ± 0%    42.0µs ± 0%   -0.13%  (p=0.032 n=5+5)
ScalarMult/P224-8                        135µs ± 0%      96µs ± 0%  -29.04%  (p=0.008 n=5+5)
ScalarMult/P384-8                        573µs ± 1%     355µs ± 0%  -38.05%  (p=0.008 n=5+5)
ScalarMult/P521-8                       1.50ms ± 4%    0.77ms ± 0%  -48.78%  (p=0.008 n=5+5)
MarshalUnmarshal/P256/Uncompressed-8     505ns ± 1%     506ns ± 0%     ~     (p=0.460 n=5+5)
MarshalUnmarshal/P256/Compressed-8      6.75µs ± 0%    6.73µs ± 0%   -0.27%  (p=0.016 n=5+5)
MarshalUnmarshal/P224/Uncompressed-8     927ns ± 0%     818ns ± 0%  -11.76%  (p=0.008 n=5+5)
MarshalUnmarshal/P224/Compressed-8       136µs ± 0%      96µs ± 0%  -29.58%  (p=0.008 n=5+5)
MarshalUnmarshal/P384/Uncompressed-8    1.77µs ± 0%    1.36µs ± 1%  -23.14%  (p=0.008 n=5+5)
MarshalUnmarshal/P384/Compressed-8      56.5µs ± 0%    31.9µs ± 0%  -43.59%  (p=0.016 n=5+4)
MarshalUnmarshal/P521/Uncompressed-8    2.91µs ± 0%    2.03µs ± 1%  -30.32%  (p=0.008 n=5+5)
MarshalUnmarshal/P521/Compressed-8       148µs ± 0%      68µs ± 1%  -54.28%  (p=0.008 n=5+5)

Change-Id: I33170360eb8279b998e3c559f7136717fe32e07d
Reviewed-on: https://go-review.googlesource.com/c/go/+/424907
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Eric Fang <eric.fang@arm.com>
Reviewed-by: Keith Randall <khr@golang.org>
2022-09-20 01:15:17 +00:00
eric fang
cf53990b18 cmd/compile: Add some CMP and CMN optimization rules on arm64
This CL adds some optimizaion rules:
1, Converts CMP to CMN, or vice versa, when comparing with a negative
number.
2, For equal and not equal comparisons, CMP can be converted to CMN in
some cases. In theory we could do the same optimization for LT, LE, GT
and GE, but need to account for overflow, this CL doesn't handle them.

There are no noticeable performance changes.

Change-Id: Ia49266c019ab7908ebc9510c2f02e121b1607869
Reviewed-on: https://go-review.googlesource.com/c/go/+/429795
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Eric Fang <eric.fang@arm.com>
2022-09-20 01:14:40 +00:00
cuiweixie
7db923fe56 net/http: convert Server.disableKeepAlives to atomic type
Change-Id: I87526520b519554ea344288cc0f0940d7b182e21
Reviewed-on: https://go-review.googlesource.com/c/go/+/428815
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2022-09-19 22:51:53 +00:00
Keith Randall
f1b7b2fc52 runtime: make mSpanStateBox accessors nosplit
get, at least, is called from typedmemclr which must not be interruptible.
These were previously nosplit by accident before CL 424395 (the only
call they had was an intrinsic, so they were leaf functions, so they had
no prologue). After CL 424395 they contained a call (in noinline builds),
thus had a prologue, thus had a suspension point.

I have no idea how we might test this.

This is another motivating use case for having a nosplitrec directive
in the runtime.

Fixes #55156
Fixes #54779
Fixes #54906
Fixes #54907

Change-Id: I851d733d71bda7172c4c96e027657e22b499ee00
Reviewed-on: https://go-review.googlesource.com/c/go/+/431919
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-19 21:57:04 +00:00
Rob Pike
2d741947d8 flag: test IsBoolFlag when creating the usage message
Although I can't think of any reason to do this, it is possible for
a user-defined flag to implement IsBoolFlag but return "false".
This is nuts because checking the interface is satisfied should
obviously be sufficient, but the documentation kinda implies it's
not. And if you try this, you'll discover that the usage message
ignores the return value even though the rest of the package plays
nice. Bother.

So we fix it, as the fix is trivial: call the method when creating
the usage message.

Fixes #53473

Change-Id: I1ac80a876ad5626eebfc5ef6cb972cd3007afaad
Reviewed-on: https://go-review.googlesource.com/c/go/+/431102
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-19 21:54:35 +00:00
Matthew Dempsky
d31f85009c cmd/compile: skip emitting dictionaries with missing method expressions
The nounified frontend currently tries to construct dictionaries that
correspond to invalid instantiations (i.e., instantiations T[X] where
X does not satisfy the constraints specified on T's type parameter).
As a consequence, we may fail to find method expressions needed by the
dictionary.

The real fix for this is to avoid creating those dictionaries in the
first place, because they should never actually be needed at runtime.
But that seems scary for a backport: we've repeatedly attempted to
backport generics fixes, which have fixed one issue but introduced
another.

This CL is a minimally invasive solution to #54225, which avoids the
ICE by instead skipping emitting the invalid dictionary. If the
dictionary ends up not being needed (which I believe will always be
the case), then the linker's reachability analysis will simply ignore
its absence.

Or worst case, if the dictionary *is* reachable somehow, we've simply
turned an ICE into a link-time missing symbol failure. That's not
great for user experience, but it seems like a small trade off to
avoid risking breaking any other currently working code.

Updates #54225.

Change-Id: Ic379696079f4729b1dd6a66994a58cca50281a84
Reviewed-on: https://go-review.googlesource.com/c/go/+/429655
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-09-19 19:37:22 +00:00
Joel Sing
7234c90352 cmd/compile: combine operations with immediate on riscv64
Replace two immediate operations with one, where possible.

Change-Id: Idc00e868155c9ca1d872aaaf70ea1f73e9eac4d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/428497
Reviewed-by: Wayne Zuo <wdvxdr@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Joel Sing <joel@sing.id.au>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-09-19 19:01:45 +00:00
Joel Sing
83d94daec2 cmd/compile: avoid the use of XOR for boolean equality on riscv64
The use of SEQZ/SNEZ and SUB allows for other optimisations to be utilised,
particularly absorption into branch equality conditions.

Change-Id: I74e7d6a07a8decc1bdb651660c322bcc6eb6a10a
Reviewed-on: https://go-review.googlesource.com/c/go/+/428216
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-09-19 19:01:06 +00:00
Joel Sing
fd82718e06 internal/bytealg: correct alignment checks for compare/memequal on riscv64
On riscv64 we need 8 byte alignment for 8 byte loads - the existing check
was only ensuring 4 byte alignment, which potentially results in unaligned
loads being performed. Unaligned loads incur a significant performance penality
due to the resulting kernel traps and fix ups.

Adjust BenchmarkCompareBytesBigUnaligned so that this issue would have been
more readily visible.

Updates #50615

name                                 old time/op    new time/op      delta
CompareBytesBigUnaligned/offset=1-4    6.98ms _ 5%      6.84ms _ 3%       ~     (p=0.319 n=5+5)
CompareBytesBigUnaligned/offset=2-4    6.75ms _ 1%      6.99ms _ 4%       ~     (p=0.063 n=5+5)
CompareBytesBigUnaligned/offset=3-4    6.84ms _ 1%      6.74ms _ 1%     -1.48%  (p=0.003 n=5+5)
CompareBytesBigUnaligned/offset=4-4     146ms _ 1%         7ms _ 6%    -95.08%  (p=0.000 n=5+5)
CompareBytesBigUnaligned/offset=5-4    7.05ms _ 5%      6.75ms _ 1%       ~     (p=0.079 n=5+5)
CompareBytesBigUnaligned/offset=6-4    7.11ms _ 5%      6.89ms _ 5%       ~     (p=0.177 n=5+5)
CompareBytesBigUnaligned/offset=7-4    7.14ms _ 5%      6.91ms _ 6%       ~     (p=0.165 n=5+5)

name                                 old speed      new speed        delta
CompareBytesBigUnaligned/offset=1-4   150MB/s _ 5%     153MB/s _ 3%       ~     (p=0.336 n=5+5)
CompareBytesBigUnaligned/offset=2-4   155MB/s _ 1%     150MB/s _ 4%       ~     (p=0.058 n=5+5)
CompareBytesBigUnaligned/offset=3-4   153MB/s _ 1%     156MB/s _ 1%     +1.51%  (p=0.004 n=5+5)
CompareBytesBigUnaligned/offset=4-4  7.16MB/s _ 1%  145.79MB/s _ 6%  +1936.23%  (p=0.000 n=5+5)
CompareBytesBigUnaligned/offset=5-4   149MB/s _ 5%     155MB/s _ 1%       ~     (p=0.078 n=5+5)
CompareBytesBigUnaligned/offset=6-4   148MB/s _ 5%     152MB/s _ 5%       ~     (p=0.175 n=5+5)
CompareBytesBigUnaligned/offset=7-4   147MB/s _ 5%     152MB/s _ 6%       ~     (p=0.160 n=5+5)

Change-Id: I2c859e061919db482318ce63b85b808aa973a9ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/431099
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Joel Sing <joel@sing.id.au>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-09-19 18:59:50 +00:00
Matthew Dempsky
ceffdc8545 cmd/compile: implement slice-to-array conversions
The conversion T(x) is implemented as *(*T)(x). Accordingly, runtime
panic messages for (*T)(x) are made more general.

Fixes #46505.

Change-Id: I76317c0878b6a5908299506d392eed50d7ef6523
Reviewed-on: https://go-review.googlesource.com/c/go/+/430415
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2022-09-19 18:58:26 +00:00
Matthew Dempsky
29153be757 go/internal/gcimporter: fix ureader.go handling of local defined types
In unified IR, local defined types are promoted to a global defined
type with a "vargen" suffix. These shouldn't actually be exposed to
go/types users, because they're only relevant within function bodies,
which go/types doesn't support importing.

Moreover, in the case of defined types that were declared within a
generic function, they can have ambient type parameters, which the
go/types importer doesn't know how to handle (because they shouldn't
be needed for that use case).

While here, prune the gcimporter_test.go skip list, because some of
the listed failures have actually been fixed and all of them are
specific to the Go 1.18 (nounified) frontend. They all work correctly
with GOEXPERIMENT=unified.

Fixes #55110.

Change-Id: I7dd8b86355d910dfed1d47edbad7695144c3f84d
Reviewed-on: https://go-review.googlesource.com/c/go/+/431495
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-19 18:47:11 +00:00
Matthew Dempsky
38cecb2290 test: add regress test for issue 55101
This test case already works with GOEXPERIMENT=unified, and it never
worked with Go 1.18 or Go 1.19. So this CL simply adds a regress test
to make sure it continues working.

Fixes #55101.

Change-Id: I7e06bfdc136ce124f65cdcf02d20a1050b841d42
Reviewed-on: https://go-review.googlesource.com/c/go/+/431455
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-09-19 18:47:00 +00:00
Tobias Klauser
d74bf73be0 os: use wait6 to avoid wait/kill race on netbsd
Resend of CL 315281 which was partially reverted by CL 354249 after the
original CL was suspected to cause test failures as reported in #48789.
It seems that both wait4 and wait6 lead to that particular deadlock, so
let's use wait6. That way we at least don't hit #13987 on netbsd.

Updates #13987
For #48789
For #50138

Change-Id: Iadc4a771217b7e9e821502e89afa07036e0dcb6f
Reviewed-on: https://go-review.googlesource.com/c/go/+/431855
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-19 18:44:37 +00:00
Keith Randall
e283473ebb cmd/compile: avoid using destination pointer base type in memmove optimization
The type of the source and destination of a memmove call isn't
always accurate. It will always be a pointer (or an unsafe.Pointer), but
the base type might not be accurate. This comes about because multiple
copies of a pointer with different base types are coalesced into a single value.

In the failing example, the IData selector of the input argument is a
*[32]byte in one branch of the type switch, and a *[]byte in the other branch.
During the expand_calls pass both IDatas become just copies of the input
register. Those copies are deduped and an arbitrary one wins (in this case,
*[]byte is the unfortunate winner).

Generally an op v can rely on v.Type during rewrite rules. But relying
on v.Args[i].Type is discouraged.

Fixes #55122

Change-Id: I348fd9accf2058a87cd191eec01d39cda612f120
Reviewed-on: https://go-review.googlesource.com/c/go/+/431496
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
2022-09-19 18:21:06 +00:00
cuiweixie
0053ec452d reflect: rtype.MethodByName using binary search
Change-Id: If36e9fd7d6b1993ca2d0d382e7fa52212170c798
Reviewed-on: https://go-review.googlesource.com/c/go/+/425481
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>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-19 17:55:13 +00:00
Damien Neil
e7312b1005 net/http: correctly test for leading header spaces in TestReadRequest_Bad
TestReadRequest_Bad's tests for leading whitespace in the first header
were also exercising the test verifying that a HEAD request has no
Content-Length. Also, the test intended to test a leading tab was
actually testing for a leading \t (literal backslash, literal t).

Change-Id: I05b46d05851b49bf75f1d1257c421b953b66ea9c
Reviewed-on: https://go-review.googlesource.com/c/go/+/428134
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2022-09-19 17:14:09 +00:00
Roger Peppe
d8e6ed3262 time: implement Compare method
Fixes #50770.

Change-Id: If0104883bb409ec85827fa5b570f68099ad4fd1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/382734
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: hopehook <hopehook@golangcn.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-09-19 17:10:49 +00:00
Zeke Lu
b6d5831caa debug/elf: validate shstrndx
Changes:

1. When e_shstrndx holds the value SHN_UNDEF (0), the file has no section
name string table. In this case, do not try to set section names .
2. e_shstrndx should point to an SHT_STRTAB section. If it does not, returns
an error.

Reference:
https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html

Updates #54967.

Change-Id: Ic8f228061d996fd7845dfa630719a1ba12d2bb60
GitHub-Last-Rev: aeb70ca8a0
GitHub-Pull-Request: golang/go#55001
Reviewed-on: https://go-review.googlesource.com/c/go/+/430155
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-19 17:01:22 +00:00
Michael Matloob
73c38f226e cmd/go: clear GOPATH from build context when importing from module
In module mode, we shouldn't handle packages under GOPATH any
differently from other packages. Clear GOPATH from the build context
before Importing to ensure that.

Fixes #37015.

Change-Id: I0203e25013716bca346fd4a67d80f1d05bbaea77
Reviewed-on: https://go-review.googlesource.com/c/go/+/412476
Reviewed-by: 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>
Run-TryBot: Bryan Mills <bcmills@google.com>
2022-09-19 17:01:15 +00:00
Sasha Melentyev
0857633f8b runtime/pprof: set labelMap length
Change-Id: If09094e72161f2c5da9102706781524e32f87782
GitHub-Last-Rev: 89949bc6ee
GitHub-Pull-Request: golang/go#54855
Reviewed-on: https://go-review.googlesource.com/c/go/+/428234
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: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-19 16:58:39 +00:00
Tobias Klauser
f4becf15bd internal/syscall/unix: reuse existing {Fstat,Open,Unlink}at on freebsd
Change-Id: I517e75faca18bf0fdcd4e6c837f50f824aa6348c
Reviewed-on: https://go-review.googlesource.com/c/go/+/431236
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-19 15:51:18 +00:00
Cuong Manh Le
fc1cddcfe9 Revert "runtime: treat SI_TKILL like SI_USER on Linux"
This reverts CL 431255.

Reason for revert: breaks darwin-arm and linux-noopt builders.

Change-Id: I29332b935cc1e35fa039af3d70465e496361fcc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/431715
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-09-19 13:56:07 +00:00
Cuong Manh Le
00bee6d9a4 cmd/compile/internal/typebits: relax alignment check
Now we have 8-byte alignment types on 32-bit system, so in some rare
case, e.g, generated wrapper for embedded interface, the function
argument may need more than 4 byte alignment. We could pad somehow, but
this is a rare case which makes it hard to ensure that we've got it right.

So relaxing the check for argument and return value region of the stack.

Fixes #54991

Change-Id: I34986e17a920254392a39439ad3dcb323da2ea8d
Reviewed-on: https://go-review.googlesource.com/c/go/+/431098
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2022-09-19 13:55:28 +00:00
Cuong Manh Le
638c9aad5f cmd/compile,sync: make accessing address of zero offset struct field inline cost 0
Accessing the address of something often needs the same (or even less)
number of instructions as accessing the content of the thing. That would
help us rolling back the hack of CL 429766 to lower sync atomic types
inline cost.

Compiled objects size increase a bit:

file      before    after     Δ       %
addr2line 3729827   3733958   +4131   +0.111%
api       5457224   5456267   -957    -0.018%
asm       4806486   4808993   +2507   +0.052%
buildid   2480271   2480562   +291    +0.012%
cgo       4593496   4593947   +451    +0.010%
compile   23906958  23910086  +3128   +0.013%
cover     4680870   4681461   +591    +0.013%
dist      3341333   3341692   +359    +0.011%
doc       3879927   3880409   +482    +0.012%
fix       3298081   3298979   +898    +0.027%
link      6500098   6499873   -225    -0.003%
nm        3654362   3656997   +2635   +0.072%
objdump   4108300   4108671   +371    +0.009%
pack      2255445   2256391   +946    +0.042%
pprof     14364561  14379475  +14914  +0.104%
test2json 2550942   2555333   +4391   +0.172%
trace     13573199  13578409  +5210   +0.038%
vet       7430923   7430094   -829    -0.011%
total     114612303 114651597 +39294  +0.034%

file                                                                     before    after     Δ       %
archive/tar.a                                                            905032    905560    +528    +0.058%
archive/zip.a                                                            853464    853916    +452    +0.053%
cmd/asm/internal/lex.a                                                   359388    367418    +8030   +2.234%
cmd/compile/internal/importer.a                                          947206    947734    +528    +0.056%
cmd/compile/internal/inline.a                                            563390    566828    +3438   +0.610%
cmd/compile/internal/types2.a                                            5761990   5764274   +2284   +0.040%
cmd/go/internal/cfg.a                                                    234892    235342    +450    +0.192%
cmd/go/internal/envcmd.a                                                 257166    257694    +528    +0.205%
cmd/go/internal/fix.a                                                    93522     94052     +530    +0.567%
cmd/go/internal/generate.a                                               201308    201838    +530    +0.263%
cmd/go/internal/get.a                                                    207862    208390    +528    +0.254%
cmd/go/internal/imports.a                                                230266    230794    +528    +0.229%
cmd/go/internal/list.a                                                   385044    386632    +1588   +0.412%
cmd/go/internal/load.a                                                   1164508   1165566   +1058   +0.091%
cmd/go/internal/modcmd.a                                                 627582    629168    +1586   +0.253%
cmd/go/internal/modfetch/codehost.a                                      1031962   1032490   +528    +0.051%
cmd/go/internal/modfetch.a                                               1289294   1289822   +528    +0.041%
cmd/go/internal/modget.a                                                 674566    675624    +1058   +0.157%
cmd/go/internal/modindex.a                                               935598    936576    +978    +0.105%
cmd/go/internal/modload.a                                                2640784   2642058   +1274   +0.048%
cmd/go/internal/par.a                                                    135858    136476    +618    +0.455%
cmd/go/internal/run.a                                                    127158    127688    +530    +0.417%
cmd/go/internal/search.a                                                 242918    243446    +528    +0.217%
cmd/go/internal/trace.a                                                  113216    113188    -28     -0.025%
cmd/go/internal/vcs.a                                                    517280    517810    +530    +0.102%
cmd/go/internal/work.a                                                   2389522   2390580   +1058   +0.044%
cmd/go/internal/workcmd.a                                                311118    311452    +334    +0.107%
cmd/vendor/github.com/google/pprof/internal/driver.a                     1714950   1715478   +528    +0.031%
cmd/vendor/golang.org/x/mod/sumdb.a                                      453840    454290    +450    +0.099%
cmd/vendor/golang.org/x/tools/go/analysis/internal/analysisflags.a       326162    326610    +448    +0.137%
cmd/vendor/golang.org/x/tools/go/analysis/internal/facts.a               302476    303006    +530    +0.175%
cmd/vendor/golang.org/x/tools/go/analysis/passes/asmdecl.a               366580    367030    +450    +0.123%
cmd/vendor/golang.org/x/tools/go/analysis/passes/assign.a                129556    130006    +450    +0.347%
cmd/vendor/golang.org/x/tools/go/analysis/passes/atomic.a                133466    133916    +450    +0.337%
cmd/vendor/golang.org/x/tools/go/analysis/passes/bools.a                 193558    194006    +448    +0.231%
cmd/vendor/golang.org/x/tools/go/analysis/passes/buildtag.a              177984    178434    +450    +0.253%
cmd/vendor/golang.org/x/tools/go/analysis/passes/cgocall.a               221226    221674    +448    +0.203%
cmd/vendor/golang.org/x/tools/go/analysis/passes/composite.a             168572    169022    +450    +0.267%
cmd/vendor/golang.org/x/tools/go/analysis/passes/copylock.a              227040    227490    +450    +0.198%
cmd/vendor/golang.org/x/tools/go/analysis/passes/ctrlflow.a              204650    205098    +448    +0.219%
cmd/vendor/golang.org/x/tools/go/analysis/passes/errorsas.a              138020    138468    +448    +0.325%
cmd/vendor/golang.org/x/tools/go/analysis/passes/framepointer.a          119030    119480    +450    +0.378%
cmd/vendor/golang.org/x/tools/go/analysis/passes/httpresponse.a          165006    165454    +448    +0.272%
cmd/vendor/golang.org/x/tools/go/analysis/passes/ifaceassert.a           180850    181300    +450    +0.249%
cmd/vendor/golang.org/x/tools/go/analysis/passes/inspect.a               103876    104326    +450    +0.433%
cmd/vendor/golang.org/x/tools/go/analysis/passes/internal/analysisutil.a 116070    116516    +446    +0.384%
cmd/vendor/golang.org/x/tools/go/analysis/passes/loopclosure.a           153068    153518    +450    +0.294%
cmd/vendor/golang.org/x/tools/go/analysis/passes/lostcancel.a            244936    245384    +448    +0.183%
cmd/vendor/golang.org/x/tools/go/analysis/passes/nilfunc.a               135720    136168    +448    +0.330%
cmd/vendor/golang.org/x/tools/go/analysis/passes/printf.a                527134    527584    +450    +0.085%
cmd/vendor/golang.org/x/tools/go/analysis/passes/shift.a                 172026    172476    +450    +0.262%
cmd/vendor/golang.org/x/tools/go/analysis/passes/sigchanyzer.a           151690    152138    +448    +0.295%
cmd/vendor/golang.org/x/tools/go/analysis/passes/stdmethods.a            187494    187944    +450    +0.240%
cmd/vendor/golang.org/x/tools/go/analysis/passes/stringintconv.a         164752    165200    +448    +0.272%
cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag.a             200144    200594    +450    +0.225%
cmd/vendor/golang.org/x/tools/go/analysis/passes/testinggoroutine.a      161146    161596    +450    +0.279%
cmd/vendor/golang.org/x/tools/go/analysis/passes/tests.a                 270252    270702    +450    +0.167%
cmd/vendor/golang.org/x/tools/go/analysis/passes/unmarshal.a             130646    131094    +448    +0.343%
cmd/vendor/golang.org/x/tools/go/analysis/passes/unreachable.a           182130    182580    +450    +0.247%
cmd/vendor/golang.org/x/tools/go/analysis/passes/unsafeptr.a             153646    154094    +448    +0.292%
cmd/vendor/golang.org/x/tools/go/analysis/passes/unusedresult.a          179800    180248    +448    +0.249%
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.a                  303838    304286    +448    +0.147%
cmd/vendor/golang.org/x/tools/go/analysis.a                              217930    218380    +450    +0.206%
cmd/vendor/golang.org/x/tools/go/ast/astutil.a                           539428    539874    +446    +0.083%
cmd/vendor/golang.org/x/tools/go/cfg.a                                   286820    287270    +450    +0.157%
cmd/vendor/golang.org/x/tools/go/types/objectpath.a                      236144    236674    +530    +0.224%
cmd/vendor/golang.org/x/tools/go/types/typeutil.a                        412728    413176    +448    +0.109%
cmd/vendor/golang.org/x/tools/internal/analysisinternal.a                223256    223704    +448    +0.201%
cmd/vendor/golang.org/x/tools/internal/typeparams.a                      419498    419946    +448    +0.107%
context.a                                                                210000    209972    -28     -0.013%
crypto/internal/boring/bcache.a                                          8652      8568      -84     -0.971%
crypto/tls.a                                                             3295282   3295202   -80     -0.002%
database/sql.a                                                           1365892   1365762   -130    -0.010%
encoding/base64.a                                                        131572    136228    +4656   +3.539%
encoding/binary.a                                                        452546    453076    +530    +0.117%
encoding/gob.a                                                           1690728   1691672   +944    +0.056%
encoding/json.a                                                          1198834   1199276   +442    +0.037%
encoding/xml.a                                                           1035784   1036314   +530    +0.051%
expvar.a                                                                 285282    285678    +396    +0.139%
go/ast.a                                                                 1175212   1175662   +450    +0.038%
go/build.a                                                               657802    658252    +450    +0.068%
go/doc.a                                                                 808002    808452    +450    +0.056%
go/format.a                                                              101378    101824    +446    +0.440%
go/importer.a                                                            101816    102266    +450    +0.442%
go/internal/gccgoimporter.a                                              593828    594358    +530    +0.089%
go/internal/gcimporter.a                                                 974178    974626    +448    +0.046%
go/internal/srcimporter.a                                                196600    197050    +450    +0.229%
go/parser.a                                                              1152502   1152946   +444    +0.039%
go/printer.a                                                             910744    911194    +450    +0.049%
go/token.a                                                               299624    299768    +144    +0.048%
go/types.a                                                               5763222   5766118   +2896   +0.050%
hash/crc32.a                                                             128130    128098    -32     -0.025%
internal/fuzz.a                                                          1058644   1059174   +530    +0.050%
internal/poll.a                                                          660412    660382    -30     -0.005%
internal/testenv.a                                                       212792    213320    +528    +0.248%
log/syslog.a                                                             128718    128654    -64     -0.050%
log.a                                                                    157330    157274    -56     -0.036%
mime.a                                                                   383058    383588    +530    +0.138%
net/http/httptest.a                                                      430550    431000    +450    +0.105%
net/http/pprof.a                                                         306918    307448    +530    +0.173%
net/http.a                                                               7413852   7414074   +222    +0.003%
net/internal/socktest.a                                                  258934    258900    -34     -0.013%
net/rpc/jsonrpc.a                                                        173158    172962    -196    -0.113%
net/rpc.a                                                                634464    634914    +450    +0.071%
net.a                                                                    3539574   3541348   +1774   +0.050%
os.a                                                                     891416    891390    -26     -0.003%
reflect.a                                                                3956224   3956666   +442    +0.011%
runtime/cgo.a                                                            187406    187852    +446    +0.238%
runtime/trace.a                                                          85720     85616     -104    -0.121%
runtime.a                                                                9357520   9371302   +13782  +0.147%
sync/atomic.a                                                            232512    232376    -136    -0.058%
sync.a                                                                   353112    355068    +1956   +0.554%
syscall.a                                                                1660308   1660222   -86     -0.005%
testing.a                                                                1399348   1399198   -150    -0.011%
text/template.a                                                          1384750   1384726   -24     -0.002%
total                                                                    265209524 265294628 +85104  +0.032%

Change-Id: I21114dcddeb4fc2c56e781ea2f6e732fe3da2b01
Reviewed-on: https://go-review.googlesource.com/c/go/+/431095
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-09-19 02:45:26 +00:00
Dan Kortschak
63d05642d4 debug/pe: be careful to avoid potential uint32 overflow
Change-Id: Ic3c1c972bec39e14ea1af50ab2b5d887dac29eab
Reviewed-on: https://go-review.googlesource.com/c/go/+/426114
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Dan Kortschak <dan@kortschak.io>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2022-09-18 01:17:32 +00:00
Joel Sing
a7bcc94719 cmd/compile: resolve known outcomes for SLTI/SLTIU on riscv64
When SLTI/SLTIU is used with ANDI/ORI, it may be possible to determine the
outcome based on the values of the immediates. Resolve these cases.

Improves code generation for various shift operations.

While here, sort tests by architecture to improve readability and ease
future maintenance.

Change-Id: I87e71e016a0e396a928e7d6389a2df61583dfd8d
Reviewed-on: https://go-review.googlesource.com/c/go/+/428217
Reviewed-by: Wayne Zuo <wdvxdr@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Run-TryBot: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
2022-09-17 17:17:52 +00:00
Michael Anthony Knyszek
cc1b20e8ad runtime/internal/sys: make Len64 nosplit
CL 427615 causes failures when Len64 can't be inlined. It's unclear to
me why this wasn't a problem before, but it is used in sensitive
contexts and therefore really should be marked. Confirmed that the
failures in question reproduce without this change, and don't reproduce
with it.

Fixes #55117.

Change-Id: Ic3aa96af1420cc0c39551908d83f954725c712f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/431058
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-17 02:56:51 +00:00
Cherry Mui
1c19c5602b cmd/dist: add old style build tags
If one (accidentally) uses Go 1.16 as bootstrap toolchain, we
want it to print the error

found packages main (build.go) and building_Go_requires_Go_1_17_or_later (notgo117.go)

But because some files lack old style build tags, Go 1.16 instead
prints

//go:build comment without // +build comment

Add the build tags to make the error message work.

Change-Id: Iaa9b3c12e71842bb40f8687b2fda2cc4cb15b113
Reviewed-on: https://go-review.googlesource.com/c/go/+/431057
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-17 02:56:44 +00:00
Ian Lance Taylor
7c87012f04 runtime: treat SI_TKILL like SI_USER on Linux
On Linux a signal sent using tgkill will have si_code == SI_TKILL,
not SI_USER. Treat the two cases the same. Add a Linux-specific test.

Change the test to use the C pause function rather than sleeping
for a second, as that achieves the same effect.

Change-Id: I2a36646aecabcab9ec42ed9a048b07c2ff0a3987
Reviewed-on: https://go-review.googlesource.com/c/go/+/431255
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-09-17 01:41:08 +00:00
Bryan C. Mills
a9ca741d31 net/http: deflake TestServerCancelsReadHeaderTimeoutWhenIdle
Return errors instead of calling t.Fatalf for timing-sensitive failure
modes. Scale the Sleep call to the timeout (so that it isn't too short
for the longer durations).

Fixes #54891.

Change-Id: I574e85e121becdda9ab8ee6bfd37c18a549d366d
Reviewed-on: https://go-review.googlesource.com/c/go/+/430955
Reviewed-by: Joel Sing <joel@sing.id.au>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-16 21:13:59 +00:00
Jakub Ciolek
2addbf3f2a cmd/compile: make isConstDelta compute delta for 8 and 16 bit arithmetic
Use the delta for computing min and max values. This elides a few bounds checks:

compilecmp linux/amd64:

regexp/syntax
regexp/syntax.Op.String 271 -> 249  (-8.12%)

compress/bzip2
compress/bzip2.(*reader).readBlock 2991 -> 2973  (-0.60%)

cmd/internal/objabi
cmd/internal/objabi.RelocType.String 240 -> 220  (-8.33%)

cmd/vendor/golang.org/x/arch/ppc64/ppc64asm
cmd/vendor/golang.org/x/arch/ppc64/ppc64asm.CondReg.String 421 -> 400  (-4.99%)
cmd/vendor/golang.org/x/arch/ppc64/ppc64asm.gnuArg changed
cmd/vendor/golang.org/x/arch/ppc64/ppc64asm.plan9Arg 1868 -> 1836  (-1.71%)

cmd/internal/objfile
cmd/internal/objfile.(*machoFile).symbols 1457 -> 1423  (-2.33%)
cmd/internal/objfile.loadPETable changed

cmd/internal/obj/wasm
cmd/internal/obj/wasm.assemble changed

cmd/internal/obj/ppc64
cmd/internal/obj/ppc64.type_vsrdbi changed
cmd/internal/obj/ppc64.type_vmsumcud changed

cmd/link/internal/loadpe
cmd/link/internal/loadpe.Load 10634 -> 10602  (-0.30%)
cmd/link/internal/loadpe.(*peLoaderState).readpesym changed

Change-Id: I439facd13e3d2695abadfe1d3f7faebfd0d7df74
Reviewed-on: https://go-review.googlesource.com/c/go/+/431237
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2022-09-16 20:49:24 +00:00
Mateusz Poliwczak
2d89bec2de net: set AD bit in DNS queries when trust-ad in resolv.conf
Fixes #51152

Change-Id: Ib366e733434b4bb60ac93e6e622d9ba50bfe4e26
GitHub-Last-Rev: e98220d62f
GitHub-Pull-Request: golang/go#54921
Reviewed-on: https://go-review.googlesource.com/c/go/+/428955
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-16 20:39:46 +00:00