Skip to content

Commit de1d860

Browse files
committed
lint fix
1 parent d378dc8 commit de1d860

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

pkg/cmd/repo/rename/rename.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func renameRun(opts *RenameOptions) error {
8989
var input renameRepo
9090
var newRepo ghrepo.Interface
9191
var baseRemote *context.Remote
92-
remoteUpdateError := false
92+
var remoteUpdateError error
9393
newRepoName := opts.newRepoSelector
9494

9595
currRepo, err := opts.BaseRepo()
@@ -128,27 +128,25 @@ func renameRun(opts *RenameOptions) error {
128128
if err != nil {
129129
return err
130130
}
131-
131+
132132
protocol, _ := cfg.Get(currRepo.RepoHost(), "git_protocol")
133133
remotes, _ := opts.Remotes()
134134
baseRemote, _ = remotes.FindByRepo(currRepo.RepoOwner(), currRepo.RepoName())
135135
remoteURL := ghrepo.FormatRemoteURL(newRepo, protocol)
136-
err = git.UpdateRemoteURL(baseRemote.Name, remoteURL)
137-
if err != nil {
136+
remoteUpdateError = git.UpdateRemoteURL(baseRemote.Name, remoteURL)
137+
if remoteUpdateError != nil {
138138
cs := opts.IO.ColorScheme()
139-
remoteUpdateError = true
140139
fmt.Fprintf(opts.IO.ErrOut, "%s warning: unable to update remote '%s' \n", cs.WarningIcon(), err)
141140
}
142141
}
143142

144143
if opts.IO.IsStdoutTTY() {
145144
cs := opts.IO.ColorScheme()
146145
fmt.Fprintf(opts.IO.Out, "%s Renamed repository %s\n", cs.SuccessIcon(), input.RepoOwner+"/"+input.Name)
147-
if !opts.HasRepoOverride && !remoteUpdateError {
146+
if !opts.HasRepoOverride && remoteUpdateError == nil {
148147
fmt.Fprintf(opts.IO.Out, "%s Updated the %q remote \n", cs.SuccessIcon(), baseRemote.Name)
149148
}
150149
}
151-
152150
return nil
153151
}
154152

0 commit comments

Comments
 (0)