aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/load/pkg.go
diff options
context:
space:
mode:
authorDaniel Martí <mvdan@mvdan.cc>2020-10-19 15:06:02 +0100
committerDaniel Martí <mvdan@mvdan.cc>2020-10-20 15:17:15 +0000
commit0bf507efe9f995076e3a65bcf61baf3e905b58c7 (patch)
tree99ff235e3462a307b0b65a31c3673d612fa40a07 /src/cmd/go/internal/load/pkg.go
parent0709e58bee0b268ee2a11629f44e352c41339443 (diff)
downloadgo-0bf507efe9f995076e3a65bcf61baf3e905b58c7.tar.gz
go-0bf507efe9f995076e3a65bcf61baf3e905b58c7.zip
cmd/go: add BuildID to list -json -export
That is, the following two pieces of shell code are now equivalent: $ go tool buildid $(go list -export -f {{.Export}} strings) v_0VqA6yzwuMg2dn4u57/PXcIR2Pb8Mi9yRdcdkwe $ go list -export -f {{.BuildID}} strings v_0VqA6yzwuMg2dn4u57/PXcIR2Pb8Mi9yRdcdkwe This does not expose any information that wasn't available before, but makes this workflow simpler and faster. In the first example, we have to execute two programs, and 'go tool buildid' has to re-open the export data file to read the build ID. With the new mechanism, 'go list -export' already has the build ID ready, so we can simply print it out. Moreover, when listing lots of related packages like './...', we can now obtain all their build IDs at once. Fixes #37281. Change-Id: I8e2f65a08391b3df1a628c6e06e708b8c8cb7865 Reviewed-on: https://go-review.googlesource.com/c/go/+/263542 Trust: Daniel Martí <mvdan@mvdan.cc> Trust: Bryan C. Mills <bcmills@google.com> Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src/cmd/go/internal/load/pkg.go')
-rw-r--r--src/cmd/go/internal/load/pkg.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/cmd/go/internal/load/pkg.go b/src/cmd/go/internal/load/pkg.go
index 066ff6c981..913b3b94d7 100644
--- a/src/cmd/go/internal/load/pkg.go
+++ b/src/cmd/go/internal/load/pkg.go
@@ -60,6 +60,7 @@ type PackagePublic struct {
ConflictDir string `json:",omitempty"` // Dir is hidden by this other directory
ForTest string `json:",omitempty"` // package is only for use in named test
Export string `json:",omitempty"` // file containing export data (set by go list -export)
+ BuildID string `json:",omitempty"` // build ID of the export data (set by go list -export)
Module *modinfo.ModulePublic `json:",omitempty"` // info about package's module, if any
Match []string `json:",omitempty"` // command-line patterns matching this package
Goroot bool `json:",omitempty"` // is this package found in the Go root?