1
0
mirror of https://github.com/golang/go synced 2024-11-13 19:50:21 -07:00
Commit Graph

55790 Commits

Author SHA1 Message Date
cuiweixie
2fedd335f0 cmd/go/internal/modindex: should omit comparison to bool constant
Change-Id: Iea75d0475e1cc8f794a7bae864c6ce0e6e33cb6c
Reviewed-on: https://go-review.googlesource.com/c/go/+/436698
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>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-29 23:48:48 +00:00
cuiweixie
1896eac57f cmd/go/internal/list: should omit comparison to bool constant
Change-Id: Ieef05be39bad1263eacedb33c2043ee83080f629
Reviewed-on: https://go-review.googlesource.com/c/go/+/436697
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: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-29 23:48:46 +00:00
cuiweixie
5613de9d47 cmd/go/internal/bug: use bytes.Contains
Change-Id: I982835eb0d051e48964fc4a66018514c7203dd0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/436696
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>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-29 23:48:45 +00:00
cuiweixie
679640aee8 cmd/cover: use io.SeekStart, io.SeekCurrent
Change-Id: Ie3b593f7f0c71334dc8c446d545bf441f2ae81f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/436695
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Than McIntosh <thanm@google.com>
2022-09-29 23:48:44 +00:00
cuiweixie
0582b7958e cmd/cover: remove unnecessary fmt.Sprintf
Change-Id: I892f17a8a6464d53dbf330a41439a81cb8873262
Reviewed-on: https://go-review.googlesource.com/c/go/+/436654
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
2022-09-29 23:48:42 +00:00
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