Skip to content

Commit 192ee89

Browse files
authored
go1.22 support (#4272)
1 parent 6e09a20 commit 192ee89

File tree

16 files changed

+41
-22
lines changed

16 files changed

+41
-22
lines changed

.github/workflows/documentation.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
name: Build and deploy documentation
1212
runs-on: ubuntu-latest
1313
env:
14-
GO_VERSION: '1.21'
14+
GO_VERSION: '1.22'
1515
NODE_VERSION: '20.x'
1616
CGO_ENABLED: 0
1717

.github/workflows/post-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
# ex:
1919
# - 1.18beta1 -> 1.18.0-beta.1
2020
# - 1.18rc1 -> 1.18.0-rc.1
21-
go-version: '1.21'
21+
go-version: '1.22'
2222

2323
- name: Update GitHub action config
2424
run: make assets/github-action-config.json

.github/workflows/pr-documentation.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
name: Build documentation
1010
runs-on: ubuntu-latest
1111
env:
12-
GO_VERSION: '1.21'
12+
GO_VERSION: '1.22'
1313
NODE_VERSION: '20.x'
1414
CGO_ENABLED: 0
1515

.github/workflows/pr-extra.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
# ex:
1818
# - 1.18beta1 -> 1.18.0-beta.1
1919
# - 1.18rc1 -> 1.18.0-rc.1
20-
go-version: '1.21'
20+
go-version: '1.22'
2121
- name: Run go list
2222
run: go list -json -m all > go.list
2323
- name: Nancy

.github/workflows/pr.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
pull_request:
77

88
env:
9-
GO_VERSION: '1.21'
9+
GO_VERSION: '1.22'
1010

1111
jobs:
1212
# Check if there is any dirty change for go mod tidy
@@ -42,7 +42,9 @@ jobs:
4242
# ex:
4343
# - 1.18beta1 -> 1.18.0-beta.1
4444
# - 1.18rc1 -> 1.18.0-rc.1
45-
go-version: ${{ env.GO_VERSION }}
45+
# TODO(ldez) must be changed after the first release of golangci-lint with go1.22
46+
# go-version: ${{ env.GO_VERSION }}
47+
go-version: '1.21'
4648
- name: lint
4749
uses: golangci/[email protected]
4850
with:
@@ -89,8 +91,8 @@ jobs:
8991
strategy:
9092
matrix:
9193
golang:
92-
- '1.20'
9394
- '1.21'
95+
- '1.22'
9496
steps:
9597
- uses: actions/checkout@v4
9698
- name: Install Go

.github/workflows/tag.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
# ex:
1717
# - 1.18beta1 -> 1.18.0-beta.1
1818
# - 1.18rc1 -> 1.18.0-rc.1
19-
go-version: '1.21'
19+
go-version: '1.22'
2020
- name: Unshallow
2121
run: git fetch --prune --unshallow
2222

@@ -46,7 +46,7 @@ jobs:
4646
# ex:
4747
# - 1.18beta1 -> 1.18.0-beta.1
4848
# - 1.18rc1 -> 1.18.0-rc.1
49-
go-version: '1.21'
49+
go-version: '1.22'
5050

5151
- name: Unshallow
5252
run: git fetch --prune --unshallow

build/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# stage 1 building the code
2-
FROM golang:1.21 as builder
2+
FROM golang:1.22 as builder
33

44
ARG VERSION
55
ARG SHORT_COMMIT
@@ -12,7 +12,7 @@ RUN APP_VERSION=${VERSION#v} \
1212
go build -trimpath -ldflags "-s -w -X main.version=$APP_VERSION -X main.commit=$SHORT_COMMIT -X main.date=$DATE" -o golangci-lint ./cmd/golangci-lint/main.go
1313

1414
# stage 2
15-
FROM golang:1.21
15+
FROM golang:1.22
1616
# related to https://github.com/golangci/golangci-lint/issues/3107
1717
ENV GOROOT /usr/local/go
1818
# Set all directories as safe

build/alpine.Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# stage 1 building the code
2-
FROM golang:1.21-alpine as builder
2+
FROM golang:1.22-alpine as builder
33

44
ARG VERSION
55
ARG SHORT_COMMIT
@@ -17,7 +17,7 @@ RUN APP_VERSION=${VERSION#v} \
1717
go build -trimpath -ldflags "-s -w -X main.version=$APP_VERSION -X main.commit=$SHORT_COMMIT -X main.date=$DATE" -o golangci-lint ./cmd/golangci-lint/main.go
1818

1919
# stage 2
20-
FROM golang:1.21-alpine
20+
FROM golang:1.22-alpine
2121
# related to https://github.com/golangci/golangci-lint/issues/3107
2222
ENV GOROOT /usr/local/go
2323
# gcc is required to support cgo;

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/golangci/golangci-lint
22

3-
go 1.20
3+
go 1.21
44

55
require (
66
4d63.com/gocheckcompilerdirectives v1.2.1

go.sum

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/config/config.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ type Version struct {
4141
Debug bool `mapstructure:"debug"`
4242
}
4343

44-
func IsGreaterThanOrEqualGo121(v string) bool {
44+
func IsGreaterThanOrEqualGo122(v string) bool {
4545
v1, err := hcversion.NewVersion(strings.TrimPrefix(v, "go"))
4646
if err != nil {
4747
return false
4848
}
4949

50-
limit, err := hcversion.NewVersion("1.21")
50+
limit, err := hcversion.NewVersion("1.22")
5151
if err != nil {
5252
return false
5353
}

pkg/config/reader.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import (
55
"fmt"
66
"os"
77
"path/filepath"
8+
"slices"
89
"strings"
910

1011
"github.com/go-viper/mapstructure/v2"
1112
"github.com/mitchellh/go-homedir"
1213
"github.com/spf13/viper"
13-
"golang.org/x/exp/slices"
1414

1515
"github.com/golangci/golangci-lint/pkg/exitcodes"
1616
"github.com/golangci/golangci-lint/pkg/fsutils"

pkg/golinters/govet_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package golinters
22

33
import (
4+
"slices"
45
"testing"
56

6-
"golang.org/x/exp/slices"
77
"golang.org/x/tools/go/analysis"
88
"golang.org/x/tools/go/analysis/passes/asmdecl"
99
"golang.org/x/tools/go/analysis/passes/assign"

pkg/lint/linter/config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func (lc *Config) Name() string {
134134
}
135135

136136
func (lc *Config) WithNoopFallback(cfg *config.Config) *Config {
137-
if cfg != nil && config.IsGreaterThanOrEqualGo121(cfg.Run.Go) {
137+
if cfg != nil && config.IsGreaterThanOrEqualGo122(cfg.Run.Go) {
138138
lc.Linter = &Noop{
139139
name: lc.Linter.Name(),
140140
desc: lc.Linter.Desc(),

test/enabled_linters_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ package test
22

33
import (
44
"fmt"
5+
"slices"
56
"sort"
67
"strings"
78
"testing"
89

9-
"golang.org/x/exp/slices"
10-
1110
"github.com/golangci/golangci-lint/pkg/lint/lintersdb"
1211
"github.com/golangci/golangci-lint/test/testshared"
1312
)

test/testdata/zerologlint/zerologlint.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ package zerologlint
33

44
import (
55
"fmt"
6+
"slices"
67

78
"github.com/rs/zerolog"
89
"github.com/rs/zerolog/log"
9-
"golang.org/x/exp/slices"
1010
)
1111

1212
func expectWarnings() {

0 commit comments

Comments
 (0)