diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 16ad9cc..ff41718 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -14,7 +14,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: - version: v1.54.2 + version: v1.56.2 args: --verbose test: diff --git a/collections/collections-suite_test.go b/collections/collections-suite_test.go index 6be91f5..32ae02d 100644 --- a/collections/collections-suite_test.go +++ b/collections/collections-suite_test.go @@ -3,8 +3,8 @@ package collections_test import ( "testing" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok ) func TestCollections(t *testing.T) { diff --git a/collections/gomega-stack-matchers_test.go b/collections/gomega-stack-matchers_test.go index 5b16991..a5d2137 100644 --- a/collections/gomega-stack-matchers_test.go +++ b/collections/gomega-stack-matchers_test.go @@ -3,9 +3,7 @@ package collections_test import ( "fmt" - // . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - // . "github.com/onsi/gomega/matchers" + . "github.com/onsi/gomega" //nolint:revive // gomega ok "github.com/onsi/gomega/types" "github.com/snivilised/extendio/collections" diff --git a/collections/iterators_test.go b/collections/iterators_test.go index 7a7e8f9..c0adcfb 100644 --- a/collections/iterators_test.go +++ b/collections/iterators_test.go @@ -4,8 +4,8 @@ import ( "fmt" "strings" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok "github.com/samber/lo" "github.com/snivilised/extendio/collections" @@ -635,7 +635,7 @@ var _ = Describe("Iterators", func() { return nil } - while := func(_ sleeve, err error) bool { + while := func(_ sleeve, _ error) bool { return true } @@ -658,7 +658,7 @@ var _ = Describe("Iterators", func() { return nil } - while := func(s sleeve, err error) bool { + while := func(s sleeve, _ error) bool { return strings.HasPrefix(s.song(), "0") } @@ -683,7 +683,7 @@ var _ = Describe("Iterators", func() { return nil } - while := func(_ sleeve, err error) bool { + while := func(_ sleeve, _ error) bool { return true } @@ -706,7 +706,7 @@ var _ = Describe("Iterators", func() { return nil } - while := func(s sleeve, err error) bool { + while := func(s sleeve, _ error) bool { return strings.HasPrefix(s.song(), "BONUS") } diff --git a/collections/stack_test.go b/collections/stack_test.go index 49c6b18..5cece03 100644 --- a/collections/stack_test.go +++ b/collections/stack_test.go @@ -1,8 +1,8 @@ package collections_test import ( - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok "github.com/snivilised/extendio/collections" ) diff --git a/i18n/i18n_suite_test.go b/i18n/i18n_suite_test.go index 4cc92d2..dac047d 100644 --- a/i18n/i18n_suite_test.go +++ b/i18n/i18n_suite_test.go @@ -3,8 +3,8 @@ package i18n_test import ( "testing" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok ) func TestI18n(t *testing.T) { diff --git a/i18n/text_test.go b/i18n/text_test.go index 134d077..175e41a 100644 --- a/i18n/text_test.go +++ b/i18n/text_test.go @@ -4,8 +4,8 @@ import ( "errors" "strings" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok xi18n "github.com/snivilised/extendio/i18n" "github.com/snivilised/extendio/internal/helpers" "github.com/snivilised/extendio/xfs/utils" diff --git a/i18n/translator_test.go b/i18n/translator_test.go index 5c98192..8b9f376 100644 --- a/i18n/translator_test.go +++ b/i18n/translator_test.go @@ -4,8 +4,8 @@ import ( "fmt" "strings" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok "golang.org/x/text/language" "github.com/snivilised/extendio/i18n" diff --git a/xfs/nav/bootstrapper.go b/xfs/nav/bootstrapper.go index 0343d83..94ef8c0 100644 --- a/xfs/nav/bootstrapper.go +++ b/xfs/nav/bootstrapper.go @@ -41,11 +41,11 @@ func (b *bootstrapper) initFilters() { func (b *bootstrapper) initNotifiers() { if b.o.Notify.OnStart == nil { - b.o.Notify.OnStart = func(description string) {} + b.o.Notify.OnStart = func(_ string) {} } if b.o.Notify.OnStop == nil { - b.o.Notify.OnStop = func(description string) {} + b.o.Notify.OnStop = func(_ string) {} } b.nc.frame.notifiers.init(&b.o.Notify) diff --git a/xfs/nav/filter-extended-glob_test.go b/xfs/nav/filter-extended-glob_test.go index a2a6006..9c7ab75 100644 --- a/xfs/nav/filter-extended-glob_test.go +++ b/xfs/nav/filter-extended-glob_test.go @@ -3,13 +3,13 @@ package nav_test import ( "fmt" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok "github.com/samber/lo" "github.com/snivilised/extendio/internal/helpers" - . "github.com/snivilised/extendio/i18n" + . "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok "github.com/snivilised/extendio/xfs/nav" ) diff --git a/xfs/nav/filter-glob.go b/xfs/nav/filter-glob.go index fe4eb26..4ca4d57 100644 --- a/xfs/nav/filter-glob.go +++ b/xfs/nav/filter-glob.go @@ -31,7 +31,7 @@ type CompoundGlobFilter struct { // Matching returns the collection of files contained within this // item's folder that matches this filter. func (f *CompoundGlobFilter) Matching(children []fs.DirEntry) []fs.DirEntry { - return lo.Filter(children, func(entry fs.DirEntry, index int) bool { + return lo.Filter(children, func(entry fs.DirEntry, _ int) bool { matched, _ := filepath.Match(f.Pattern, entry.Name()) return f.invert(matched) }) diff --git a/xfs/nav/filter-glob_test.go b/xfs/nav/filter-glob_test.go index 3339e0b..f536c31 100644 --- a/xfs/nav/filter-glob_test.go +++ b/xfs/nav/filter-glob_test.go @@ -3,13 +3,13 @@ package nav_test import ( "fmt" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok "github.com/samber/lo" "github.com/snivilised/extendio/internal/helpers" - . "github.com/snivilised/extendio/i18n" + . "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok "github.com/snivilised/extendio/xfs/nav" ) diff --git a/xfs/nav/filter-poly_test.go b/xfs/nav/filter-poly_test.go index 8cda861..3f94ddb 100644 --- a/xfs/nav/filter-poly_test.go +++ b/xfs/nav/filter-poly_test.go @@ -4,11 +4,11 @@ import ( "fmt" "strings" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok "github.com/samber/lo" - . "github.com/snivilised/extendio/i18n" + . "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok "github.com/snivilised/extendio/internal/helpers" "github.com/snivilised/extendio/xfs/nav" ) @@ -356,7 +356,7 @@ var _ = Describe("FilterPoly", Ordered, func() { o.Store.FilterDefs = filterDefs o.Callback = &nav.LabelledTraverseCallback{ Label: "(panic): test poly filter callback", - Fn: func(item *nav.TraverseItem) error { + Fn: func(_ *nav.TraverseItem) error { return nil }, } diff --git a/xfs/nav/filter-regex.go b/xfs/nav/filter-regex.go index ed67895..31d42be 100644 --- a/xfs/nav/filter-regex.go +++ b/xfs/nav/filter-regex.go @@ -42,7 +42,7 @@ func (f *CompoundRegexFilter) Validate() { } func (f *CompoundRegexFilter) Matching(children []fs.DirEntry) []fs.DirEntry { - return lo.Filter(children, func(entry fs.DirEntry, index int) bool { + return lo.Filter(children, func(entry fs.DirEntry, _ int) bool { return f.invert(f.rex.MatchString(entry.Name())) }) } diff --git a/xfs/nav/filter-regex_test.go b/xfs/nav/filter-regex_test.go index 967b65e..95290cf 100644 --- a/xfs/nav/filter-regex_test.go +++ b/xfs/nav/filter-regex_test.go @@ -4,13 +4,13 @@ import ( "fmt" "strings" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok "github.com/samber/lo" "github.com/snivilised/extendio/internal/helpers" - . "github.com/snivilised/extendio/i18n" + . "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok "github.com/snivilised/extendio/xfs/nav" ) diff --git a/xfs/nav/gomega-matchers_test.go b/xfs/nav/gomega-matchers_test.go index b2a7758..859aff2 100644 --- a/xfs/nav/gomega-matchers_test.go +++ b/xfs/nav/gomega-matchers_test.go @@ -3,7 +3,7 @@ package nav_test import ( "fmt" - . "github.com/onsi/gomega/types" + . "github.com/onsi/gomega/types" //nolint:revive // gomega ok "github.com/snivilised/extendio/xfs/nav" ) diff --git a/xfs/nav/helpers_test.go b/xfs/nav/helpers_test.go index 0f93da3..ce63760 100644 --- a/xfs/nav/helpers_test.go +++ b/xfs/nav/helpers_test.go @@ -10,8 +10,8 @@ import ( "path/filepath" "strings" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok "github.com/samber/lo" "github.com/snivilised/extendio/i18n" "github.com/snivilised/extendio/internal/helpers" diff --git a/xfs/nav/hook-extend.go b/xfs/nav/hook-extend.go index 35d8362..eff53d2 100644 --- a/xfs/nav/hook-extend.go +++ b/xfs/nav/hook-extend.go @@ -50,9 +50,11 @@ func DefaultExtendHookFn(navi *NavigationInfo, entries *DirectoryContents) { func() string { result := subpath sep := string(filepath.Separator) + if strings.HasSuffix(subpath, sep) { result = subpath[:strings.LastIndex(subpath, sep)] } + return result }, ) diff --git a/xfs/nav/marshal-state_test.go b/xfs/nav/marshal-state_test.go index dd4e1f8..8fd96b3 100644 --- a/xfs/nav/marshal-state_test.go +++ b/xfs/nav/marshal-state_test.go @@ -4,12 +4,12 @@ import ( "fmt" "strings" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok "github.com/snivilised/extendio/internal/helpers" - . "github.com/snivilised/extendio/i18n" + . "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok "github.com/snivilised/extendio/xfs/nav" ) @@ -98,7 +98,7 @@ var _ = Describe("MarshalOptions", Ordered, func() { o.Store.FilterDefs = &filterDefs o.Callback = &nav.LabelledTraverseCallback{ Label: "test marshal state callback", - Fn: func(item *nav.TraverseItem) error { + Fn: func(_ *nav.TraverseItem) error { return nil }, } diff --git a/xfs/nav/nav-suite_test.go b/xfs/nav/nav-suite_test.go index a1fa8a4..a4caa85 100644 --- a/xfs/nav/nav-suite_test.go +++ b/xfs/nav/nav-suite_test.go @@ -3,8 +3,8 @@ package nav_test import ( "testing" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok ) func TestNav(t *testing.T) { diff --git a/xfs/nav/navigation-async_test.go b/xfs/nav/navigation-async_test.go index da39132..edeec03 100644 --- a/xfs/nav/navigation-async_test.go +++ b/xfs/nav/navigation-async_test.go @@ -7,8 +7,8 @@ import ( "time" "github.com/fortytw2/leaktest" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok "github.com/samber/lo" "go.uber.org/zap/exp/zapslog" "go.uber.org/zap/zapcore" @@ -17,7 +17,7 @@ import ( "github.com/snivilised/extendio/xfs/nav" "github.com/snivilised/lorax/boost" - . "github.com/snivilised/extendio/i18n" + . "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok ) var ( diff --git a/xfs/nav/navigation-listener_test.go b/xfs/nav/navigation-listener_test.go index 9420bcb..b62e274 100644 --- a/xfs/nav/navigation-listener_test.go +++ b/xfs/nav/navigation-listener_test.go @@ -4,12 +4,12 @@ import ( "fmt" "strings" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok "github.com/samber/lo" "github.com/snivilised/extendio/internal/helpers" - . "github.com/snivilised/extendio/i18n" + . "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok "github.com/snivilised/extendio/xfs/nav" ) diff --git a/xfs/nav/navigation-with-runner_test.go b/xfs/nav/navigation-with-runner_test.go index 0905238..768792c 100644 --- a/xfs/nav/navigation-with-runner_test.go +++ b/xfs/nav/navigation-with-runner_test.go @@ -6,8 +6,8 @@ import ( "time" "github.com/fortytw2/leaktest" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok "go.uber.org/zap/exp/zapslog" "go.uber.org/zap/zapcore" @@ -15,7 +15,7 @@ import ( "github.com/snivilised/extendio/xfs/nav" "github.com/snivilised/lorax/boost" - . "github.com/snivilised/extendio/i18n" + . "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok ) var _ = Describe("NavigationWithRunner", Ordered, func() { diff --git a/xfs/nav/new-filter.go b/xfs/nav/new-filter.go index aa6a941..f412aa7 100644 --- a/xfs/nav/new-filter.go +++ b/xfs/nav/new-filter.go @@ -20,7 +20,7 @@ func fromExtendedGlobPattern(pattern string) (segments, suffixes []string, err e segments = strings.Split(pattern, "|") suffixes = strings.Split(segments[1], ",") - suffixes = lo.Reject(suffixes, func(item string, index int) bool { + suffixes = lo.Reject(suffixes, func(item string, _ int) bool { return item == "" }) diff --git a/xfs/nav/read-entries.go b/xfs/nav/read-entries.go index 7bbc143..a7a0102 100644 --- a/xfs/nav/read-entries.go +++ b/xfs/nav/read-entries.go @@ -21,7 +21,7 @@ func ReadEntriesHookFn(dirname string) ([]fs.DirEntry, error) { return nil, err } - return lo.Filter(contents, func(item fs.DirEntry, index int) bool { + return lo.Filter(contents, func(item fs.DirEntry, _ int) bool { return item.Name() != ".DS_Store" }), nil } diff --git a/xfs/nav/resume-strategy-spawn.go b/xfs/nav/resume-strategy-spawn.go index 7629bc8..035a1e0 100644 --- a/xfs/nav/resume-strategy-spawn.go +++ b/xfs/nav/resume-strategy-spawn.go @@ -135,6 +135,7 @@ func (s *spawnStrategy) following(params *followingParams) *shard { if params.inclusive { return item.Name() >= params.anchor } + return item.Name() > params.anchor }) siblings := groups[followingSiblings] diff --git a/xfs/nav/resume-strategy_test.go b/xfs/nav/resume-strategy_test.go index d3b389d..7a491f2 100644 --- a/xfs/nav/resume-strategy_test.go +++ b/xfs/nav/resume-strategy_test.go @@ -5,10 +5,10 @@ import ( "path/filepath" "strings" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok - . "github.com/snivilised/extendio/i18n" + . "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok "github.com/snivilised/extendio/internal/helpers" "github.com/snivilised/extendio/xfs/nav" ) @@ -226,7 +226,7 @@ var _ = Describe("Resume", Ordered, func() { // end of synthetic assignments if strategyEn == nav.ResumeStrategyFastwardEn { - o.Notify.OnBegin = func(state *nav.NavigationState) { + o.Notify.OnBegin = func(_ *nav.NavigationState) { panic("begin handler should not be invoked because begin notification muted") } } diff --git a/xfs/nav/traverse-navigator-cascade_test.go b/xfs/nav/traverse-navigator-cascade_test.go index 1c1ed3c..296ba3a 100644 --- a/xfs/nav/traverse-navigator-cascade_test.go +++ b/xfs/nav/traverse-navigator-cascade_test.go @@ -3,9 +3,9 @@ package nav_test import ( "fmt" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - . "github.com/snivilised/extendio/i18n" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok + . "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok "github.com/snivilised/extendio/internal/helpers" "github.com/snivilised/extendio/xfs/nav" ) diff --git a/xfs/nav/traverse-navigator-error_test.go b/xfs/nav/traverse-navigator-error_test.go index 54cf48a..4c5dd73 100644 --- a/xfs/nav/traverse-navigator-error_test.go +++ b/xfs/nav/traverse-navigator-error_test.go @@ -5,11 +5,11 @@ import ( "fmt" "io/fs" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok "github.com/snivilised/extendio/internal/helpers" - . "github.com/snivilised/extendio/i18n" + . "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok "github.com/snivilised/extendio/xfs/nav" ) @@ -138,8 +138,7 @@ var _ = Describe("TraverseNavigator errors", Ordered, func() { optionFn := func(o *nav.TraverseOptions) { o.Notify.OnBegin = begin("🧲") o.Store.Subscription = entry.subscription - o.Hooks.Sort = func(entries []fs.DirEntry, _ ...any) error { - + o.Hooks.Sort = func(_ []fs.DirEntry, _ ...any) error { return errors.New("fake sort error") } o.Callback = errorCallback("SORT-ERR", false) @@ -167,7 +166,7 @@ var _ = Describe("TraverseNavigator errors", Ordered, func() { optionFn := func(o *nav.TraverseOptions) { o.Notify.OnBegin = begin("🧲") o.Store.Subscription = nav.SubscribeFolders - o.Hooks.QueryStatus = func(path string) (fs.FileInfo, error) { + o.Hooks.QueryStatus = func(_ string) (fs.FileInfo, error) { return nil, errors.New("fake Lstat error") } o.Callback = errorCallback("ROOT-QUERY-STATUS", true) diff --git a/xfs/nav/traverse-navigator-scope_test.go b/xfs/nav/traverse-navigator-scope_test.go index b496edb..e49a0fe 100644 --- a/xfs/nav/traverse-navigator-scope_test.go +++ b/xfs/nav/traverse-navigator-scope_test.go @@ -3,9 +3,9 @@ package nav_test import ( "fmt" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - . "github.com/snivilised/extendio/i18n" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok + . "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok "github.com/snivilised/extendio/internal/helpers" "github.com/snivilised/extendio/xfs/nav" ) diff --git a/xfs/nav/traverse-navigator-skip_test.go b/xfs/nav/traverse-navigator-skip_test.go index 023d707..13082ae 100644 --- a/xfs/nav/traverse-navigator-skip_test.go +++ b/xfs/nav/traverse-navigator-skip_test.go @@ -3,10 +3,10 @@ package nav_test import ( "fmt" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok "github.com/samber/lo" - . "github.com/snivilised/extendio/i18n" + . "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok "github.com/snivilised/extendio/internal/helpers" "github.com/snivilised/extendio/xfs/nav" ) diff --git a/xfs/nav/traverse-navigator-sort_test.go b/xfs/nav/traverse-navigator-sort_test.go index 6a14f28..899847e 100644 --- a/xfs/nav/traverse-navigator-sort_test.go +++ b/xfs/nav/traverse-navigator-sort_test.go @@ -3,12 +3,12 @@ package nav_test import ( "fmt" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok "github.com/snivilised/extendio/internal/helpers" "github.com/snivilised/extendio/xfs/nav" - . "github.com/snivilised/extendio/i18n" + . "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok ) var _ = Describe("TraverseNavigatorSort", Ordered, func() { diff --git a/xfs/nav/traverse-navigator-subpath_test.go b/xfs/nav/traverse-navigator-subpath_test.go index c5e423d..0775c6c 100644 --- a/xfs/nav/traverse-navigator-subpath_test.go +++ b/xfs/nav/traverse-navigator-subpath_test.go @@ -1,9 +1,9 @@ package nav_test import ( - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - . "github.com/snivilised/extendio/i18n" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok + . "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok "github.com/snivilised/extendio/internal/helpers" "github.com/snivilised/extendio/xfs/nav" ) diff --git a/xfs/nav/traverse-navigator_test.go b/xfs/nav/traverse-navigator_test.go index 8c9d8e3..5ba219d 100644 --- a/xfs/nav/traverse-navigator_test.go +++ b/xfs/nav/traverse-navigator_test.go @@ -6,10 +6,10 @@ import ( "path/filepath" "strings" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok "github.com/samber/lo" - . "github.com/snivilised/extendio/i18n" + . "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok "github.com/snivilised/extendio/internal/helpers" "github.com/snivilised/extendio/xfs/nav" ) @@ -70,7 +70,7 @@ var _ = Describe("TraverseNavigator(logged)", Ordered, func() { _ = result.Session.Elapsed() if entry.visit { - _ = filepath.WalkDir(path, func(path string, de fs.DirEntry, err error) error { + _ = filepath.WalkDir(path, func(path string, de fs.DirEntry, _ error) error { if strings.HasSuffix(path, ".DS_Store") { return nil } @@ -310,10 +310,11 @@ var _ = Describe("TraverseNavigator(logged)", Ordered, func() { }).Run() if entry.visit { - _ = filepath.WalkDir(path, func(path string, de fs.DirEntry, err error) error { + _ = filepath.WalkDir(path, func(path string, de fs.DirEntry, _ error) error { if subscribes(entry.subscription, de) { visited = append(visited, path) } + return nil }) @@ -325,6 +326,7 @@ var _ = Describe("TraverseNavigator(logged)", Ordered, func() { _, found := recording[name] return found } + return false }) Expect(every).To(BeTrue()) diff --git a/xfs/nav/traverse-options_test.go b/xfs/nav/traverse-options_test.go index 7721402..25423fc 100644 --- a/xfs/nav/traverse-options_test.go +++ b/xfs/nav/traverse-options_test.go @@ -1,10 +1,10 @@ package nav_test import ( - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok - . "github.com/snivilised/extendio/i18n" + . "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok "github.com/snivilised/extendio/xfs/nav" ) @@ -31,7 +31,7 @@ var _ = Describe("TraverseOptions", Ordered, func() { It("should: return a deep copy", func() { cloneCount, sourceCount := 0, 0 - o.Notify.OnBegin = func(state *nav.NavigationState) { + o.Notify.OnBegin = func(_ *nav.NavigationState) { sourceCount++ } clone := o.Clone() @@ -53,7 +53,7 @@ var _ = Describe("TraverseOptions", Ordered, func() { state := &nav.NavigationState{} o.Notify.OnBegin(state) - clone.Notify.OnBegin = func(state *nav.NavigationState) { + clone.Notify.OnBegin = func(_ *nav.NavigationState) { cloneCount++ } clone.Notify.OnBegin(state) diff --git a/xfs/nav/traverse-sample_test.go b/xfs/nav/traverse-sample_test.go index cdaa5d0..0ace686 100644 --- a/xfs/nav/traverse-sample_test.go +++ b/xfs/nav/traverse-sample_test.go @@ -4,10 +4,10 @@ import ( "fmt" "strings" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok "github.com/samber/lo" - . "github.com/snivilised/extendio/i18n" + . "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok "github.com/snivilised/extendio/internal/helpers" "github.com/snivilised/extendio/xfs/nav" diff --git a/xfs/storage/storage-suite_test.go b/xfs/storage/storage-suite_test.go index 8c58349..1a18707 100644 --- a/xfs/storage/storage-suite_test.go +++ b/xfs/storage/storage-suite_test.go @@ -3,8 +3,8 @@ package storage_test import ( "testing" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok ) func TestStorage(t *testing.T) { diff --git a/xfs/storage/virtual-fs_test.go b/xfs/storage/virtual-fs_test.go index 869569b..a52c7b4 100644 --- a/xfs/storage/virtual-fs_test.go +++ b/xfs/storage/virtual-fs_test.go @@ -5,10 +5,10 @@ import ( "os" "path/filepath" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok - . "github.com/snivilised/extendio/i18n" + . "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok "github.com/snivilised/extendio/xfs/storage" ) @@ -302,7 +302,7 @@ var _ = Describe("virtual-fs", Ordered, func() { Entry(nil, &virtualTE{ message: "Remove", should: "remove file at path", - fn: func(vfs storage.VirtualFS, isNative bool) { + fn: func(vfs storage.VirtualFS, _ bool) { path := filepath.Join(root, "shroud.txt") setupFiles(vfs, root, &setupFile{ filePath: path, @@ -320,7 +320,7 @@ var _ = Describe("virtual-fs", Ordered, func() { Entry(nil, &virtualTE{ message: "RemoveAll", should: "remove all at path", - fn: func(vfs storage.VirtualFS, isNative bool) { + fn: func(vfs storage.VirtualFS, _ bool) { path := filepath.Join(root, "__A") setupFiles(vfs, path, diff --git a/xfs/utils/ensure-path-at_test.go b/xfs/utils/ensure-path-at_test.go index 0bfca76..6661e7f 100644 --- a/xfs/utils/ensure-path-at_test.go +++ b/xfs/utils/ensure-path-at_test.go @@ -4,8 +4,8 @@ import ( "fmt" "path/filepath" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok "github.com/snivilised/extendio/internal/helpers" "github.com/snivilised/extendio/xfs/matchers" diff --git a/xfs/utils/exists_test.go b/xfs/utils/exists_test.go index 8a1213f..816f382 100644 --- a/xfs/utils/exists_test.go +++ b/xfs/utils/exists_test.go @@ -5,8 +5,8 @@ import ( "path/filepath" "strings" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok "github.com/snivilised/extendio/internal/helpers" "github.com/snivilised/extendio/xfs/utils" @@ -26,14 +26,14 @@ var _ = Describe("Exists Utils", Ordered, func() { }) DescribeTable("Exists", - func(message, relative string, expected bool) { + func(_, relative string, expected bool) { path := path(repo, relative) GinkgoWriter.Printf("---> 🔰 FULL-PATH: '%v'\n", path) Expect(utils.Exists(path)).To(Equal(expected)) }, - func(message, relative string, expected bool) string { + func(message, _ string, _ bool) string { return fmt.Sprintf("🥣 message: '%v'", message) }, Entry(nil, "folder exists", "/", true), @@ -42,13 +42,13 @@ var _ = Describe("Exists Utils", Ordered, func() { ) DescribeTable("FolderExists", - func(message, relative string, expected bool) { + func(_, relative string, expected bool) { path := path(repo, relative) GinkgoWriter.Printf("---> 🔰 FULL-PATH: '%v'\n", path) Expect(utils.FolderExists(path)).To(Equal(expected)) }, - func(message, relative string, expected bool) string { + func(message, _ string, _ bool) string { return fmt.Sprintf("🍤 message: '%v'", message) }, Entry(nil, "folder exists", "/", true), @@ -57,13 +57,13 @@ var _ = Describe("Exists Utils", Ordered, func() { ) DescribeTable("FileExists", - func(message, relative string, expected bool) { + func(_, relative string, expected bool) { path := path(repo, relative) GinkgoWriter.Printf("---> 🔰 FULL-PATH: '%v'\n", path) Expect(utils.FileExists(path)).To(Equal(expected)) }, - func(message, relative string, expected bool) string { + func(message, _ string, _ bool) string { return fmt.Sprintf("🍤 message: '%v'", message) }, Entry(nil, "file exists", "README.md", true), diff --git a/xfs/utils/is-nil_test.go b/xfs/utils/is-nil_test.go index 6d58d30..16f9e64 100644 --- a/xfs/utils/is-nil_test.go +++ b/xfs/utils/is-nil_test.go @@ -1,8 +1,8 @@ package utils_test import ( - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok "github.com/snivilised/extendio/xfs/utils" ) diff --git a/xfs/utils/member-property_test.go b/xfs/utils/member-property_test.go index eb5c105..093081f 100644 --- a/xfs/utils/member-property_test.go +++ b/xfs/utils/member-property_test.go @@ -1,8 +1,8 @@ package utils_test import ( - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok "github.com/snivilised/extendio/xfs/utils" ) @@ -197,7 +197,7 @@ var _ = Describe("Property", func() { It("should: retrieve property value", func() { factory := utils.PutPropFactory[int]{} w := &widget{ - rank: factory.New(77, func(value int) {}), + rank: factory.New(77, func(_ int) {}), } Expect(w.rank.Get()).To(Equal(77)) }) @@ -207,7 +207,7 @@ var _ = Describe("Property", func() { It("should: set property value", func() { factory := utils.PutPropFactory[int]{} w := &widget{ - rank: factory.New(77, func(value int) {}), + rank: factory.New(77, func(_ int) {}), } w.rank.Set(88) Expect(w.rank.Get()).To(Equal(88)) @@ -233,7 +233,7 @@ var _ = Describe("Property", func() { It("should: return false without panic", func() { factory := utils.PutPropFactory[int]{} w := &widget{ - rank: factory.New(77, func(value int) {}), + rank: factory.New(77, func(_ int) {}), } Expect(w.rank.IsNone()).To(BeFalse()) }) @@ -244,7 +244,7 @@ var _ = Describe("Property", func() { It("should: return false without panic", func() { factory := utils.PutPropFactory[int]{Zeroable: true} w := &widget{ - rank: factory.New(0, func(value int) {}), + rank: factory.New(0, func(_ int) {}), } Expect(w.rank.IsNone()).To(BeFalse()) }) @@ -254,7 +254,7 @@ var _ = Describe("Property", func() { It("should: return false without panic", func() { factory := utils.PutPropFactory[int]{} w := &widget{ - rank: factory.New(0, func(value int) {}), + rank: factory.New(0, func(_ int) {}), } Expect(w.rank.IsNone()).To(BeTrue()) }) diff --git a/xfs/utils/resolve-path.go b/xfs/utils/resolve-path.go index 2f930d4..5e05282 100644 --- a/xfs/utils/resolve-path.go +++ b/xfs/utils/resolve-path.go @@ -49,12 +49,14 @@ func ResolvePath(path string, mocks ...ResolveMocks) string { if h, err := m.HomeFunc(); err == nil { return filepath.Join(h, result[1:]) } + return path }, func() string { if a, err := m.AbsFunc(result); err == nil { return a } + return path }, ) @@ -64,12 +66,14 @@ func ResolvePath(path string, mocks ...ResolveMocks) string { if h, err := os.UserHomeDir(); err == nil { return filepath.Join(h, result[1:]) } + return path }, func() string { if a, err := filepath.Abs(result); err == nil { return a } + return path }, ) diff --git a/xfs/utils/resolve-path_test.go b/xfs/utils/resolve-path_test.go index 75b34a7..2f61453 100644 --- a/xfs/utils/resolve-path_test.go +++ b/xfs/utils/resolve-path_test.go @@ -5,8 +5,8 @@ import ( "path/filepath" "strings" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok "github.com/snivilised/extendio/xfs/utils" ) diff --git a/xfs/utils/utils_suite_test.go b/xfs/utils/utils_suite_test.go index 9ca82ff..3c723a3 100644 --- a/xfs/utils/utils_suite_test.go +++ b/xfs/utils/utils_suite_test.go @@ -3,8 +3,8 @@ package utils_test import ( "testing" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok ) func TestUtils(t *testing.T) {