]> Cypherpunks repositories - gostls13.git/log
gostls13.git
2 years agocmd/internal/obj/x86: return comparison directly
cuiweixie [Thu, 29 Sep 2022 12:59:41 +0000 (20:59 +0800)]
cmd/internal/obj/x86: return comparison directly

Change-Id: I4b596b252c1785b13c4a166e9ef5f4ae812cd1bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/436704
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2 years agocmd/internal/obj: call delete directly without check exist
cuiweixie [Thu, 29 Sep 2022 12:52:42 +0000 (20:52 +0800)]
cmd/internal/obj: call delete directly without check exist

Change-Id: I5350c6374cd39ce4512d29cd8a341c4996f3b601
Reviewed-on: https://go-review.googlesource.com/c/go/+/436703
Reviewed-by: Ian Lance Taylor <iant@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: Dmitri Shuralyov <dmitshur@google.com>
2 years agocmd/internal/dwarf: remove redundant break statement
cuiweixie [Thu, 29 Sep 2022 12:50:36 +0000 (20:50 +0800)]
cmd/internal/dwarf: remove redundant break statement

Change-Id: I20956187e925ef6ab35d23b23c40bbb0ee55ef4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/436702
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

2 years agocmd/internal/cov: use io.SeekStart, io.SeekCurrent, and io.SeekEnd
cuiweixie [Thu, 29 Sep 2022 12:49:07 +0000 (20:49 +0800)]
cmd/internal/cov: use io.SeekStart, io.SeekCurrent, and io.SeekEnd

Change-Id: Ibf7e33e42c649783eaa0e638babff22d96ab51c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/436701
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: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2 years agocmd/go/internal/mvs: remove useless type assertion
cuiweixie [Thu, 29 Sep 2022 12:45:26 +0000 (20:45 +0800)]
cmd/go/internal/mvs: remove useless type assertion

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

2 years agocmd/go/internal/modindex: should omit comparison to bool constant
cuiweixie [Thu, 29 Sep 2022 12:40:44 +0000 (20:40 +0800)]
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>
2 years agocmd/go/internal/list: should omit comparison to bool constant
cuiweixie [Thu, 29 Sep 2022 12:38:13 +0000 (20:38 +0800)]
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>

2 years agocmd/go/internal/bug: use bytes.Contains
cuiweixie [Thu, 29 Sep 2022 12:35:12 +0000 (20:35 +0800)]
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>
2 years agocmd/cover: use io.SeekStart, io.SeekCurrent
cuiweixie [Thu, 29 Sep 2022 12:32:25 +0000 (20:32 +0800)]
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>

2 years agocmd/cover: remove unnecessary fmt.Sprintf
cuiweixie [Thu, 29 Sep 2022 12:29:41 +0000 (20:29 +0800)]
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>

2 years agocmd/compile/internal/ppc64: delete useless break
cuiweixie [Thu, 29 Sep 2022 12:12:10 +0000 (20:12 +0800)]
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>

2 years agointernal: use io.SeekStart, io.SeekCurrent, and io.SeekEnd
cuiweixie [Thu, 29 Sep 2022 13:46:56 +0000 (21:46 +0800)]
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>

2 years agointernal: use time.Since instead of time.Now().Sub
cuiweixie [Thu, 29 Sep 2022 13:45:51 +0000 (21:45 +0800)]
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>

2 years agocompress: remove useless break statement
cuiweixie [Thu, 29 Sep 2022 13:14:11 +0000 (21:14 +0800)]
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>

2 years agocmd/fix: use strings.Cut
cui fliter [Wed, 28 Sep 2022 08:47:08 +0000 (08:47 +0000)]
cmd/fix: use strings.Cut

Change-Id: Ibee86b4c5dc9a18df9bdc65b0ec8339ee1cac7a9
GitHub-Last-Rev: 336580707cd58f2c17ec4c686d54982417d1a4b4
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>

2 years agocmd: fix a few function names on comments
cui fliter [Thu, 29 Sep 2022 12:46:10 +0000 (12:46 +0000)]
cmd: fix a few function names on comments

