-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
go/packages: add Target field and NeedTarget LoadMode bit
Adding the NeedTarget LoadMode bit will populate the Target field on a packages.Package with the Target from the driver. The Target field is populated with the install path to the .a file for libraries and the executable file for main packages. In module mode there usually isn't an install target for .a files (before Go 1.20, .a files for std were installed in $GOROOT/pkg, but Go 1.20 stopped installing them, though this behavior can be changed with the installgoroot GODEBUG setting). That means the target is primarily useful for main packages or in GOPATH mode. There isn't much additional work that needs to be done on the go command side to determine the target, if there will be one, once the name and files of the package are determined. One alternative to adding a NeedTarget bit would then be to reuse one of the previously existing bits to produce Target. But neither NeedFiles or NeedName's meanings are a good fit for Target so this CL adds a new bit. Fixes golang/go#38445 Change-Id: I718ec22ff1f82a672449c586b007398714b8c10e Reviewed-on: https://go-review.googlesource.com/c/tools/+/635778 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com>
- Loading branch information
Showing
4 changed files
with
64 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters