Skip to content

Commit

Permalink
Merge pull request #297 from navidys/gh_golangci_lint
Browse files Browse the repository at this point in the history
github action - fix golangci-lint failure
  • Loading branch information
navidys authored Oct 26, 2024
2 parents 9715e0d + 6fa606f commit 10a7dad
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 19 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ jobs:
make lint
make gofmt
tests_podmanv5:
runs-on: ubuntu-latest
container:
Expand Down
22 changes: 8 additions & 14 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
run:
timeout: 10m
deadline: 5m
skip-files:
- ".*_test.go"
linters:
enable-all: true
disable:
Expand All @@ -11,32 +10,27 @@ linters:
- exhaustruct
- ireturn
- gochecknoglobals
- exhaustivestruct
- funlen
- golint
- forbidigo
- maligned
- interfacer
- scopelint
- gomoddirectives
- depguard
# deprecated
- varcheck
- deadcode
- ifshort
- nosnakecase
- structcheck
- execinquery
- gomnd
- exportloopref
- rowserrcheck
- structcheck
- wastedassign
linters-settings:
errcheck:
check-blank: false
ignore: fmt:.*
exclude-functions:
# Used in HTTP handlers, any error is handled by the server itself.
- (net/http.ResponseWriter).Write
# Never check the logger error.
- (github.com/go-kit/log.Logger).Log
nolintlint:
require-specific: true

issues:
exclude-files:
- ".*_test.go"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ install.tools: .install.pre-commit .install.codespell .install.golangci-lint .in

.PHONY: .install.golangci-lint
.install.golangci-lint:
VERSION=1.56.2 ./hack/install_golangci.sh
VERSION=1.61.0 ./hack/install_golangci.sh

#=================================================
# Linting/Formatting/Code Validation targets
Expand Down
4 changes: 2 additions & 2 deletions collector/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ func (c *containerCollector) Update(ch chan<- prometheus.Metric) error {
cntStat := getContainerStat(rep.ID, statReports)

ch <- c.info.mustNewConstMetric(1, cntLabelsInfo.labelsValue...)
c.updateInfo(ch, &rep, cntLabelsInfo, defaultContainersLabel, enhanceAllMetrics) //nolint:gosec
c.updateStats(ch, &rep, cntStat, cntLabelsInfo, defaultContainersLabel, enhanceAllMetrics) //nolint:gosec
c.updateInfo(ch, &rep, cntLabelsInfo, defaultContainersLabel, enhanceAllMetrics)
c.updateStats(ch, &rep, cntStat, cntLabelsInfo, defaultContainersLabel, enhanceAllMetrics)
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion exporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func Start(cmd *cobra.Command, _ []string) error {
level.Info(logger).Log("msg", "Listening on", "address", cmdOptions.webListen)

server := &http.Server{
ReadHeaderTimeout: 3 * time.Second, //nolint:gomnd
ReadHeaderTimeout: 3 * time.Second, //nolint:mnd
}
serverSystemd := false
serverWebListen := []string{cmdOptions.webListen}
Expand Down
2 changes: 1 addition & 1 deletion pdcs/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func updateImages() {

for _, rep := range reports {
if len(rep.RepoTags) > 0 {
for i := 0; i < len(rep.RepoTags); i++ {
for i := range len(rep.RepoTags) {
repository, tag := repoTagDecompose(rep.RepoTags[i])

images = append(images, Image{
Expand Down

0 comments on commit 10a7dad

Please sign in to comment.