1
0
mirror of https://github.com/golang/go synced 2024-11-16 22:04:50 -07:00

cmd/buildid: fix rewriting legacy buildids

This commit is contained in:
Stephen Eckels 2022-05-31 13:11:17 -04:00
parent 085529bd5f
commit 7169a58fd7

View File

@ -53,6 +53,11 @@ func main() {
log.Fatal(err)
}
// <= go 1.7 doesn't embed the contentID or actionID, so no slash is present
if !strings.Contains(id, "/") {
log.Fatalf("%s: build ID is a legacy format...binary too old for this tool", file)
}
newID := id[:strings.LastIndex(id, "/")] + "/" + buildid.HashToString(hash)
if len(newID) != len(id) {
log.Fatalf("%s: build ID length mismatch %q vs %q", file, id, newID)