From 5205563817a484ae2704dd01f07b1a5b3ef4b828 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Tue, 21 Jun 2022 18:15:16 -0700 Subject: ref(tools/gerrit-hook): more idiomatic code As reported by the linter. Change-Id: I649fc3d90387bda28efe025dd7ccb54d4296d1bd Reviewed-on: https://cl.fcuny.net/c/world/+/469 Tested-by: CI Reviewed-by: Franck Cuny --- tools/gerrit-hook/main.go | 7 ++++--- 1 file 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) } -- cgit 1.4.1