Before this change, go get didn't have support for the work pattern. The work pattern is new in Go 1.25 and evaluates to the packages in the work (also called main) modules. 'go get work' would cause a panic because 'work' would be incorrectly considered a path pattern and then queryPath would would try to query a metapackage pattern (resulting in the internal error panic). This change properly supports the work pattern in go get. It's pretty simple: First, we need to seprate the work pattern from the other patterns. Then in performWorkQueries, which maps queries to the modules that satisfy them, we return the single main module because by definition the work pattern is the set of packages in the work modules, and go get always runs in single module mode. (The exception is when the work module contains no packages, in which case we report a warning, and return no candidates because nothing is needed to resolve nothing). The rest of the work is already done by loading the packages matching the query and finding missing imports in the call to findAndUpgradeImports in runGet. Change-Id: I3c4610878b3d930a1d106cc59d9a0be194d966cd Reviewed-on: https://go-review.googlesource.com/c/go/+/675895 Reviewed-by: Michael Matloob <matloob@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> |
||
|---|---|---|
| .github | ||
| api | ||
| doc | ||
| lib | ||
| misc | ||
| src | ||
| test | ||
| .gitattributes | ||
| .gitignore | ||
| CONTRIBUTING.md | ||
| LICENSE | ||
| PATENTS | ||
| README.md | ||
| SECURITY.md | ||
| codereview.cfg | ||
| go.env | ||
README.md
The Go Programming Language
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Gopher image by Renee French, licensed under Creative Commons 4.0 Attribution license.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
Download and Install
Binary Distributions
Official binary distributions are available at https://go.dev/dl/.
After downloading a binary release, visit https://go.dev/doc/install for installation instructions.
Install From Source
If a binary distribution is not available for your combination of operating system and architecture, visit https://go.dev/doc/install/source for source installation instructions.
Contributing
Go is the work of thousands of contributors. We appreciate your help!
To contribute, please read the contribution guidelines at https://go.dev/doc/contribute.
Note that the Go project uses the issue tracker for bug reports and proposals only. See https://go.dev/wiki/Questions for a list of places to ask questions about the Go language.