Fix findings to make lint pass

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
This commit is contained in:
Manuel Rüger 2021-11-18 16:08:33 +01:00
parent f4510e454b
commit 2e78af1ccd
5 changed files with 13 additions and 11 deletions

View File

@ -1,20 +1,21 @@
run: run:
deadline: 2m deadline: 5m
linters: linters:
disable-all: true disable-all: true
enable: enable:
- gocritic
- gocyclo
- gofmt - gofmt
- goimports - goimports
- golint - gosimple
- staticcheck - govet
- gocyclo
- ineffassign - ineffassign
- misspell - misspell
- gocritic
- govet
- unconvert
- promlinter - promlinter
- revive
- staticcheck
- unconvert
linters-settings: linters-settings:
goimports: goimports:

View File

@ -33,7 +33,7 @@ import (
var ( var (
descPersistentVolumeClaimRefName = "kube_persistentvolume_claim_ref" descPersistentVolumeClaimRefName = "kube_persistentvolume_claim_ref"
descPersistentVolumeClaimRefHelp = "Information about the Persitant Volume Claim Reference." descPersistentVolumeClaimRefHelp = "Information about the Persistent Volume Claim Reference."
descPersistentVolumeClaimRefDefaultLabels = []string{"persistentvolume"} descPersistentVolumeClaimRefDefaultLabels = []string{"persistentvolume"}
descPersistentVolumeAnnotationsName = "kube_persistentvolume_annotations" descPersistentVolumeAnnotationsName = "kube_persistentvolume_annotations"

View File

@ -441,7 +441,7 @@ func TestPersistentVolumeStore(t *testing.T) {
}, },
}, },
Want: ` Want: `
# HELP kube_persistentvolume_claim_ref Information about the Persitant Volume Claim Reference. # HELP kube_persistentvolume_claim_ref Information about the Persistent Volume Claim Reference.
# TYPE kube_persistentvolume_claim_ref gauge # TYPE kube_persistentvolume_claim_ref gauge
kube_persistentvolume_claim_ref{claim_namespace="default",name="pv-claim",persistentvolume="test-claimed-pv"} 1 kube_persistentvolume_claim_ref{claim_namespace="default",name="pv-claim",persistentvolume="test-claimed-pv"} 1
`, `,
@ -457,7 +457,7 @@ func TestPersistentVolumeStore(t *testing.T) {
}, },
}, },
Want: ` Want: `
# HELP kube_persistentvolume_claim_ref Information about the Persitant Volume Claim Reference. # HELP kube_persistentvolume_claim_ref Information about the Persistent Volume Claim Reference.
# TYPE kube_persistentvolume_claim_ref gauge # TYPE kube_persistentvolume_claim_ref gauge
`, `,
MetricNames: []string{"kube_persistentvolume_claim_ref"}, MetricNames: []string{"kube_persistentvolume_claim_ref"},

View File

@ -1,3 +1,4 @@
//go:build linux
// +build linux // +build linux
/* /*

View File

@ -121,7 +121,7 @@ func TestDocumentation(t *testing.T) {
for _, labelPattern := range acceptedLabelNames { for _, labelPattern := range acceptedLabelNames {
re, err := regexp.Compile(labelPattern) re, err := regexp.Compile(labelPattern)
if err != nil { if err != nil {
t.Errorf("Cannot compile pattern %s: %w", labelPattern, err) t.Errorf("Cannot compile pattern %s: %v", labelPattern, err)
continue continue
} }
if re.MatchString(labelName) { if re.MatchString(labelName) {