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>
diff --git a/cmd/gomote/ping.go b/cmd/gomote/ping.go
index c7ea4e8..c876e5f 100644
--- a/cmd/gomote/ping.go
+++ b/cmd/gomote/ping.go
@@ -13,10 +13,12 @@
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 @@
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
}