aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
AgeCommit message (Collapse)Author
2024-01-25all: prealloc slice with possible minimum capabilitiesShulhan
2024-01-24src/cmd/relnote, doc/next: add release note checkJonathan Amsterdam
Add a test that every file in api/next has corresponding release note fragments. Vendor in golang.org/x/build/relnote, which brings along some other things. Modify dist/test.go to configure the test to run on some trybots. For #64169. Change-Id: If87d11350ea6b2605bc3ab31c491fa28f1d6ee7d Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest Reviewed-on: https://go-review.googlesource.com/c/go/+/556995 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2024-01-24cmd/go: add GORISCV64 environment variableMark Ryan
The variable represents the RISC-V user-mode application profile for which to compile. Valid values are rva20u64 (the default) and rva22u64. Setting GORISCV64=rva20u64 defines the riscv64.rva20u64 build tag, sets the internal variable buildcfg.GORISCV64 to 20 and defines the macro GORISCV64_rva20u64 for use in assembly language code. Setting GORISCV64=rva22u64 defines the riscv64.rva20u64 and riscv64.rva22u64 build tags, sets the internal variable buildcfg.GORISCV64 to 22 and defines the macro GORISCV64_rva22u64 for use in assembly language code. This patch only provides a mechanism for the compiler and hand-coded assembly language functions to take advantage of the RISC-V extensions mandated by the application profiles. Further patches will be required to get the compiler/assembler and assembly language functions to actually generate and use these extensions. Fixes #61476 Change-Id: I9195ae6ee71703cd2112160e89157ab63b8391af Reviewed-on: https://go-review.googlesource.com/c/go/+/541135 Reviewed-by: M Zhuo <mengzhuo1203@gmail.com> Reviewed-by: Joel Sing <joel@sing.id.au> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Wang Yaduo <wangyaduo@linux.alibaba.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: M Zhuo <mengzhuo1203@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2024-01-23cmd/go/internal/str,cmd/go/internal/work: remove redundant Containsapocelipes
"cmd/go/internal/str.Contains" does the same thing as the "slices.Contains". The name "str.Contains" is also easily confused with "strings.Contains". Given that the slices package is already used in the package, replace "str.Contains" with "slices.Contains". "str.Contains" is no longer used so just remove it. Change-Id: I80572464bd17d4a60e7ff41db3a77c4d0bd03fa3 GitHub-Last-Rev: e74d333f0fd4b9558382e9dba0f77717089f45a9 GitHub-Pull-Request: golang/go#64136 Reviewed-on: https://go-review.googlesource.com/c/go/+/542416 Auto-Submit: Bryan Mills <bcmills@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com> Reviewed-by: Bryan Mills <bcmills@google.com>
2024-01-23net,internal/poll: load ws2_32.dll only when net is importedqmuntal
On Windows, ws2_32.dll is loaded and WSA initialized even if websockets are not used. This CL delays loading of ws2_32.dll and starting WSA until net is initialized. Change-Id: I07ea8241d79709cd4e80d29ba0d792c7444bbfe9 Reviewed-on: https://go-review.googlesource.com/c/go/+/557015 Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-23net: move cgo-using darwin test to separate packageRuss Cox
It is a goal / requirement that nothing in the standard library on darwin require cgo, and this test-only file makes net use cgo on darwin. Move it elsewhere. Change-Id: I6c11a8391d3913f73ce0098ba63b29adf5864f93 Reviewed-on: https://go-review.googlesource.com/c/go/+/549255 Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com> Reviewed-by: Bryan Mills <bcmills@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Russ Cox <rsc@golang.org>
2024-01-23cmd/go: add test case for issue 64738Russ Cox
The straight revert in CL 551215 fixed this issue. Add a test case to make sure we don't reintroduce it. Test case copied from CL 550237 (by bcmills). Fixes #64738. Change-Id: I9654a1fd46fe1a1cc63ee6645a552ec21d720ad0 Reviewed-on: https://go-review.googlesource.com/c/go/+/551255 Reviewed-by: Michael Matloob <matloob@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Bryan Mills <bcmills@google.com>
2024-01-23cmd/cgo/internal/test: skip TestCallbackCallersSEH when internal linkingqmuntal
TestCallbackCallersSEH is flaky when using the internal linker. Skip it for now until the flakiness is resolved. Updates #65116 Change-Id: I7628b07eaff8be00757d5604722f30aede25fce5 Reviewed-on: https://go-review.googlesource.com/c/go/+/556635 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-23cmd/compile/internal/ssagen,runtime: merge trace consts into internal/abiqiulaidongfeng
For #59670 Change-Id: Iec85ee7312bb566b3f1224424f7d27bf4e408b13 GitHub-Last-Rev: c620abf9673e166505821d75717e820776abc302 GitHub-Pull-Request: golang/go#64905 Reviewed-on: https://go-review.googlesource.com/c/go/+/553295 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2024-01-23cmd/compile: use MapMaxKeyBytes,MapMaxElemBytes,MapBucketCount of internal/abiqiulaidongfeng
For #59670 Change-Id: I651e211650e69989c598ab16202105bc6e68d67e GitHub-Last-Rev: fba087a35fa563cba0dc5f70e8c9d9108dc1f1d4 GitHub-Pull-Request: golang/go#64776 Reviewed-on: https://go-review.googlesource.com/c/go/+/550615 Reviewed-by: Keith Randall <khr@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-23cmd/compile: improve integer comparisons with numeric boundsJorropo
This do: - Fold always false or always true comparisons for ints and uint. - Reduce < and <= where the true set is only one value to == with such value. Change-Id: Ie9e3f70efd1845bef62db56543f051a50ad2532e Reviewed-on: https://go-review.googlesource.com/c/go/+/555135 Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-22Revert "cmd/preprofile: Add preprocess tool to pre-parse the profile file."Michael Pratt
This reverts CL 529738. Reason for revert: Breaking longtest builders For #58102. Fixes #65220. Change-Id: Id295e3249da9d82f6a9e4fc571760302a1362def Reviewed-on: https://go-review.googlesource.com/c/go/+/557460 Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-22cmd/preprofile: Add preprocess tool to pre-parse the profile file.Jin Lin
The pgo compilation time is very long if the profile file is large. We added a preprocess tool to pre-parse profile file in order to expedite the compile time. Change-Id: I6f50bbd01f242448e2463607a9b63483c6ca9a12 Reviewed-on: https://go-review.googlesource.com/c/go/+/529738 Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-01-22all: update vendored dependenciesCherry Mui
The Go 1.23 development tree has opened. This is a time to update all golang.org/x/... module versions that contribute packages to the std and cmd modules in the standard library to latest master versions. Generated with: go install golang.org/x/build/cmd/updatestd@latest go install golang.org/x/tools/cmd/bundle@latest updatestd -goroot=$(pwd) -branch=master For #36905. Change-Id: I46a68f27a54f1e3f9e1aa5af4de6ee0b26388f3f Reviewed-on: https://go-review.googlesource.com/c/go/+/557457 Reviewed-by: Carlos Amedee <carlos@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-22cmd/compile: fix typo in commentRulin Tang
Change-Id: Ie3f1f194489dd4cfd995bfaf292e1c311b37597b GitHub-Last-Rev: 6a363297785187188923a76456b468ef1bc1a656 GitHub-Pull-Request: golang/go#65008 Reviewed-on: https://go-review.googlesource.com/c/go/+/554136 Reviewed-by: Roland Shoemaker <roland@golang.org> Reviewed-by: Peter Weinberger <pjw@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Bypass: Robert Griesemer <gri@google.com>
2024-01-22cmd/compile/internal/ssa: fix typo in sccpWingrez
Change-Id: I7f522a4e1b0c50a469ce948249342d6e7cf7777c GitHub-Last-Rev: f89d7ee576814c6ebde823b68a0b64bba8c2ad8f GitHub-Pull-Request: golang/go#65188 Reviewed-on: https://go-review.googlesource.com/c/go/+/557255 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-22cmd/link,runtime: merge minfunc const info internal/abiqiulaidongfeng
For #59670 Change-Id: If2b05b1ba30b607b518577b0e11ba5a0b07999c5 GitHub-Last-Rev: a664aa18b5ef674dc2d05c1f7533e1974d265894 GitHub-Pull-Request: golang/go#64906 Reviewed-on: https://go-review.googlesource.com/c/go/+/553276 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2024-01-22go/types, types2: typeparams.IndexExpr must not be an ast.ExprRob Findley
The typeparams.IndexExpr wrapper type was added as a compatibility layer to make the go/types code symmetric with types2. However, this type incidentally implemented the ast.Expr interface, leading to the accidental misuse that led to golang/go#63933. Fix this minimally for now, though leave a TODO that this old compatibility shim really needs to be eliminated. Also fix a case in types2 where operand.expr was set to a typed nil. Fixes golang/go#63933 Change-Id: I180d411e52f795a8322ecce6ed8649e88af1c63b Reviewed-on: https://go-review.googlesource.com/c/go/+/554395 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-19cmd/trace/v2: emit user log annotations in all viewsMichael Anthony Knyszek
This was an oversight in porting over cmd/trace to the new trace format and API. Fixes #65153. Change-Id: I883d302f95956fcc9abb60aa53165acb6d099d67 Reviewed-on: https://go-review.googlesource.com/c/go/+/557175 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
2024-01-18cmd/go/internal/modfetch: set protocol.version=2 for shallow git fetchesBryan C. Mills
This works around an apparent bug in the Git HTTP backend, introduced in Git 2.21, that causes responses for the version 1 protocol to provide incomplete tags. For Git commands older than 2.18, this configuration flag is ignored. (Note that Git 2.29 and above already use protocol version 2 by default.) Fixes #56881. Change-Id: I9b241cfb604e5f633ca6a5d799df6706246684a7 Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest Reviewed-on: https://go-review.googlesource.com/c/go/+/556358 Run-TryBot: Bryan Mills <bcmills@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org>
2024-01-18go/types, types2: fix range clause checks for constant range expressionsRobert Griesemer
Add missing checks for the case where the range expression is a (possibly untyped) constant integer expression. Add context parameter to assignVar for better error message where the expression is part of a range clause. Also, rename s/expr/Expr/ where it denotes an AST expression, for clarity. Fixes #65133. For #65137. Change-Id: I72962d76741abe79f613e251f7b060e99261d3ae Reviewed-on: https://go-review.googlesource.com/c/go/+/556398 Run-TryBot: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
2024-01-17cmd/compile: call types2.Unalias to be ready for GODEBUG=gotypesalias=1Robert Griesemer
types2.Unalias is not needed if we know we have a core or underlying type. Also, types of declared functions (signatures) cannot be aliases (this includes tuples). Fixes #65125. Change-Id: I1faa26b66f6c646719e830dd661136fae86f3775 Reviewed-on: https://go-review.googlesource.com/c/go/+/556036 Run-TryBot: Robert Griesemer <gri@google.com> Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.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>
2024-01-11go/types, types2: don't lose position info of interface embeddingsRobert Griesemer
Accurate position information for embedded types in interfaces is crucial to identify the corresponding source file, and with that the Go language version associated with that file. (The position information is also important for proper error messages.) Before this CL, the position information for embedded types was discarded after type set computation, in the assumption that it was not needed anymore. However, substitutions that update the interface may lead to repeated type set computations which then won't have the correct position information. This CL does preserve the position information for embedded types until the end of type checking (cleanup phase), and also copy the position information during a substitution of the interface. The respective bug (#64759) doesn't seem to appear in 1.22 (most likely because it's hidden by some of the changes made with respect to the file version logic), but the existing code is still wrong. The backport of this code to 1.21 and 1.20 fixes the issue in those releases. For #64759. Change-Id: I80f4004c9d79cb02eac6739c324c477706615102 Reviewed-on: https://go-review.googlesource.com/c/go/+/555296 Run-TryBot: Robert Griesemer <gri@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
2024-01-11cmd/compile: document go:wasmimport directiveMauri de Souza Meneguzzo
Fixes #64972 Change-Id: I784a8728afbdef9736681d56f0a79c82a00609d6 GitHub-Last-Rev: bf158dbeaaa495dc258c590c7a21cf9e25e76ee7 GitHub-Pull-Request: golang/go#64991 Reviewed-on: https://go-review.googlesource.com/c/go/+/554455 Reviewed-by: Achille Roussel <achille.roussel@gmail.com> Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Austin Clements <austin@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2024-01-10cmd/compile: use hashed symbol name for go.shape types if too longThan McIntosh
Shape-based stenciling in the Go compiler's generic instantiation phase looks up shape types using the underlying type of a given target type. This has a beneficial effect in most cases (e.g. we can use the same shape type for two different named types whose underlying type is "int"), but causes some problems when the underlying type is a very large structure. The link string for the underlying type of a large imported struct can be extremely long, since the link string essentially enumerates the full package path for every field type; this can produce a "go.shape.struct { ... " symbol name that is absurdly long. This patch switches the compiler to use a hash of the underlying type link string instead of the string itself, which should continue to provide commoning but keep symbol name lengths reasonable for shape types based on large imported structs. Fixes #65030. Change-Id: I87d602626c43172beb99c186b8ef72327b8227a2 Reviewed-on: https://go-review.googlesource.com/c/go/+/554975 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Than McIntosh <thanm@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2024-01-08cmd/doc: fix inconsistent receiver nameMehdi Mostafavi
The ToText method of Package is the only one with a receiver declared 'p'; all the rest have 'pkg'. Fix it to be consistent. Change-Id: I2b47c719f4f6f8d87336316b7f80deb1b49e17dc GitHub-Last-Rev: 7d273b4ef0780b7ed8b651c117a28b25bab5bcb1 GitHub-Pull-Request: golang/go#64912 Reviewed-on: https://go-review.googlesource.com/c/go/+/553335 Run-TryBot: Rob Pike <r@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: qiulaidongfeng <2645477756@qq.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2024-01-08cmd/compile: handle defined iter func type correctlyCuong Manh Le
Fixed #64930 Change-Id: I916de7f97116fb20cb2f3f0b425ac34409afd494 Reviewed-on: https://go-review.googlesource.com/c/go/+/553436 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2024-01-05cmd/go: run cover tool before swigThan McIntosh
When building a package, run the cover tool on the collected go/cgo source files before invoking swig (if swig files are present), as opposed to running swig and then cover. Running swig adds new Go files to the "cgo" list, and we want to avoid running those newly generated files through the cover tool. Fixes #64661. Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest Change-Id: I32b6dad5c39fcf5e656c40fb3b44220c69320889 Reviewed-on: https://go-review.googlesource.com/c/go/+/552095 Auto-Submit: Than McIntosh <thanm@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-01-04cmd/api: fix panic on exported basic type aliasesDevon H. O'Dell
The order of emitting named type and type aliases in the `Walker`'s `emitType` function is inverted. When the type alias references a basic type, this causes a panic as the type assertion on `*types.Named` fails. This change reorders the logic such that type aliases are emitted prior to this type assertion. Fixes #64958 Change-Id: I52dbe13999978912ded788d9cf4948103869bcfa Reviewed-on: https://go-review.googlesource.com/c/go/+/554076 Reviewed-by: Bryan Mills <bcmills@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Bryan Mills <bcmills@google.com>
2023-12-21cmd/compile: handle constant-folding of an out-of-range jump table indexKeith Randall
The input index to a jump table can be out of range for unreachable code. Dynamically the compiler ensures that an out-of-range index can never reach a jump table, but that guarantee doesn't extend to the static realm. Fixes #64826 Change-Id: I5829f3933ae5124ffad8337dfd7dd75e67a8ec33 Reviewed-on: https://go-review.googlesource.com/c/go/+/552055 Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
2023-12-19doc/go1.22,cmd/go: document that 'go mod init' no longer imports from other ↵Bryan C. Mills
vendoring tools This support was removed in CL 518776. For #61422. Fixes #53327. Change-Id: I8ad0f76aed5f03e32c4c2c5c0001c3f06beb3c7d Reviewed-on: https://go-review.googlesource.com/c/go/+/548877 Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-12-19cmd/go/internal/toolchain: revert "make a best effort to parse 'go run' and ↵Russ Cox
'go install' flags" This caused other problems, and for the purposes of the Go 1.22 release, we can just roll back to the Go 1.21 behavior and then decide in January what the correct path forward is. Revert of CL 546635. Unfixes #64282. Fixes #64738. For #57001. This reverts commit e44b8b15b19058b7a22a859ab4159f924856f688. Change-Id: I78753c76dcd0bc6dbc90caa17f73248c42e5f64a Reviewed-on: https://go-review.googlesource.com/c/go/+/551215 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Than McIntosh <thanm@google.com>
2023-12-19cmd/compile: remove interfacecycles debug flagRobert Griesemer
Per the discussion on the issue, since no problems related to this appeared since Go 1.20, remove the ability to disable the check for anonymous interface cycles permanently. Adjust various tests accordingly. For #56103. Change-Id: Ica2b28752dca08934bbbc163a9b062ae1eb2a834 Reviewed-on: https://go-review.googlesource.com/c/go/+/550896 Run-TryBot: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2023-12-18Revert "cmd/cgo/internal/testsanitizers: fix msan test failing with clang >= 16"Than McIntosh
This reverts commit https://go.dev/cl/c/go/+/549297 Reason for revert: breaks clang builder Change-Id: I2321dec9bc1fc20dfafa8a984303b0b5710f8aac Reviewed-on: https://go-review.googlesource.com/c/go/+/550779 Auto-Submit: Than McIntosh <thanm@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2023-12-18cmd: go get golang.org/x/tools@83bceaf2 and revendorTim King
go get golang.org/x/tools@83bceaf2 # CL 550395 go mod tidy go mod vendor Fixes #64786 Change-Id: Ia9879975eb3e8e4130ded7b2d8ba1277b5811eec Reviewed-on: https://go-review.googlesource.com/c/go/+/550895 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Tim King <taking@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-12-18cmd/link/internal/loadpe: update comment about @feat.00 symbol handlingqmuntal
The @feat.00 comment is outdated, as Go does support SEH on windows/amd64. While here, simplify it and add a link to the relevant documentation. Change-Id: I6e3c786ca4f4809baf46015edf569d06b12f1239 Reviewed-on: https://go-review.googlesource.com/c/go/+/550635 Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Quim Muntal <quimmuntal@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-12-18cmd/cgo/internal/testsanitizers: fix msan test failing with clang >= 16Mauri de Souza Meneguzzo
Clang 16 introduced a more aggressive behavior regarding uninitialized memory in the memory sanitizer. The new option -fsanitize-memory-param-retval is enabled by default and makes the test msan8 fail, since it uses an uninitialized variable on purpose. Disable this behavior if we are running with clang 16+. Fixes #64616 Change-Id: If366f978bef984ea73f6ae958f24c8fce99b59fe GitHub-Last-Rev: 60bd64a8fb24a552fce23fb2b43a75e92443e039 GitHub-Pull-Request: golang/go#64691 Reviewed-on: https://go-review.googlesource.com/c/go/+/549297 Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Than McIntosh <thanm@google.com>
2023-12-15all: fix copyright headersJes Cok
Change-Id: Ib16986fb088030b93140e48c17e3d7bb2c9312cf GitHub-Last-Rev: 41572879f8f45c963c0e3ab9862bc0de59781a13 GitHub-Pull-Request: golang/go#64731 Reviewed-on: https://go-review.googlesource.com/c/go/+/549956 Run-TryBot: Jes Cok <xigua67damn@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
2023-12-15cmd/asm: for arm, rewrite argument shifted right by 0 to left by 0.Keith Randall
Right shift by 0 has bad semantics. Make sure if we try to right shift by 0, do a left shift by 0 instead. CL 549955 handled full instructions with this strange no-op encoding. This CL handles the shift done to instruction register inputs. (The former is implemented using the latter, but not until deep inside the assembler.) Update #64715 Change-Id: Ibfabb4b13e2595551e58b977162fe005aaaa0ad1 Reviewed-on: https://go-review.googlesource.com/c/go/+/550335 Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com>
2023-12-15cmd/asm: fix encoding for arm right shift by constant 0Keith Randall
Right shifts, for some odd reasons, can encode shifts of constant 1-32 instead of 0-31. Left shifts, however, can encode shifts 0-31. When the shift amount is 0, arm recommends encoding right shifts using left shifts. Fixes #64715 Change-Id: Id3825349aa7195028037893dfe01fa0e405eaa51 Reviewed-on: https://go-review.googlesource.com/c/go/+/549955 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com>
2023-12-14cmd/go/internal/toolchain: make a best effort to parse 'go run' and 'go ↵Bryan C. Mills
install' flags When the argument to 'go install' or 'go run' looks like a versioned package, we make a best effort to switch to a toolchain compatible with the module containing that package, by fetching its go.mod file and checking the go version it specifies. At this point in the code, we have not yet parsed the arguments given on the command line: instead, we just make a best effort to find one we can use to select a toolchain version. Since that toolchain may be newer, the command to install it may also include flags that are only supported by that Go version — and we don't want to fail due to an error that would be resolved by switching to a more appropriate toolchain. So at this point in the code we can't parse the flags in a way that will surface errors, but we want to make a best effort to parse the ones that we know about. It turns out that “parse the flags we know about” is already a familiar problem: that's also what we do in 'go test', so we can reuse the cmdflag library from that to do the best-effort pass of parsing. If it turns out that we don't need to switch toolchains after all, cmd/go's main function will parse the flags again, and will report any errors at that point. This fixes a regression, introduced in CL 497879, which caused 'go install -modcacherw pkg@version' to unset the write bit for directories created while selecting the toolchain to use. Fixes #64282. Updates #57001. Change-Id: Icc409c57858aa15c7d58a97a61964b4bc2560547 Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest Reviewed-on: https://go-review.googlesource.com/c/go/+/546635 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Michael Matloob <matloob@golang.org>
2023-12-14cmd/go/internal/modfetch: simplify a redundant conditionBryan C. Mills
In gitRepo.stat, we were checking ref != "" twice, which confused me during casual reading because it made it seem like the string could be empty when it actually never is. For #56881. Change-Id: Ib83303a149ea771399cb55fedd5dfa02ad411ff0 Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest Reviewed-on: https://go-review.googlesource.com/c/go/+/549855 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Michael Matloob <matloob@golang.org>
2023-12-14cmd/go/internal/vcweb: set GIT_PROTOCOL in the git CGI handlerBryan C. Mills
This works around a bug in 'git http-backend' that was fixed in Git 2.34.0,¹ and will hopefully allow the tests in cmd/go/internal/modfetch/codehost to pass reliably using older Git releases (I tested with 2.30.2). ¹https://github.com/git/git/commit/ff6a37c99e3343633c53f56789afcc8f8165d276 Fixes #56881. Change-Id: Icd2e4d252d5f712685d146f34e11922dd0c41ff0 Reviewed-on: https://go-review.googlesource.com/c/go/+/549795 Reviewed-by: Michael Matloob <matloob@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com>
2023-12-14all: remove newline characters after return statementsDanil Timerbulatov
This commit is aimed at improving the readability and consistency of the code base. Extraneous newline characters were present after some return statements, creating unnecessary separation in the code. Fixes #64610 Change-Id: Ic1b05bf11761c4dff22691c2f1c3755f66d341f7 Reviewed-on: https://go-review.googlesource.com/c/go/+/548316 Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-12-13go/types, types2: report error for range over int if Go version < 1.22Robert Griesemer
Fixes #64704. Change-Id: Ied3af46ab534343cdafba5ee27680b9c6ef3d37a Reviewed-on: https://go-review.googlesource.com/c/go/+/549459 Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Run-TryBot: Robert Griesemer <gri@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-12-13go/types, types2: better error message when missing method is unexportedRobert Griesemer
Change lookupMethod such that "foldCase" means "ignore case and package" and analyze a lookup result further to determine if a method name was not exported, and report a better error message in that case. Fixes #59831. Change-Id: Ice6222e1fc00dba13caeda6c48971e8473d12da5 Reviewed-on: https://go-review.googlesource.com/c/go/+/549298 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> Reviewed-by: Robert Griesemer <gri@google.com>
2023-12-13go/types, types2: avoid confusing error message "have m(T), want m(T)"Robert Griesemer
This is a partial fix for situations where a method lookup leads to an error due to non-matching signatures, but where the signatures print exactly the same. This can happen if both signatures contain type parameters (after instantiation) and the type parameters have the same name (such as "T"). For now, rather than printing a confusing error message in this case, leave away the confusing part of the error message (at the cost of providing slightly less information). In the long run, we need to find a better solution for this problem; but this seems better than what we had before. For #61685. Change-Id: I259183f08b9db400ffc8e1cf447967c640a0f444 Reviewed-on: https://go-review.googlesource.com/c/go/+/549296 Reviewed-by: Robert Griesemer <gri@google.com> Run-TryBot: 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>
2023-12-12cmd/cgo/internal/testsanitizers: check for go build and cgo in fuzzer and ↵Mauri de Souza Meneguzzo
msan tests Make sure the platform we are running the tests on can compile programs and has cgo support in order to run the fuzzer and msan tests. This is the same approach used by the asan tests, which share the same requirements. Fixes #64626 Change-Id: I7c0b912dabdd1b7d7d44437e4ade5e5994994796 GitHub-Last-Rev: 9fae6970f0f3b32a24893ef32fc4b38fa5a2a96d GitHub-Pull-Request: golang/go#64640 Reviewed-on: https://go-review.googlesource.com/c/go/+/548715 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Bryan Mills <bcmills@google.com>
2023-12-12go/types, types2: flip message contents for reverse type inference errorsRobert Griesemer
Add a new flag 'reverse' to control the formatting of type inference error messages. This change only impacts error messages. Fixes #60747. Change-Id: I81e13075e3157252ccc09f358bd29bd676c34499 Reviewed-on: https://go-review.googlesource.com/c/go/+/549055 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> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-12-12go/types, types2: better error message for cases of reverse type inferenceRobert Griesemer
Introduce a new type "target" to pass around target types together with a suitable description (typically a variable name) for a better error message. As a side effect, using a specific type (target), rather than just Type avoids accidental confusion with other types. Use the target type description for a better error message in some cases. The error message can be further improved by flipping the order of the sentence (for another CL to keep this one small and simple). Also, and unrelated to this fix, remove the first argument to errorf in infer.go: the argument is always "type" (there's only one call). For #60747. Change-Id: I2118d0fe9e2b4aac959371941064e0e9ca7b3b6e Reviewed-on: https://go-review.googlesource.com/c/go/+/548995 Auto-Submit: Robert Griesemer <gri@google.com> 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>