Change-Id: Ia0896bd1edf2558821244fecd1c297b599472f47
GitHub-Last-Rev: cfd1e1091a064cdc38469c02c6c013635d7d437b
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>

2 years agocrypto: fix a few function names on comments
cui fliter [Thu, 29 Sep 2022 12:56:21 +0000 (12:56 +0000)]
crypto: fix a few function names on comments

Change-Id: I06f85f78c4c802142fc9207b100753decd568274
GitHub-Last-Rev: 4ad4c0f5e93df9ea83deb86b814167e661bba0ff
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>
2 years agoall: use strings.Builder where appropriate
hopehook [Wed, 28 Sep 2022 14:08:28 +0000 (22:08 +0800)]
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>

2 years agosync/atomic: rename "ifaceWords" to "efaceWords"
hopehook [Thu, 22 Sep 2022 15:10:31 +0000 (23:10 +0800)]
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>
2 years agosyscall: add support for freebsd/riscv64
Mikael Urankar [Sun, 18 Sep 2022 15:25:55 +0000 (17:25 +0200)]
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>

2 years agotesting: update description of Setenv
Nobuki Fujii [Fri, 23 Sep 2022 13:53:31 +0000 (22:53 +0900)]
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>
2 years agocmd/compile/internal/ir: delete unused code
cuiweixie [Thu, 29 Sep 2022 12:00:00 +0000 (20:00 +0800)]
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>

2 years agocmd/go: using strings.CutPrefix replace strings.HasPrefix and strings.TrimPrefix
cuiweixie [Tue, 27 Sep 2022 11:03:54 +0000 (19:03 +0800)]
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>

2 years agonet/http: using strings.CutPrefix replace strings.HasPrefix and strings.TrimPrefix
cuiweixie [Tue, 27 Sep 2022 08:06:13 +0000 (16:06 +0800)]
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>

2 years agocmd/compile: keep typecheck results in syntax tree
Keith Randall [Fri, 2 Sep 2022 21:11:09 +0000 (14:11 -0700)]
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>
2 years agobufio: use strings.Builder
cuiweixie [Wed, 28 Sep 2022 13:17:34 +0000 (21:17 +0800)]
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>

2 years agoarchive/zip: use strings.TrimPrefix
cuiweixie [Wed, 28 Sep 2022 13:13:41 +0000 (21:13 +0800)]
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>
2 years agonet/http: remove deadstore statement
cuiweixie [Wed, 28 Sep 2022 10:12:55 +0000 (18:12 +0800)]
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>

2 years agonet: delete unused code
cuiweixie [Wed, 28 Sep 2022 10:04:25 +0000 (18:04 +0800)]
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>
2 years agonet/http: use time.Compare
cuiweixie [Wed, 28 Sep 2022 00:23:21 +0000 (08:23 +0800)]
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>

2 years agodebug/elf: fix typo in R_PPC64_TPREL34 and R_PPC64_DTPREL34
Paul E. Murphy [Tue, 27 Sep 2022 18:21:52 +0000 (13:21 -0500)]
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>
2 years agogo/types, types2: use "generic" rather than "parameterized" in error messages
Robert Griesemer [Thu, 29 Sep 2022 18:18:09 +0000 (11:18 -0700)]
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>
2 years agocmd: add skips as needed to get tests to pass on js/wasm
Bryan C. Mills [Thu, 29 Sep 2022 18:56:26 +0000 (14:56 -0400)]
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>

2 years agoos/exec: avoid leaking a process in TestDoubleStartLeavesPipesOpen
Bryan C. Mills [Thu, 29 Sep 2022 13:33:07 +0000 (09:33 -0400)]
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>
2 years agoerrors, fmt: add support for wrapping multiple errors
Damien Neil [Thu, 22 Sep 2022 17:43:26 +0000 (10:43 -0700)]
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>
2 years agocmd/go/internal/lockedfile/internal/filelock: remove unused type token
Tobias Klauser [Thu, 29 Sep 2022 10:13:16 +0000 (12:13 +0200)]
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>
2 years agocmd/compile: limit goroutine count to parallelism
Russ Cox [Tue, 20 Sep 2022 01:48:10 +0000 (21:48 -0400)]
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>

