diff options
author | Franck Cuny <franck@fcuny.net> | 2022-06-21 18:15:16 -0700 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2022-06-23 06:44:44 -0700 |
commit | 5205563817a484ae2704dd01f07b1a5b3ef4b828 (patch) | |
tree | 23ad80e04e07b6a433c9c07eb2ebe406a8f2c4a1 | |
parent | feat(home/go): install go-tools package (diff) | |
download | world-5205563817a484ae2704dd01f07b1a5b3ef4b828.tar.gz |
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 <franck@fcuny.net>
Diffstat (limited to '')
-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) } |