Skip to content

Commit

Permalink
cmd/gomote: add -destroy-group flag to destroy
Browse files Browse the repository at this point in the history
For golang/go#53956.

Change-Id: I4face246e87af18886b0e7d4c200cca41df5e9ad
Reviewed-on: https://go-review.googlesource.com/c/build/+/418787
Run-TryBot: Michael Knyszek <[email protected]>
Reviewed-by: Carlos Amedee <[email protected]>
Auto-Submit: Michael Knyszek <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
  • Loading branch information
mknyszek authored and gopherbot committed Nov 18, 2022
1 parent 08589fd commit c46b371
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions cmd/gomote/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ func destroy(args []string) error {
}
os.Exit(1)
}
var destroyGroup bool
fs.BoolVar(&destroyGroup, "destroy-group", false, "if a group is used, destroy the group too")

fs.Parse(args)

Expand All @@ -104,9 +106,15 @@ func destroy(args []string) error {
}
}
if activeGroup != nil {
activeGroup.Instances = nil
if err := storeGroup(activeGroup); err != nil {
return err
if destroyGroup {
if err := deleteGroup(activeGroup.Name); err != nil {
return err
}
} else {
activeGroup.Instances = nil
if err := storeGroup(activeGroup); err != nil {
return err
}
}
}
return nil
Expand Down

0 comments on commit c46b371

Please sign in to comment.