2 years agocmd/{cover,go}: avoid use of os.PathListSeparator in cmd/cover flag
Than McIntosh [Thu, 29 Sep 2022 13:19:38 +0000 (09:19 -0400)]
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>

2 years agogo/types, types2: more concise error messages for cycle errors
Robert Griesemer [Wed, 28 Sep 2022 23:44:53 +0000 (16:44 -0700)]
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>

2 years agoruntime/coverage: apis to emit counter data under user control
Than McIntosh [Thu, 14 Apr 2022 19:44:20 +0000 (15:44 -0400)]
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>
2 years agocmd{cover,covdata,go}: better coverage for tests that build tools
Than McIntosh [Wed, 18 May 2022 22:48:56 +0000 (18:48 -0400)]
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>
2 years agoruntime/coverage: improve unit tests
Than McIntosh [Mon, 19 Sep 2022 18:55:09 +0000 (14:55 -0400)]
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>
2 years agocrypto: use fmt.Appendf
cuiweixie [Wed, 28 Sep 2022 02:44:32 +0000 (10:44 +0800)]
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>

2 years agocmd/nm: use print-style not printf-style
cuiweixie [Wed, 28 Sep 2022 13:38:31 +0000 (21:38 +0800)]
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>
2 years agocmd/cgo: use strings.TrimSuffix
cuiweixie [Wed, 28 Sep 2022 13:35:52 +0000 (21:35 +0800)]
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>

2 years agocmd/cgo: delete unused code
cuiweixie [Wed, 28 Sep 2022 13:34:01 +0000 (21:34 +0800)]
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>

2 years agocmd/cgo: use strings.Contains instead of strings.Index
cuiweixie [Wed, 28 Sep 2022 13:32:34 +0000 (21:32 +0800)]
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>

2 years agocmd/asm: use strings.TrimSuffix
cuiweixie [Wed, 28 Sep 2022 13:28:18 +0000 (21:28 +0800)]
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>
2 years agocmd/asm: delete unused func newAddr
cuiweixie [Wed, 28 Sep 2022 13:25:56 +0000 (21:25 +0800)]
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>

2 years agocmd/asm: optimize if statement to return directly
cuiweixie [Wed, 28 Sep 2022 13:24:10 +0000 (21:24 +0800)]
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>

2 years agocmd/asm: use opd.String() instead of fmt.Sprintf
cuiweixie [Wed, 28 Sep 2022 13:23:06 +0000 (21:23 +0800)]
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>

2 years agoos/exec: refactor goroutine error reporting
Bryan C. Mills [Wed, 28 Sep 2022 15:03:57 +0000 (11:03 -0400)]
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>

2 years agoos/exec: do not close pipes on a double-Start error
Bryan C. Mills [Wed, 28 Sep 2022 17:29:12 +0000 (13:29 -0400)]
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>

2 years agoencoding/gob: add top level security doc
Roland Shoemaker [Wed, 28 Sep 2022 21:41:30 +0000 (14:41 -0700)]
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>
2 years agogo/types, types2: consistently use "cause" instead of "reason" for error details...
Robert Griesemer [Wed, 28 Sep 2022 21:59:16 +0000 (14:59 -0700)]
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>
2 years agogo/types, types2: remove (C/c)ompilerErrorMessages flag - not needed anymore
Robert Griesemer [Wed, 28 Sep 2022 21:49:50 +0000 (14:49 -0700)]
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>

2 years agocmd/compile: use "shifted operand %s (type %s) must be integer" for some shift errors
Robert Griesemer [Wed, 28 Sep 2022 21:42:16 +0000 (14:42 -0700)]
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>

2 years agocmd/compile: use "cannot use %s as %s value in %s: %s" error message
Robert Griesemer [Wed, 28 Sep 2022 21:13:24 +0000 (14:13 -0700)]
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>

2 years agogo/types, types2: use "assignment mismatch: x variables but y values" error message
Robert Griesemer [Wed, 28 Sep 2022 20:20:40 +0000 (13:20 -0700)]
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>

