1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-09 13:36:56 +02:00

style: invert if statement

This commit is contained in:
Carlos Alexandro Becker 2023-09-27 00:28:10 +00:00
parent 9a645b4121
commit aba74099bc
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940

View File

@ -97,15 +97,16 @@ func (g *gitClient) CreateFiles(
}); err != nil {
return fmt.Errorf("git: failed to setup local repository: %w", err)
}
if g.branch != "" {
if g.branch == "" {
return nil
}
if err := runGitCmds(ctx, cwd, env, [][]string{
{"checkout", g.branch},
}); err != nil {
if err := runGitCmds(ctx, cwd, env, [][]string{
{"checkout", g.branch},
{"checkout", "-b", g.branch},
}); err != nil {
if err := runGitCmds(ctx, cwd, env, [][]string{
{"checkout", "-b", g.branch},
}); err != nil {
return fmt.Errorf("git: could not checkout branch %s: %w", g.branch, err)
}
return fmt.Errorf("git: could not checkout branch %s: %w", g.branch, err)
}
}
return nil