diff options
author | Daniel Martí <mvdan@mvdan.cc> | 2020-10-19 15:06:02 +0100 |
---|---|---|
committer | Daniel Martí <mvdan@mvdan.cc> | 2020-10-20 15:17:15 +0000 |
commit | 0bf507efe9f995076e3a65bcf61baf3e905b58c7 (patch) | |
tree | 99ff235e3462a307b0b65a31c3673d612fa40a07 /src/cmd/go/alldocs.go | |
parent | 0709e58bee0b268ee2a11629f44e352c41339443 (diff) | |
download | go-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/alldocs.go')
-rw-r--r-- | src/cmd/go/alldocs.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go index ebd786d4e2..0827f0c609 100644 --- a/src/cmd/go/alldocs.go +++ b/src/cmd/go/alldocs.go @@ -796,6 +796,7 @@ // BinaryOnly bool // binary-only package (no longer supported) // ForTest string // package is only for use in named test // Export string // file containing export data (when using -export) +// BuildID string // build ID of the export data (when using -export) // Module *Module // info about package's containing module, if any (can be nil) // Match []string // command-line patterns matching this package // DepOnly bool // package is only a dependency, not explicitly listed |