Skip to content

Commit 13d8efc

Browse files
authored
ci: Enable exportloopref (#2966)
* Enable exportloopref Signed-off-by: Kemal Akkoyun <[email protected]> * Upgrade golangci-lint Signed-off-by: Kemal Akkoyun <[email protected]>
1 parent 69b8760 commit 13d8efc

File tree

5 files changed

+42
-7
lines changed

5 files changed

+42
-7
lines changed

.bingo/Variables.mk

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ $(GOJSONTOYAML): .bingo/gojsontoyaml.mod
5858
@echo "(re)installing $(GOBIN)/gojsontoyaml-v0.0.0-20191212081931-bf2969bbd742"
5959
@cd .bingo && $(GO) build -modfile=gojsontoyaml.mod -o=$(GOBIN)/gojsontoyaml-v0.0.0-20191212081931-bf2969bbd742 "github.com/brancz/gojsontoyaml"
6060

61-
GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.27.0
61+
GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.29.0
6262
$(GOLANGCI_LINT): .bingo/golangci-lint.mod
6363
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
64-
@echo "(re)installing $(GOBIN)/golangci-lint-v1.27.0"
65-
@cd .bingo && $(GO) build -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.27.0 "github.com/golangci/golangci-lint/cmd/golangci-lint"
64+
@echo "(re)installing $(GOBIN)/golangci-lint-v1.29.0"
65+
@cd .bingo && $(GO) build -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.29.0 "github.com/golangci/golangci-lint/cmd/golangci-lint"
6666

6767
HUGO := $(GOBIN)/hugo-v0.55.3
6868
$(HUGO): .bingo/hugo.mod

.bingo/golangci-lint.mod

+34-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,37 @@ module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT
22

33
go 1.14
44

5-
require github.com/golangci/golangci-lint v1.27.0 // cmd/golangci-lint
5+
require (
6+
github.com/Djarvur/go-err113 v0.1.0 // indirect
7+
github.com/coreos/go-etcd v2.0.0+incompatible // indirect
8+
github.com/cpuguy83/go-md2man v1.0.10 // indirect
9+
github.com/gogo/protobuf v1.3.1 // indirect
10+
github.com/golangci/golangci-lint v1.29.0 // cmd/golangci-lint
11+
github.com/golangci/misspell v0.3.5 // indirect
12+
github.com/golangci/revgrep v0.0.0-20180812185044-276a5c0a1039 // indirect
13+
github.com/google/go-cmp v0.5.1 // indirect
14+
github.com/gostaticanalysis/analysisutil v0.1.0 // indirect
15+
github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect
16+
github.com/klauspost/cpuid v1.2.0 // indirect
17+
github.com/mitchellh/mapstructure v1.3.3 // indirect
18+
github.com/pelletier/go-toml v1.8.0 // indirect
19+
github.com/quasilyte/go-ruleguard v0.1.3 // indirect
20+
github.com/quasilyte/regex/syntax v0.0.0-20200419152657-af9db7f4a3ab // indirect
21+
github.com/securego/gosec/v2 v2.4.0 // indirect
22+
github.com/spf13/afero v1.3.2 // indirect
23+
github.com/spf13/cast v1.3.1 // indirect
24+
github.com/spf13/jwalterweatherman v1.1.0 // indirect
25+
github.com/stretchr/objx v0.3.0 // indirect
26+
github.com/tdakkota/asciicheck v0.0.0-20200416200610-e657995f937b // indirect
27+
github.com/tetafro/godot v0.4.8 // indirect
28+
github.com/timakin/bodyclose v0.0.0-20200424151742-cb6215831a94 // indirect
29+
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8 // indirect
30+
golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1 // indirect
31+
golang.org/x/text v0.3.3 // indirect
32+
golang.org/x/tools v0.0.0-20200731060945-b5fad4ed8dd6 // indirect
33+
gopkg.in/ini.v1 v1.57.0 // indirect
34+
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect
35+
honnef.co/go/tools v0.0.1-2020.1.5 // indirect
36+
mvdan.cc/unparam v0.0.0-20200501210554-b37ab49443f7 // indirect
37+
sourcegraph.com/sqs/pbtypes v1.0.0 // indirect
38+
)

.bingo/variables.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ GOIMPORTS="${gobin}/goimports-v0.0.0-20200526224456-8b020aee10d2"
2222

2323
GOJSONTOYAML="${gobin}/gojsontoyaml-v0.0.0-20191212081931-bf2969bbd742"
2424

25-
GOLANGCI_LINT="${gobin}/golangci-lint-v1.27.0"
25+
GOLANGCI_LINT="${gobin}/golangci-lint-v1.29.0"
2626

2727
HUGO="${gobin}/hugo-v0.55.3"
2828

.golangci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ linters:
4646
- unparam
4747
- unused
4848
- varcheck
49+
- exportloopref
4950

5051
linters-settings:
5152
errcheck:

pkg/rules/manager.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ import (
2323
"github.com/prometheus/prometheus/pkg/rulefmt"
2424
"github.com/prometheus/prometheus/rules"
2525
tsdberrors "github.com/prometheus/prometheus/tsdb/errors"
26+
"gopkg.in/yaml.v3"
27+
2628
"github.com/thanos-io/thanos/pkg/extprom"
2729
"github.com/thanos-io/thanos/pkg/rules/rulespb"
2830
"github.com/thanos-io/thanos/pkg/store/storepb"
29-
"gopkg.in/yaml.v3"
3031
)
3132

3233
const tmpRuleDir = ".tmp-rules"
@@ -95,7 +96,7 @@ func ActiveAlertsToProto(s storepb.PartialResponseStrategy, a *rules.AlertingRul
9596
Labels: rulespb.PromLabels{Labels: storepb.PromLabelsToLabels(ruleAlert.Labels)},
9697
Annotations: rulespb.PromLabels{Labels: storepb.PromLabelsToLabels(ruleAlert.Annotations)},
9798
State: rulespb.AlertState(ruleAlert.State),
98-
ActiveAt: &ruleAlert.ActiveAt,
99+
ActiveAt: &ruleAlert.ActiveAt, //nolint:exportloopref
99100
Value: strconv.FormatFloat(ruleAlert.Value, 'e', -1, 64),
100101
}
101102
}

0 commit comments

Comments
 (0)