Skip to content

Commit

Permalink
Add linters that check for bugs (#779)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacome authored Jul 18, 2024
1 parent 2358dcc commit dccd7cc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,19 @@ linters:
- asasalint
- asciicheck
- bidichk
- contextcheck
- dupword
- durationcheck
- errcheck
- errchkjson
- errname
- errorlint
- exportloopref
- fatcontext
- forcetypeassert
- gocheckcompilerdirectives
- gochecksumtype
- gocritic
- godot
- gofmt
- gofumpt
Expand All @@ -58,6 +63,7 @@ linters:
- loggercheck
- makezero
- misspell
- musttag
- nilerr
- noctx
- nolintlint
Expand Down
7 changes: 5 additions & 2 deletions collector/nginx_plus.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,11 @@ func NewVariableLabelNames(upstreamServerVariableLabelNames []string, serverZone

// NewNginxPlusCollector creates an NginxPlusCollector.
func NewNginxPlusCollector(nginxClient *plusclient.NginxClient, namespace string, variableLabelNames VariableLabelNames, constLabels map[string]string, logger log.Logger) *NginxPlusCollector {
upstreamServerVariableLabelNames := append(variableLabelNames.UpstreamServerVariableLabelNames, variableLabelNames.UpstreamServerPeerVariableLabelNames...)
streamUpstreamServerVariableLabelNames := append(variableLabelNames.StreamUpstreamServerVariableLabelNames, variableLabelNames.StreamUpstreamServerPeerVariableLabelNames...)
upstreamServerVariableLabelNames := variableLabelNames.UpstreamServerVariableLabelNames
streamUpstreamServerVariableLabelNames := variableLabelNames.StreamUpstreamServerVariableLabelNames

upstreamServerVariableLabelNames = append(upstreamServerVariableLabelNames, variableLabelNames.UpstreamServerPeerVariableLabelNames...)
streamUpstreamServerVariableLabelNames = append(streamUpstreamServerVariableLabelNames, variableLabelNames.StreamUpstreamServerPeerVariableLabelNames...)
return &NginxPlusCollector{
variableLabelNames: variableLabelNames,
upstreamServerLabels: make(map[string][]string),
Expand Down

0 comments on commit dccd7cc

Please sign in to comment.