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/rtree | |
| 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/rtree')
| -rw-r--r-- | internal/rtree/index.go | 2 | ||||
| -rw-r--r-- | internal/rtree/init.go | 2 | ||||
| -rw-r--r-- | internal/rtree/remote.go | 4 | ||||
| -rw-r--r-- | internal/rtree/repo.go | 2 | ||||
| -rw-r--r-- | internal/rtree/shared_test.go | 4 |
5 files changed, 7 insertions, 7 deletions
diff --git a/internal/rtree/index.go b/internal/rtree/index.go index 09ababa..a329cd7 100644 --- a/internal/rtree/index.go +++ b/internal/rtree/index.go @@ -57,7 +57,7 @@ func ReadIndex() (*Index, []error) { //validate YAML var errs []error - missing := func(key string, args ...interface{}) { + missing := func(key string, args ...any) { errs = append(errs, fmt.Errorf("read %s: missing \"%s\"", IndexPath, fmt.Sprintf(key, args...), )) diff --git a/internal/rtree/init.go b/internal/rtree/init.go index 7121af9..13947a8 100644 --- a/internal/rtree/init.go +++ b/internal/rtree/init.go @@ -83,7 +83,7 @@ func Init() bool { } rx := regexp.MustCompile(`^url\.([^=]+)\.insteadof=(.+)$`) - for _, line := range strings.Split(out, "\n") { + for line := range strings.SplitSeq(out, "\n") { match := rx.FindStringSubmatch(line) if match == nil { continue diff --git a/internal/rtree/remote.go b/internal/rtree/remote.go index 3d443aa..a8d5564 100644 --- a/internal/rtree/remote.go +++ b/internal/rtree/remote.go @@ -102,13 +102,13 @@ func (u RemoteURL) CheckoutPath() (string, error) { } // MarshalYAML implements the yaml.Marshaler interface. -func (u RemoteURL) MarshalYAML() (interface{}, error) { +func (u RemoteURL) MarshalYAML() (any, error) { //store URLs in the index in the canonical format return u.CanonicalURL(), nil } // UnmarshalYAML implements the yaml.Unmarshaler interface. -func (u *RemoteURL) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (u *RemoteURL) UnmarshalYAML(unmarshal func(any) error) error { var s string err := unmarshal(&s) if err == nil { diff --git a/internal/rtree/repo.go b/internal/rtree/repo.go index 2267666..397df4f 100644 --- a/internal/rtree/repo.go +++ b/internal/rtree/repo.go @@ -71,7 +71,7 @@ func NewRepoFromAbsolutePath(path string) (repo Repo, err error) { return } - for _, line := range strings.Split(out, "\n") { + for line := range strings.SplitSeq(out, "\n") { match := remoteConfigRx.FindStringSubmatch(line) if match == nil { continue diff --git a/internal/rtree/shared_test.go b/internal/rtree/shared_test.go index e26eb11..0a5e2df 100644 --- a/internal/rtree/shared_test.go +++ b/internal/rtree/shared_test.go @@ -146,8 +146,8 @@ func Recorded(lines ...string) (cs []RecordedCommand) { cs = make([]RecordedCommand, len(lines)) for idx, line := range lines { cmdline := strings.Fields(line) - if strings.HasPrefix(cmdline[0], "@") { - cs[idx].Cmd.WorkDir = strings.TrimPrefix(cmdline[0], "@") + if workDir, ok := strings.CutPrefix(cmdline[0], "@"); ok { + cs[idx].Cmd.WorkDir = workDir cmdline = cmdline[1:] } cs[idx].Cmd.Program = cmdline |
