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 <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
Michael Anthony Knyszek 2024-10-30 19:17:01 +00:00 коммит произвёл Gopher Robot
Родитель 1f5416f104
Коммит 681630b7c3
1 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -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()