Skip to content

Commit db80a75

Browse files
committed
fixup! feat: add fork remote command
Prefer errors.New over fmt.Errorf when there are no placeholders.
1 parent a675f6b commit db80a75

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/gui/controllers/remotes_controller.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package controllers
22

33
import (
4+
"errors"
45
"fmt"
56
"regexp"
67
"slices"
@@ -179,7 +180,7 @@ func (self *RemotesController) ensureForkRemoteAndCheckout(remoteName string, re
179180
if remote.Name == remoteName {
180181
hasTheSameUrl := slices.Contains(remote.Urls, remoteUrl)
181182
if !hasTheSameUrl {
182-
return fmt.Errorf("%s", utils.ResolvePlaceholderString(
183+
return errors.New(utils.ResolvePlaceholderString(
183184
self.c.Tr.IncompatibleForkAlreadyExistsError,
184185
map[string]string{
185186
"remoteName": remoteName,
@@ -226,10 +227,10 @@ var (
226227
// keeping the repo name and host intact. Supports SCP-like SSH, SSH URL style, and HTTPS.
227228
func replaceForkUsername(remoteUrl, forkUsername string) (string, error) {
228229
if forkUsername == "" {
229-
return "", fmt.Errorf("fork username cannot be empty")
230+
return "", errors.New("fork username cannot be empty")
230231
}
231232
if remoteUrl == "" {
232-
return "", fmt.Errorf("remote URL cannot be empty")
233+
return "", errors.New("remote URL cannot be empty")
233234
}
234235

235236
switch {

0 commit comments

Comments
 (0)