Skip to content

Commit e0a8bd8

Browse files
authored
go1.21 support (#3922)
1 parent c37828a commit e0a8bd8

File tree

14 files changed

+55
-16
lines changed

14 files changed

+55
-16
lines changed

.github/workflows/documentation.yml

Lines changed: 1 addition & 1 deletion
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.20'
14+
GO_VERSION: '1.21'
1515
NODE_VERSION: '20.x'
1616
CGO_ENABLED: 0
1717

.github/workflows/post-release.yml

Lines changed: 1 addition & 1 deletion
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.20'
21+
go-version: '1.21'
2222

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

.github/workflows/pr-extra.yml

Lines changed: 1 addition & 1 deletion
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.20'
20+
go-version: '1.21'
2121
- name: Run go list
2222
run: go list -json -m all > go.list
2323
- name: Nancy

.github/workflows/pr.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
pull_request:
77

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

1111
jobs:
1212
# Check if there is any dirty change for go mod tidy
@@ -41,7 +41,9 @@ jobs:
4141
# ex:
4242
# - 1.18beta1 -> 1.18.0-beta.1
4343
# - 1.18rc1 -> 1.18.0-rc.1
44-
go-version: ${{ env.GO_VERSION }}
44+
# TODO(ldez) must be changed after the first release of golangci-lint with go1.21
45+
# go-version: ${{ env.GO_VERSION }}
46+
go-version: '1.20'
4547
- name: lint
4648
uses: golangci/golangci-lint-action@v3.6.0
4749
with:
@@ -88,8 +90,8 @@ jobs:
8890
strategy:
8991
matrix:
9092
golang:
91-
- 1.19
9293
- '1.20'
94+
- '1.21'
9395
steps:
9496
- uses: actions/checkout@v3
9597
- name: Install Go

.github/workflows/tag.yml

Lines changed: 2 additions & 2 deletions
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.20'
21+
go-version: '1.21'
2222
- name: Unshallow
2323
run: git fetch --prune --unshallow
2424

@@ -48,7 +48,7 @@ jobs:
4848
# ex:
4949
# - 1.18beta1 -> 1.18.0-beta.1
5050
# - 1.18rc1 -> 1.18.0-rc.1
51-
go-version: '1.20'
51+
go-version: '1.21'
5252

5353
- name: Unshallow
5454
run: git fetch --prune --unshallow

.golangci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ issues:
155155
text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead."
156156
- path: pkg/golinters/unused.go
157157
text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)"
158+
- path: test/(fix|linters)_test.go
159+
text: "string `gocritic.go` has 3 occurrences, make it a constant"
158160

159161
run:
160162
timeout: 5m

build/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# stage 1 building the code
2-
FROM golang:1.20 as builder
2+
FROM golang:1.21 as builder
33

44
ARG VERSION
55
ARG SHORT_COMMIT
@@ -10,7 +10,7 @@ WORKDIR /golangci
1010
RUN CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X main.version=$VERSION -X main.commit=$SHORT_COMMIT -X main.date=$DATE" -o golangci-lint ./cmd/golangci-lint/main.go
1111

1212
# stage 2
13-
FROM golang:1.20
13+
FROM golang:1.21
1414
# related to https://github.com/golangci/golangci-lint/issues/3107
1515
ENV GOROOT /usr/local/go
1616
# don't place it into $GOPATH/bin because Drone mounts $GOPATH as volume

build/alpine.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# stage 1 building the code
2-
FROM golang:1.20-alpine as builder
2+
FROM golang:1.21-alpine as builder
33

44
ARG VERSION
55
ARG SHORT_COMMIT
@@ -15,7 +15,7 @@ RUN apk --no-cache add gcc musl-dev git mercurial
1515
RUN CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X main.version=$VERSION -X main.commit=$SHORT_COMMIT -X main.date=$DATE" -o golangci-lint ./cmd/golangci-lint/main.go
1616

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

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/golangci/golangci-lint
22

3-
go 1.19
3+
go 1.20
44

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

pkg/config/config.go

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

44-
func IsGreaterThanOrEqualGo118(v string) bool {
44+
func IsGreaterThanOrEqualGo121(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.18")
50+
limit, err := hcversion.NewVersion("1.21")
5151
if err != nil {
5252
return false
5353
}

0 commit comments

Comments
 (0)