diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2025-09-29 21:48:35 +0200 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2025-09-29 21:48:35 +0200 |
| commit | fa24620c50a56ae6c3c31575e861098d0f0ed177 (patch) | |
| tree | e6963f607605577ca06dfeff666e5a186bb2b15f /internal/prompt | |
| parent | 24762f09de2aa8cada3f3c63afa313e06ebf47c8 (diff) | |
| download | gofu-fa24620c50a56ae6c3c31575e861098d0f0ed177.tar.gz | |
run `modernize -fix ./...`
Also drop util/gocovcat.go which has been obsolete since
122068efd4a348921b736b4456d4e1c999dbfb79.
Diffstat (limited to 'internal/prompt')
| -rw-r--r-- | internal/prompt/cloud.go | 2 | ||||
| -rw-r--r-- | internal/prompt/git.go | 8 |
2 files changed, 5 insertions, 5 deletions
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 |
