Skip to content

Commit

Permalink
cmd/gomote: strip optional 'b' prefix character on build IDs
Browse files Browse the repository at this point in the history
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 <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Auto-Submit: Michael Knyszek <[email protected]>
  • Loading branch information
mknyszek authored and gopherbot committed Nov 5, 2024
1 parent 1f5416f commit 681630b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/gomote/repro.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 681630b

Please sign in to comment.