From 2f5dfa119525c9fb04cca1b4c6d3a2ece7420420 Mon Sep 17 00:00:00 2001 From: Fabio Bonelli Date: Fri, 22 Sep 2023 14:41:02 +0200 Subject: [PATCH] refactor: add constant and disable gomnd linter Add gomnd to the list of disabled linters because it the majority of issues it catches are not really issues. --- .golangci.yaml | 4 +++- crawler/crawler.go | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 90c8ccb..0b92b2a 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -103,7 +103,6 @@ linters: - gofumpt - goheader - goimports - # - gomnd - gomoddirectives - gomodguard - goprintffuncname @@ -169,6 +168,9 @@ linters: # # Don't feel about chasing this one down # - musttag + # More false positive than actual issues + - gomnd + # Run only fast linters from enabled linters set (first run won't be fast) # Default: false # fast: true diff --git a/crawler/crawler.go b/crawler/crawler.go index dd4185a..7a91d9b 100644 --- a/crawler/crawler.go +++ b/crawler/crawler.go @@ -44,6 +44,7 @@ type Crawler struct { // NewCrawler initializes a new Crawler object and connects to Elasticsearch (if dryRun == false). func NewCrawler(dryRun bool) *Crawler { var c Crawler + const channelSize = 1000 c.DryRun = dryRun @@ -53,7 +54,7 @@ func NewCrawler(dryRun bool) *Crawler { } // Initiate a channel of repositories. - c.repositories = make(chan common.Repository, 1000) + c.repositories = make(chan common.Repository, channelSize) // Register Prometheus metrics. metrics.RegisterPrometheusCounter("repository_processed", "Number of repository processed.", c.Index)