diff --git a/.golangci.yml b/.golangci.yml index c911815..f2a7744 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -14,6 +14,10 @@ linters-settings: funlen: lines: -1 statements: 100 + errcheck: + exclude-functions: + - fmt.Fprintf + - fmt.Fprintln linters: enable-all: true @@ -50,6 +54,7 @@ linters: - lll - maintidx - maligned + - mnd - musttag - nilerr - noctx diff --git a/pkg/hibp/api/downloader.go b/pkg/hibp/api/downloader.go index d6bdfad..16a9fc0 100644 --- a/pkg/hibp/api/downloader.go +++ b/pkg/hibp/api/downloader.go @@ -47,8 +47,7 @@ func Download(ctx context.Context, path string, keep bool) error { sem := make(chan struct{}, runtime.NumCPU()*4) wg := &sync.WaitGroup{} - for i := 0; i < max; i++ { - i := i + for i := range max { wg.Add(1) go func() { sem <- struct{}{} diff --git a/pkg/hibp/dump/scanner.go b/pkg/hibp/dump/scanner.go index 9ac2c30..8ff73b6 100644 --- a/pkg/hibp/dump/scanner.go +++ b/pkg/hibp/dump/scanner.go @@ -312,7 +312,7 @@ func (s *Scanner) scanUnsortedFile(ctx context.Context, fn string, in []string, lines := make(chan string, 1024) worker := runtime.NumCPU() done := make(chan struct{}, worker) - for i := 0; i < worker; i++ { + for i := range worker { debug.Log("[%d] Starting matcher ...", i) go s.matcher(ctx, in, lines, results, done) } @@ -332,7 +332,7 @@ SCAN: } close(lines) - for i := 0; i < worker; i++ { + for range worker { <-done }