diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 827198a..662c533 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,8 +14,6 @@ jobs: steps: - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 - with: - go-version: '1.22' - name: build run: go build ./... - name: test @@ -25,8 +23,6 @@ jobs: steps: - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 - with: - go-version: '1.22' - uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 with: - version: v1.56.2 + version: v1.61.0 diff --git a/.golangci.yml b/.golangci.yml index bc496f8..c432bd7 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,4 +1,5 @@ -go: '1.22' +run: + go: '1.23' linters: enable: @@ -6,8 +7,10 @@ linters: - asciicheck - bidichk - bodyclose + - canonicalheader - containedctx - contextcheck + - copyloopvar - decorder - dogsled - dupl @@ -17,14 +20,14 @@ linters: - errchkjson - errname - errorlint - - execinquery - exhaustive - - exportloopref + - fatcontext - forcetypeassert - gci - ginkgolinter - gocheckcompilerdirectives - gochecknoinits + - gochecksumtype - gocritic - godot - gofmt @@ -36,14 +39,18 @@ linters: - goprintffuncname - gosec - gosimple + - gosmopolitan - govet - grouper - importas + - inamedparam - ineffassign - interfacebloat + - intrange - ireturn - loggercheck - makezero + - mirror - misspell - musttag - nakedret @@ -53,28 +60,37 @@ linters: - nolintlint - nonamedreturns - nosprintfhostport + - perfsprint - prealloc - predeclared - promlinter + - protogetter - reassign - revive - rowserrcheck + - sloglint + - spancheck - sqlclosecheck - staticcheck - stylecheck + - tagalign - tagliatelle - tenv - testableexamples + - testifylint - thelper - typecheck - unconvert - unparam - unused - usestdlibvars + - wastedassign - whitespace + - zerologlint disable: - cyclop - depguard + - err113 - exhaustruct - forbidigo - funlen @@ -83,15 +99,15 @@ linters: - goconst - gocyclo - godox - - goerr113 - gomnd - lll - maintidx - - maligned + - mnd - nestif - nlreturn - paralleltest - testpackage + - tparallel - varnamelen - wrapcheck - wsl diff --git a/internal/dupfind/dupfinder.go b/internal/dupfind/dupfinder.go index 02fd69e..4a8c4cd 100644 --- a/internal/dupfind/dupfinder.go +++ b/internal/dupfind/dupfinder.go @@ -123,7 +123,6 @@ func (f *DupFinder) FindDuplicates() (map[string][]string, error) { defer close(regularFilesCh) var wg sync.WaitGroup for _, root := range f.roots { - root := root wg.Add(1) go func() { defer wg.Done() @@ -232,7 +231,7 @@ func (f *DupFinder) concurrentWalkDir(root string, walkDirFunc fs.WalkDirFunc, e files++ } } - f.statistics.files.Add(uint64(files)) + f.statistics.files.Add(uint64(files)) //nolint:gosec var wg sync.WaitGroup FOR: for _, dirEntry := range dirEntries { @@ -289,7 +288,7 @@ func (f *DupFinder) findRegularFiles(root string, regularFilesCh chan<- pathWith return err } size := fileInfo.Size() - f.statistics.totalBytes.Add(uint64(size)) + f.statistics.totalBytes.Add(uint64(size)) //nolint:gosec regularFilesCh <- pathWithSize{ path: path, size: size, @@ -327,7 +326,7 @@ func (f *DupFinder) hashPath(p pathWithSize) (xxh3.Uint128, error) { if err != nil { return xxh3.Uint128{}, err } - f.statistics.bytesHashed.Add(uint64(written)) + f.statistics.bytesHashed.Add(uint64(written)) //nolint:gosec return hash.Sum128(), nil } @@ -336,7 +335,6 @@ func (f *DupFinder) hashPath(p pathWithSize) (xxh3.Uint128, error) { func (f *DupFinder) hashPaths(pathsWithHashCh chan<- pathWithHash, pathsToHashCh <-chan pathWithSize, errCh chan<- error) { var wg sync.WaitGroup for pathWithSize := range pathsToHashCh { - pathWithSize := pathWithSize wg.Add(1) go func() { defer wg.Done()