Skip to content

Commit

Permalink
minor fix + add golangci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarbonne committed Nov 25, 2024
1 parent 8990291 commit 6a7ab3a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
21 changes: 21 additions & 0 deletions .github/workflows/golang-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: golangci-lint
on:
push:
pull_request:

permissions:
contents: read

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: stable
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.60
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: tests

on:
push:
pull_request:

jobs:
run-tests:
Expand Down
5 changes: 4 additions & 1 deletion pkg/scraping/provider/filesystemusage.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@ func NewProviderFileSystemUsage(params map[string]any, scrapeInterval time.Durat
}
})
cfg, err := configmapper.MapOnStructWithContext[ProviderFileSystemUsage](&mapperCtx, params)
if err != nil {
return nil, err
}
cfg.mountPointStats = make(map[string]*stats.WindowCollector[uint64])
if cfg.RateThresholdWindow < scrapeInterval {
return nil, fmt.Errorf("rate_threshold must be greater than or equal to scrape_interval")
return nil, fmt.Errorf("rate_threshold_window must be greater than or equal to scrape_interval (%v < %v)", cfg.RateThresholdWindow, scrapeInterval)
}
return &cfg, err
}
Expand Down

0 comments on commit 6a7ab3a

Please sign in to comment.