diff options
-rw-r--r-- | tools/gerrit-hook/main.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/gerrit-hook/main.go b/tools/gerrit-hook/main.go index aae73ba..5461490 100644 --- a/tools/gerrit-hook/main.go +++ b/tools/gerrit-hook/main.go @@ -50,16 +50,17 @@ func main() { os.Exit(1) } - if cmd == "patchset-created" { + switch cmd { + case "patchset-created": trigger, err := triggerForPatchsetCreated() if err != nil { log.Crit(fmt.Sprintf("failed to create a trigger: %s", err)) os.Exit(1) } gerritHookMain(cfg, log, trigger) - } else if cmd == "post-command" { + case "post-command": postCommand(cfg) - } else { + default: log.Info(fmt.Sprintf("`%s' is not a supported command", cmd)) os.Exit(1) } |