Skip to content

Commit 6f4a0f5

Browse files
committed
chore: update go version to 1.21
1 parent 51238d8 commit 6f4a0f5

16 files changed

+747
-2201
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Please make sure that your PR fulfills the following requirements:
88
- [ ] Reviewed the guidelines for contributing to this repository
99
- [ ] The commit message follows the [Conventional Commits Guidelines](https://www.conventionalcommits.org/en/v1.0.0/#summary).
1010
- [ ] Tests for the changes have been updated
11-
- [ ] Are you adding dependencies? If so, please run `go mod tidy -compat=1.17` to ensure only the minimum is pulled in.
11+
- [ ] Are you adding dependencies? If so, please run `go mod tidy -compat=1.21` to ensure only the minimum is pulled in.
1212
- [ ] Docs have been added / updated
1313
- [ ] Optional. My organization is added to USERS.md.
1414

.github/workflows/pipeline.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- name: Set up Go
4343
uses: actions/setup-go@v4
4444
with:
45-
go-version: 1.17.8
45+
go-version: 1.21
4646

4747
- name: Quality checks
4848
run: make quality

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Set up Go
2222
uses: actions/setup-go@v4
2323
with:
24-
go-version: 1.17.8
24+
go-version: 1.21
2525

2626
- name: Install git-chglog
2727
run: go install github.com/git-chglog/git-chglog/cmd/git-chglog@latest

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM index.docker.io/golang:1.17@sha256:55636cf1983628109e569690596b85077f45aca810a77904e8afad48b49aa500
1+
FROM index.docker.io/golang:1.21
22

33
ADD go.mod go.mod
44
ADD go.sum go.sum

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ quality:
77
go test -race -v -coverprofile cover.out ./...
88

99
build:
10-
go build -o ${BINARY} .
10+
go build -buildvcs=false -o ${BINARY} .
1111

1212
install: build
1313

cmd/generate_test.go

+17-17
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package cmd
22

33
import (
44
"bytes"
5-
"io/ioutil"
5+
"io"
66
"os"
77
"strings"
88
"testing"
@@ -34,7 +34,7 @@ func TestMain(t *testing.T) {
3434
cmd.SetErr(c)
3535
cmd.SetOut(bytes.NewBufferString(""))
3636
cmd.Execute()
37-
out, err := ioutil.ReadAll(c) // Read buffer to bytes
37+
out, err := io.ReadAll(c) // Read buffer to bytes
3838
if err != nil {
3939
t.Fatal(err)
4040
}
@@ -54,7 +54,7 @@ func TestMain(t *testing.T) {
5454
cmd.SetErr(b)
5555
cmd.SetOut(bytes.NewBufferString(""))
5656
cmd.Execute()
57-
out, err := ioutil.ReadAll(b) // Read buffer to bytes
57+
out, err := io.ReadAll(b) // Read buffer to bytes
5858
if err != nil {
5959
t.Fatal(err)
6060
}
@@ -75,7 +75,7 @@ func TestMain(t *testing.T) {
7575
cmd.SetErr(b)
7676
cmd.SetOut(bytes.NewBufferString(""))
7777
cmd.Execute()
78-
out, err := ioutil.ReadAll(b) // Read buffer to bytes
78+
out, err := io.ReadAll(b) // Read buffer to bytes
7979
if err != nil {
8080
t.Fatal(err)
8181
}
@@ -88,7 +88,7 @@ func TestMain(t *testing.T) {
8888
// From stdin
8989
args = []string{"-"}
9090
stdin := bytes.NewBufferString("")
91-
inputBuf, err := ioutil.ReadFile("../fixtures/input/empty/file.yaml")
91+
inputBuf, err := os.ReadFile("../fixtures/input/empty/file.yaml")
9292
if err != nil {
9393
t.Fatal(err)
9494
}
@@ -100,7 +100,7 @@ func TestMain(t *testing.T) {
100100
cmd.SetErr(b)
101101
cmd.SetOut(bytes.NewBufferString(""))
102102
cmd.Execute()
103-
out, err = ioutil.ReadAll(b) // Read buffer to bytes
103+
out, err = io.ReadAll(b) // Read buffer to bytes
104104
if err != nil {
105105
t.Fatal(err)
106106
}
@@ -120,16 +120,16 @@ func TestMain(t *testing.T) {
120120
cmd.SetOut(b)
121121
cmd.SetErr(e)
122122
cmd.Execute()
123-
out, err := ioutil.ReadAll(b) // Read buffer to bytes
123+
out, err := io.ReadAll(b) // Read buffer to bytes
124124
if err != nil {
125125
t.Fatal(err)
126126
}
127-
stderr, err := ioutil.ReadAll(e) // Read buffer to bytes
127+
stderr, err := io.ReadAll(e) // Read buffer to bytes
128128
if err != nil {
129129
t.Fatal(err)
130130
}
131131

132-
buf, err := ioutil.ReadFile("../fixtures/output/all.yaml")
132+
buf, err := os.ReadFile("../fixtures/output/all.yaml")
133133
if err != nil {
134134
t.Fatal(err)
135135
}
@@ -148,12 +148,12 @@ func TestMain(t *testing.T) {
148148
cmd.SetArgs(args)
149149
cmd.SetOut(b)
150150
cmd.Execute()
151-
out, err := ioutil.ReadAll(b) // Read buffer to bytes
151+
out, err := io.ReadAll(b) // Read buffer to bytes
152152
if err != nil {
153153
t.Fatal(err)
154154
}
155155

156-
buf, err := ioutil.ReadFile("../fixtures/output/ignored-secret.yaml")
156+
buf, err := os.ReadFile("../fixtures/output/ignored-secret.yaml")
157157
if err != nil {
158158
t.Fatal(err)
159159
}
@@ -166,7 +166,7 @@ func TestMain(t *testing.T) {
166166

167167
t.Run("will read from STDIN", func(t *testing.T) {
168168
stdin := bytes.NewBufferString("")
169-
inputBuf, err := ioutil.ReadFile("../fixtures/input/nonempty/full.yaml")
169+
inputBuf, err := os.ReadFile("../fixtures/input/nonempty/full.yaml")
170170
if err != nil {
171171
t.Fatal(err)
172172
}
@@ -180,12 +180,12 @@ func TestMain(t *testing.T) {
180180
cmd.SetOut(stdout)
181181
cmd.SetIn(stdin)
182182
cmd.Execute()
183-
out, err := ioutil.ReadAll(stdout) // Read buffer to bytes
183+
out, err := io.ReadAll(stdout) // Read buffer to bytes
184184
if err != nil {
185185
t.Fatal(err)
186186
}
187187

188-
buf, err := ioutil.ReadFile("../fixtures/output/stdin-full.yaml")
188+
buf, err := os.ReadFile("../fixtures/output/stdin-full.yaml")
189189
if err != nil {
190190
t.Fatal(err)
191191
}
@@ -198,7 +198,7 @@ func TestMain(t *testing.T) {
198198

199199
t.Run("will return invalid yaml error from STDIN", func(t *testing.T) {
200200
stdin := bytes.NewBufferString("")
201-
inputBuf, err := ioutil.ReadFile("../fixtures/input/invalid.yaml")
201+
inputBuf, err := os.ReadFile("../fixtures/input/invalid.yaml")
202202
if err != nil {
203203
t.Fatal(err)
204204
}
@@ -213,7 +213,7 @@ func TestMain(t *testing.T) {
213213
cmd.SetOut(bytes.NewBufferString(""))
214214
cmd.SetIn(stdin)
215215
cmd.Execute()
216-
out, err := ioutil.ReadAll(stderr) // Read buffer to bytes
216+
out, err := io.ReadAll(stderr) // Read buffer to bytes
217217
if err != nil {
218218
t.Fatal(err)
219219
}
@@ -239,7 +239,7 @@ func TestMain(t *testing.T) {
239239
cmd.SetErr(b)
240240
cmd.SetOut(bytes.NewBufferString(""))
241241
cmd.Execute()
242-
out, err := ioutil.ReadAll(b) // Read buffer to bytes
242+
out, err := io.ReadAll(b) // Read buffer to bytes
243243
if err != nil {
244244
t.Fatal(err)
245245
}

cmd/util.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"bytes"
55
"fmt"
66
"io"
7-
"io/ioutil"
87
"os"
98
"path/filepath"
109

@@ -30,7 +29,7 @@ func listFiles(root string) ([]string, error) {
3029

3130
func readFilesAsManifests(paths []string) (result []unstructured.Unstructured, errs []error) {
3231
for _, path := range paths {
33-
rawdata, err := ioutil.ReadFile(path)
32+
rawdata, err := os.ReadFile(path)
3433
if err != nil {
3534
errs = append(errs, fmt.Errorf("could not read file: %s from disk: %s", path, err))
3635
}

cmd/version_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package cmd
22

33
import (
44
"bytes"
5-
"io/ioutil"
5+
"io"
66
"strings"
77
"testing"
88

@@ -22,7 +22,7 @@ func TestVersion(t *testing.T) {
2222
cmd.SetArgs(args)
2323
cmd.SetOut(c)
2424
cmd.Execute()
25-
out, err := ioutil.ReadAll(c) // Read buffer to bytes
25+
out, err := io.ReadAll(c) // Read buffer to bytes
2626
if err != nil {
2727
t.Fatal(err)
2828
}

0 commit comments

Comments
 (0)