upgrade golangci-lint to v1.40.1 (#10276)

Also: fix linter issue detected with newer version
This commit is contained in:
Dhia Ayachi 2021-05-24 22:22:37 -04:00 committed by GitHub
parent bb07d1a30f
commit f2eed912b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 13 deletions

View File

@ -126,7 +126,7 @@ jobs:
name: Install golangci-lint
command: |
download=https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh
wget -O- -q $download | sh -x -s -- -d -b /go/bin/ v1.23.6
wget -O- -q $download | sh -x -s -- -d -b /go/bin/ v1.40.1
- run: go mod download
- run:
name: lint

View File

@ -8,7 +8,7 @@ GOTOOLS = \
github.com/gogo/protobuf/protoc-gen-gofast@$(GOGOVERSION) \
github.com/hashicorp/protoc-gen-go-binary \
github.com/vektra/mockery/cmd/mockery \
github.com/golangci/golangci-lint/cmd/golangci-lint@v1.23.6
github.com/golangci/golangci-lint/cmd/golangci-lint@v1.40.1
GOTAGS ?=
GOOS?=$(shell go env GOOS)

View File

@ -1429,18 +1429,16 @@ func (d *DNSServer) serviceNodeRecords(cfg *dnsConfig, dc string, nodes structs.
}
handled[records[0].String()] = struct{}{}
if records != nil {
switch records[0].(type) {
case *dns.CNAME:
// keep track of the first CNAME + associated RRs but don't add to the resp.Answer yet
// this will only be added if no non-CNAME RRs are found
if len(answerCNAME) == 0 {
answerCNAME = records
}
default:
resp.Answer = append(resp.Answer, records...)
had_answer = true
switch records[0].(type) {
case *dns.CNAME:
// keep track of the first CNAME + associated RRs but don't add to the resp.Answer yet
// this will only be added if no non-CNAME RRs are found
if len(answerCNAME) == 0 {
answerCNAME = records
}
default:
resp.Answer = append(resp.Answer, records...)
had_answer = true
}
if had_answer {