Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump to go 1.22 and fixes #8035

Merged
merged 6 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ jobs:

- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: '1.22.x'

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
8 changes: 7 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Documentation: https://golangci-lint.run/usage/configuration/

linters-settings:
gosec:
excludes:
- G601
exclude-generated: true
errcheck:
exclude-functions:
- (*github.com/tektoncd/pipeline/vendor/go.uber.org/zap.SugaredLogger).Sync
Expand Down Expand Up @@ -80,12 +85,13 @@ linters:
- gocyclo
- godot
- godox
- goerr113
- err113
- gofumpt
- gomnd
- gomoddirectives
- ireturn
- lll
- mnd
- nestif
- nlreturn
- nonamedreturns
Expand Down
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ 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
# Get golangci_version from tools/go.mod
GOLANGCI_VERSION := $(shell cat tools/go.mod | grep golangci-lint | awk '{ print $$3 }')
WOKE_VERSION = v0.19.0

GO = go
Expand Down Expand Up @@ -164,9 +165,10 @@ $(BIN)/errcheck: PACKAGE=github.com/kisielk/errcheck
errcheck: | $(ERRCHECK) ; $(info $(M) running errcheck…) ## Run errcheck
$Q $(ERRCHECK) ./...

GOLANGCILINT = $(BIN)/golangci-lint
$(BIN)/golangci-lint: ; $(info $(M) getting golangci-lint $(GOLANGCI_VERSION))
cd tools; GOBIN=$(BIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_VERSION)
GOLANGCILINT = $(BIN)/golangci-lint-$(GOLANGCI_VERSION)
$(BIN)/golangci-lint-$(GOLANGCI_VERSION): ; $(info $(M) getting golangci-lint $(GOLANGCI_VERSION))
cd tools; go mod download github.com/golangci/golangci-lint && go mod tidy
cd tools; go build -o $(BIN)/golangci-lint-$(GOLANGCI_VERSION) github.com/golangci/golangci-lint/cmd/golangci-lint

.PHONY: golangci-lint
golangci-lint: | $(GOLANGCILINT) ; $(info $(M) running golangci-lint…) @ ## Run golangci-lint
Expand Down
10 changes: 1 addition & 9 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/tektoncd/pipeline

go 1.21
go 1.22

require (
github.com/Microsoft/go-winio v0.6.2 // indirect
Expand Down Expand Up @@ -37,14 +37,6 @@ require (
sigs.k8s.io/yaml v1.4.0
)

// TODO: Remove this once https://github.com/knative/pkg/issues/2759 is fixed
replace (
k8s.io/api => k8s.io/api v0.29.2
k8s.io/apimachinery => k8s.io/apimachinery v0.29.2
k8s.io/client-go => k8s.io/client-go v0.29.2
k8s.io/code-generator => k8s.io/code-generator v0.29.2
)

require (
code.gitea.io/sdk/gitea v0.18.0
github.com/go-jose/go-jose/v3 v3.0.3
Expand Down
1,110 changes: 21 additions & 1,089 deletions go.sum

Large diffs are not rendered by default.

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
3 changes: 0 additions & 3 deletions pkg/apis/pipeline/v1/param_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ type ParamValuesHolder struct {
AOrS v1.ParamValue `json:"val"`
}

//nolint:musttag
func TestParamValues_UnmarshalJSON(t *testing.T) {
cases := []struct {
input map[string]interface{}
Expand Down Expand Up @@ -399,7 +398,6 @@ func TestParamValues_UnmarshalJSON_Directly(t *testing.T) {
}
}

//nolint:musttag
func TestParamValues_UnmarshalJSON_Error(t *testing.T) {
cases := []struct {
desc string
Expand All @@ -417,7 +415,6 @@ func TestParamValues_UnmarshalJSON_Error(t *testing.T) {
}
}

//nolint:musttag
func TestParamValues_MarshalJSON(t *testing.T) {
cases := []struct {
input v1.ParamValue
Expand Down
Loading