Skip to content

Commit f95ac67

Browse files
committed
Cleanup: turn around error condition
It is a common go convention for the "happy path" to be as little indented as possible.
1 parent 61815c1 commit f95ac67

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/commands/git_commands/branch.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,11 @@ func (self *BranchCommands) CurrentBranchName() (string, error) {
111111
ToArgv()
112112

113113
output, err := self.cmd.New(cmdArgs).DontLog().RunWithOutput()
114-
if err == nil {
115-
return strings.TrimSpace(output), nil
114+
if err != nil {
115+
return "", err
116116
}
117-
return "", err
117+
118+
return strings.TrimSpace(output), nil
118119
}
119120

120121
// LocalDelete delete branch locally

0 commit comments

Comments
 (0)