Use strings.Cut
This commit is contained in:
parent
c89d8cb759
commit
63a3adf212
2 changed files with 2 additions and 16 deletions
|
|
@ -150,7 +150,7 @@ func defaultRun(opts *DefaultOptions) error {
|
|||
return err
|
||||
}
|
||||
|
||||
owner, repo, _ := cut(selectedName, "/")
|
||||
owner, repo, _ := strings.Cut(selectedName, "/")
|
||||
selectedRepo = ghrepo.New(owner, repo)
|
||||
}
|
||||
}
|
||||
|
|
@ -202,10 +202,3 @@ func setDefaultRepo(remote *context.Remote, resolution string) error {
|
|||
func unsetDefaultRepo(remote *context.Remote) error {
|
||||
return git.UnsetRemoteResolution(remote.Name)
|
||||
}
|
||||
|
||||
func cut(s, sep string) (before, after string, found bool) {
|
||||
if i := strings.Index(s, sep); i >= 0 {
|
||||
return s[:i], s[i+len(sep):], true
|
||||
}
|
||||
return s, "", false
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue