From 681630b7c30d2f7f86b455e6327921bf206ad297 Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Wed, 30 Oct 2024 19:17:01 +0000 Subject: [PATCH] cmd/gomote: strip optional 'b' prefix character on build IDs This is a minor point of friction. Simply accept the optional prefix to make repro a little easier to use, especially for passing builds. Change-Id: Id20ec9e13d65ed7f2f6541ecd1c9aae871206d56 Reviewed-on: https://go-review.googlesource.com/c/build/+/623636 Reviewed-by: Carlos Amedee LUCI-TryBot-Result: Go LUCI Auto-Submit: Michael Knyszek --- cmd/gomote/repro.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/gomote/repro.go b/cmd/gomote/repro.go index 3431f51a..6d9df951 100644 --- a/cmd/gomote/repro.go +++ b/cmd/gomote/repro.go @@ -59,9 +59,11 @@ func repro(args []string) error { fs.Usage() } // Parse as a uint even though we'll end up converting to int64 -- negative build IDs are not valid. - buildID, err := strconv.ParseUint(fs.Arg(0), 10, 64) + // Strip an optional "b" prefix. Lots of LUCI URLs and UIs use the prefix, so it makes copy-paste + // easier. + buildID, err := strconv.ParseUint(strings.TrimPrefix(fs.Arg(0), "b"), 10, 64) if err != nil { - return fmt.Errorf("parsing build ID: %v", err) + return fmt.Errorf("parsing build ID %s: %v", fs.Arg(0), err) } // Always use a default unauthenticated client for public builds. ctx := context.Background()