2 years agogo/ast: record start and end of file in File.File{Start,End}
Alan Donovan [Fri, 2 Sep 2022 15:13:43 +0000 (11:13 -0400)]
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>
2 years agocmd/dist: test cmd module on js/wasm
Tobias Klauser [Wed, 28 Sep 2022 17:19:44 +0000 (19:19 +0200)]
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>

2 years agocmd/compile/internal/base: replace io/ioutil with os package
cui fliter [Wed, 28 Sep 2022 09:12:11 +0000 (09:12 +0000)]
cmd/compile/internal/base: replace io/ioutil with os package

Change-Id: Ide7618b65fcff7947809051d51b993d330e35717
GitHub-Last-Rev: 298853a82006655fe4f226cc5bea3bc21613b832
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>
2 years agotesting: fail if T.Setenv is called via T.Run in a parallel test
Nobuki Fujii [Sun, 18 Sep 2022 02:52:07 +0000 (11:52 +0900)]
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>

2 years agocmd/go: using strings.CutSuffix replace strings.HasSuffix and strings.TrimSuffix
cuiweixie [Tue, 27 Sep 2022 11:28:39 +0000 (19:28 +0800)]
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>

2 years agocmd/link/internal/loadelf: add additional relocations for riscv64
Joel Sing [Sat, 17 Sep 2022 16:32:42 +0000 (02:32 +1000)]
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>

2 years agoos/signal: disable GNU readline to deflake TestTerminalSignal
Zeke Lu [Wed, 28 Sep 2022 05:57:46 +0000 (05:57 +0000)]
os/signal: disable GNU readline to deflake TestTerminalSignal

Fixes #55903.

Change-Id: I992865277fb6526929d6c7db2b3b8d22ca0760f2
GitHub-Last-Rev: fc6f28e17c3d6c5f16f1cc047e42ac0ceb60e769
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>

2 years agocmd/internal/obj/ppc64: remove unnecessary opcodes
Archana R [Fri, 9 Sep 2022 16:22:55 +0000 (11:22 -0500)]
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>
2 years agoall: fix some typos
cui fliter [Wed, 28 Sep 2022 02:34:31 +0000 (02:34 +0000)]
all: fix some typos

Change-Id: I8b28aebbb9494b2c877139a4584a5a42253e3bea
GitHub-Last-Rev: e3703fd3a50b811785df75751472aa3ab098b3d1
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>
2 years agocmd/compile: remove some lines from PPC64.rules
Lynn Boger [Mon, 12 Sep 2022 22:07:00 +0000 (17:07 -0500)]
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>
2 years agocmd/go: support new hybrid coverage instrumentation
Than McIntosh [Mon, 11 Oct 2021 15:26:19 +0000 (11:26 -0400)]
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>
2 years agocmd/go: refactor package references in Builder.build
Than McIntosh [Wed, 17 Aug 2022 18:52:45 +0000 (14:52 -0400)]
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>

2 years agocmd/go: add hook to check for GOEXPERIMENT in script tests
Than McIntosh [Mon, 25 Apr 2022 14:09:47 +0000 (10:09 -0400)]
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>

2 years agocmd/cover: add hybrid instrumentation mode
Than McIntosh [Thu, 10 Mar 2022 20:06:43 +0000 (15:06 -0500)]
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>
2 years agoruntime/coverage: runtime routines to emit coverage data
Than McIntosh [Mon, 11 Oct 2021 11:34:20 +0000 (07:34 -0400)]
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>

2 years agocmd/covdata: add tools to read/manipulate coverage data files
Than McIntosh [Thu, 21 Oct 2021 14:57:23 +0000 (10:57 -0400)]
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>
2 years agogo/types, types2: use "invalid operation: x rel y (cause)" for comparison error messages
Robert Griesemer [Wed, 28 Sep 2022 03:07:30 +0000 (20:07 -0700)]
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>

2 years agotime: add comment explaining >>33 in Now
Ian Lance Taylor [Tue, 19 Jul 2022 22:09:21 +0000 (15:09 -0700)]
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>
2 years agocmd/nm, runtime/cgo: add cgo support for freebsd/riscv64
Mikael Urankar [Sun, 18 Sep 2022 15:29:36 +0000 (17:29 +0200)]
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>
2 years agocmd/dist: enable cgo tests on freebsd/riscv64
Mikael Urankar [Sun, 18 Sep 2022 15:46:54 +0000 (17:46 +0200)]
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>

