diff options
author | deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> | 2022-03-06 16:33:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-06 16:33:45 +0800 |
commit | deec3516d53e9a9679128ade0556ccc818a67be1 (patch) | |
tree | b5c1c5d55be05a244180ece0b822e7e35dc68f42 /internal/cmd/hook.go | |
parent | 65526f84e1d382ac01b7379f40fc56b2660d1074 (diff) |
autofix: fix check for empty string (#6804)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Diffstat (limited to 'internal/cmd/hook.go')
-rw-r--r-- | internal/cmd/hook.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/cmd/hook.go b/internal/cmd/hook.go index 99a5e15b..b58db829 100644 --- a/internal/cmd/hook.go +++ b/internal/cmd/hook.go @@ -63,7 +63,7 @@ var ( ) func runHookPreReceive(c *cli.Context) error { - if len(os.Getenv("SSH_ORIGINAL_COMMAND")) == 0 { + if os.Getenv("SSH_ORIGINAL_COMMAND") == "" { return nil } setup(c, "pre-receive.log", true) @@ -156,7 +156,7 @@ func runHookPreReceive(c *cli.Context) error { } func runHookUpdate(c *cli.Context) error { - if len(os.Getenv("SSH_ORIGINAL_COMMAND")) == 0 { + if os.Getenv("SSH_ORIGINAL_COMMAND") == "" { return nil } setup(c, "update.log", false) @@ -164,7 +164,7 @@ func runHookUpdate(c *cli.Context) error { args := c.Args() if len(args) != 3 { fail("Arguments received are not equal to three", "Arguments received are not equal to three") - } else if len(args[0]) == 0 { + } else if args[0] == "" { fail("First argument 'refName' is empty", "First argument 'refName' is empty") } @@ -190,7 +190,7 @@ func runHookUpdate(c *cli.Context) error { } func runHookPostReceive(c *cli.Context) error { - if len(os.Getenv("SSH_ORIGINAL_COMMAND")) == 0 { + if os.Getenv("SSH_ORIGINAL_COMMAND") == "" { return nil } setup(c, "post-receive.log", true) |