Skip to content

Commit

Permalink
refactor: add constant and disable gomnd linter (#363)
Browse files Browse the repository at this point in the history
Add gomnd to the list of disabled linters because it the majority
of issues it catches are not really issues.
  • Loading branch information
bfabio authored Sep 22, 2023
1 parent 1cd59aa commit a8a2964
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ linters:
- gofumpt
- goheader
- goimports
# - gomnd
- gomoddirectives
- gomodguard
- goprintffuncname
Expand Down Expand Up @@ -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
3 changes: 2 additions & 1 deletion crawler/crawler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down

0 comments on commit a8a2964

Please sign in to comment.