2 years agocrypto: use bytes.Clone
cuiweixie [Tue, 27 Sep 2022 16:28:49 +0000 (00:28 +0800)]
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>

2 years agonet/textproto: use bytes.Clone
cuiweixie [Tue, 27 Sep 2022 16:31:44 +0000 (00:31 +0800)]
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>

2 years agointernal: use bytes.Clone
cuiweixie [Tue, 27 Sep 2022 16:29:48 +0000 (00:29 +0800)]
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>

2 years agoencoding/xml: use bytes.Clone
cuiweixie [Tue, 27 Sep 2022 16:29:30 +0000 (00:29 +0800)]
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>

2 years agoruntime: add support for freebsd/riscv64
Mikael Urankar [Sun, 18 Sep 2022 15:30:51 +0000 (17:30 +0200)]
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>
2 years agodatabase: use bytes.Clone
cuiweixie [Tue, 27 Sep 2022 16:29:14 +0000 (00:29 +0800)]
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>

2 years agocrypto/rsa,crypto/internal/boring: fix PSS salt handling
Roland Shoemaker [Thu, 1 Sep 2022 00:15:08 +0000 (17:15 -0700)]
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>

2 years agogo/types, types2: use 2nd operand position for comparison type mismatch errors
Robert Griesemer [Tue, 27 Sep 2022 22:23:42 +0000 (15:23 -0700)]
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>

2 years agodebug/elf: return error on reading from SHT_NOBITS sections
Zeke Lu [Tue, 27 Sep 2022 17:36:26 +0000 (17:36 +0000)]
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: 994c12d9da8c7029ce1d26eb1eb4d333ef3b1f97
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>
2 years agocrypto/x509: use unsafe.Slice
Ian Lance Taylor [Tue, 27 Sep 2022 16:38:17 +0000 (09:38 -0700)]
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>

2 years agocmd/compile: use "method T.m already declared" for method redeclaration errors
Robert Griesemer [Tue, 27 Sep 2022 04:27:20 +0000 (21:27 -0700)]
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>
2 years agogo/types, types2: use "unknown field f in struct literal of type S" in error messages
Robert Griesemer [Mon, 26 Sep 2022 19:47:41 +0000 (12:47 -0700)]
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>
2 years agogo/types, types2: use "multiple-value" instead "n-valued" in error messages
Robert Griesemer [Mon, 26 Sep 2022 18:47:22 +0000 (11:47 -0700)]
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>

2 years agogo/types, types2: uniformly use "cannot convert X to type T"
Robert Griesemer [Fri, 23 Sep 2022 03:45:53 +0000 (20:45 -0700)]
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>

2 years agogo/types, types2: use "and not used" instead of "but not used" in error messages
Robert Griesemer [Wed, 21 Sep 2022 21:25:34 +0000 (14:25 -0700)]
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>

2 years agocmd/compile: rework PPC64 Mul64uhilo lowering rules
Paul E. Murphy [Mon, 26 Sep 2022 20:26:05 +0000 (15:26 -0500)]
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>
2 years agocmd/compile: make a type-specialized copy of encoding/binary.ReadUvarint
David Chase [Tue, 27 Sep 2022 18:37:35 +0000 (14:37 -0400)]
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>
2 years agocmd/compile: introduce "temporary" readers for more storage reuse
David Chase [Fri, 23 Sep 2022 02:27:33 +0000 (22:27 -0400)]
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>
2 years agocmd/compile: use stricter rule for possible partial overlap
Keith Randall [Thu, 22 Sep 2022 21:09:21 +0000 (14:09 -0700)]
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>
2 years agogo/scanner: emit implicit semicolon tokens in correct order
Alan Donovan [Thu, 8 Sep 2022 21:25:46 +0000 (17:25 -0400)]
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>

2 years agobufio: use bytes.Clone
cuiweixie [Tue, 27 Sep 2022 15:26:26 +0000 (23:26 +0800)]
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>