Skip to content

Commit

Permalink
Update golangci-lint to 1.59.x and fix linting
Browse files Browse the repository at this point in the history
This mainly removing the need to copy variable in a for loop to
capture rang as it is now "fixed" in go 1.22+.

> The copy of the 'for' variable "td" can be deleted (Go 1.22+) (copyloopvar)

Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
  • Loading branch information
vdemeester committed Jun 10, 2024
1 parent 274035d commit 260e0bd
Show file tree
Hide file tree
Showing 39 changed files with 672 additions and 597 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ TESTPKGS = $(shell env GO111MODULE=on $(GO) list -f \
BIN = $(CURDIR)/.bin
WOKE ?= go run -modfile go.mod github.com/get-woke/woke

GOLANGCI_VERSION = v1.57.2
GOLANGCI_VERSION = v1.59.1
WOKE_VERSION = v0.19.0

GO = go
Expand Down
11 changes: 4 additions & 7 deletions internal/sidecarlogresults/sidecarlogresults.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ import (
)

// ErrSizeExceeded indicates that the result exceeded its maximum allowed size
var ErrSizeExceeded = errors.New("results size exceeds configured limit")
var stepDir = pipeline.StepsDir
var (
ErrSizeExceeded = errors.New("results size exceeds configured limit")
stepDir = pipeline.StepsDir
)

type SidecarLogResultType string

Expand Down Expand Up @@ -146,8 +148,6 @@ func LookForResults(w io.Writer, runDir string, resultsDir string, resultNames [
results := make(chan SidecarLogResult)
g := new(errgroup.Group)
for _, resultFile := range resultNames {
resultFile := resultFile

g.Go(func() error {
newResult, err := readResults(resultsDir, resultFile, "", taskResultType)
if err != nil {
Expand All @@ -162,10 +162,7 @@ func LookForResults(w io.Writer, runDir string, resultsDir string, resultNames [
}

for sName, sresults := range stepResults {
sresults := sresults
sName := sName
for _, resultName := range sresults {
resultName := resultName
stepResultsDir := filepath.Join(stepResultsDir, sName, "results")

g.Go(func() error {
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/config/feature_flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ func TestIsSpireEnabled(t *testing.T) {
Data: tc.configmap,
}
store.OnConfigChanged(featureflags)
ctx = store.ToContext(ctx)
ctx := store.ToContext(ctx)
got := config.IsSpireEnabled(ctx)

if tc.want != got {
Expand Down
2 changes: 0 additions & 2 deletions pkg/apis/pipeline/v1/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ func MergeStepsWithSpecs(steps []Step, overrides []TaskRunStepSpec) ([]Step, err
stepNameToOverride[o.Name] = o
}
for i, s := range steps {
s := s
o, found := stepNameToOverride[s.Name]
if !found {
continue
Expand All @@ -108,7 +107,6 @@ func MergeSidecarsWithSpecs(sidecars []Sidecar, overrides []TaskRunSidecarSpec)
sidecarNameToOverride[o.Name] = o
}
for i, s := range sidecars {
s := s
o, found := sidecarNameToOverride[s.Name]
if !found {
continue
Expand Down
Loading

0 comments on commit 260e0bd

Please sign in to comment.