cmd/gomote: add --status flag to the ping subcommand

For debugging the openbsd-386 buildlet. Turns out it's ancient for some reason.

Updates golang/go#35610

Change-Id: Ie003c1b89d0c2d110bc8c70765996c7b71958779
Reviewed-on: https://go-review.googlesource.com/c/build/+/207419
Reviewed-by: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
Brad Fitzpatrick 2019-11-15 17:19:23 +00:00
Родитель 832e29f8f5
Коммит 4adc003e9d
1 изменённых файлов: 16 добавлений и 3 удалений

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

@ -13,10 +13,12 @@ import (
func ping(args []string) error {
fs := flag.NewFlagSet("ping", flag.ContinueOnError)
fs.Usage = func() {
fmt.Fprintln(os.Stderr, "ping usage: gomote ping <instance>")
fmt.Fprintln(os.Stderr, "ping usage: gomote ping [--status] <instance>")
fs.PrintDefaults()
os.Exit(1)
}
var status bool
fs.BoolVar(&status, "status", false, "print buildlet status")
fs.Parse(args)
if fs.NArg() != 1 {
@ -27,6 +29,17 @@ func ping(args []string) error {
if err != nil {
return err
}
_, err = bc.WorkDir()
return err
wd, err := bc.WorkDir()
if err != nil {
return err
}
if status {
fmt.Printf("workdir: %v\n", wd)
s, err := bc.Status()
if err != nil {
return err
}
fmt.Printf("status: %+v\n", s)
}
return nil
}