From fa24620c50a56ae6c3c31575e861098d0f0ed177 Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Mon, 29 Sep 2025 21:48:35 +0200 Subject: run `modernize -fix ./...` Also drop util/gocovcat.go which has been obsolete since 122068efd4a348921b736b4456d4e1c999dbfb79. --- internal/prompt/cloud.go | 2 +- internal/prompt/git.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'internal/prompt') diff --git a/internal/prompt/cloud.go b/internal/prompt/cloud.go index 624f56d..14cd18a 100644 --- a/internal/prompt/cloud.go +++ b/internal/prompt/cloud.go @@ -86,7 +86,7 @@ func getKubernetesFieldViaU8S() string { context string namespace string ) - for _, line := range strings.Split(string(stdout), "\n") { + for line := range strings.SplitSeq(string(stdout), "\n") { fields := strings.SplitN(strings.TrimSpace(line), "=", 2) if len(fields) != 2 { continue diff --git a/internal/prompt/git.go b/internal/prompt/git.go index 6f0cf1d..26291c4 100644 --- a/internal/prompt/git.go +++ b/internal/prompt/git.go @@ -57,12 +57,12 @@ func findRepo(path string) (*gitRepo, error) { if err != nil { return nil, err } - for _, line := range strings.Split(string(bytes), "\n") { + for line := range strings.SplitSeq(string(bytes), "\n") { line = strings.TrimSpace(line) - if strings.HasPrefix(line, "gitdir:") { + if gitDir, ok := strings.CutPrefix(line, "gitdir:"); ok { return &gitRepo{ RootPath: path, - GitDir: filepath.Join(path, strings.TrimSpace(strings.TrimPrefix(line, "gitdir:"))), + GitDir: filepath.Join(path, strings.TrimSpace(gitDir)), }, nil } } @@ -115,7 +115,7 @@ func tryReadFromPackedRefs(repo *gitRepo, refSpec string) string { if err != nil { return "" } - for _, line := range strings.Split(string(bytes), "\n") { + for line := range strings.SplitSeq(string(bytes), "\n") { line = strings.TrimSpace(line) if line == "" || strings.HasPrefix(line, "#") { continue -- cgit v1.3.1