]> Cypherpunks repositories - gostls13.git/commit
cmd/go: add BuildID to list -json -export
authorDaniel Martí <mvdan@mvdan.cc>
Mon, 19 Oct 2020 14:06:02 +0000 (15:06 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Tue, 20 Oct 2020 15:17:15 +0000 (15:17 +0000)
commit0bf507efe9f995076e3a65bcf61baf3e905b58c7
tree99ff235e3462a307b0b65a31c3673d612fa40a07
parent0709e58bee0b268ee2a11629f44e352c41339443
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>
src/cmd/go/alldocs.go
src/cmd/go/go_test.go
src/cmd/go/internal/list/list.go
src/cmd/go/internal/load/pkg.go
src/cmd/go/internal/work/buildid.go
src/cmd/go/internal/work/exec.go