Skip to content

Commit d8f00a3

Browse files
authored
Update Golang to 1.21.4 (#245)
1 parent 6ae8c45 commit d8f00a3

32 files changed

+452
-134
lines changed

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ local-build-static:
1616

1717
# These only used for development. Release artifacts and docker images are produced by goreleaser.
1818
docker-test:
19-
docker run -t -v $$PWD:/go/src/github.com/yannh/kubeconform -w /go/src/github.com/yannh/kubeconform golang:1.20 make local-test
19+
docker run -t -v $$PWD:/go/src/github.com/yannh/kubeconform -w /go/src/github.com/yannh/kubeconform golang:1.21.4 make local-test
2020

2121
docker-build:
22-
docker run -t -v $$PWD:/go/src/github.com/yannh/kubeconform -w /go/src/github.com/yannh/kubeconform golang:1.20 make local-build
22+
docker run -t -v $$PWD:/go/src/github.com/yannh/kubeconform -w /go/src/github.com/yannh/kubeconform golang:1.21.4 make local-build
2323

2424
docker-build-static:
25-
docker run -t -v $$PWD:/go/src/github.com/yannh/kubeconform -w /go/src/github.com/yannh/kubeconform golang:1.20 make local-build-static
25+
docker run -t -v $$PWD:/go/src/github.com/yannh/kubeconform -w /go/src/github.com/yannh/kubeconform golang:1.21.4 make local-build-static
2626

2727
build-bats:
2828
docker build -t bats -f Dockerfile.bats .
@@ -32,11 +32,11 @@ docker-acceptance: build-bats
3232
docker run --network none -t bats -p acceptance-nonetwork.bats
3333

3434
goreleaser-build-static:
35-
docker run -t -e GOOS=linux -e GOARCH=amd64 -v $$PWD:/go/src/github.com/yannh/kubeconform -w /go/src/github.com/yannh/kubeconform goreleaser/goreleaser:v1.20.0 build --single-target --skip-post-hooks --rm-dist --snapshot
35+
docker run -t -e GOOS=linux -e GOARCH=amd64 -v $$PWD:/go/src/github.com/yannh/kubeconform -w /go/src/github.com/yannh/kubeconform goreleaser/goreleaser:v1.21.2 build --single-target --skip-post-hooks --rm-dist --snapshot
3636
cp dist/kubeconform_linux_amd64_v1/kubeconform bin/
3737

3838
release:
39-
docker run -e GITHUB_TOKEN -e GIT_OWNER -t -v /var/run/docker.sock:/var/run/docker.sock -v $$PWD:/go/src/github.com/yannh/kubeconform -w /go/src/github.com/yannh/kubeconform goreleaser/goreleaser:v1.20.0 release --rm-dist
39+
docker run -e GITHUB_TOKEN -e GIT_OWNER -t -v /var/run/docker.sock:/var/run/docker.sock -v $$PWD:/go/src/github.com/yannh/kubeconform -w /go/src/github.com/yannh/kubeconform goreleaser/goreleaser:v1.21.2 release --rm-dist
4040

4141
update-deps:
4242
go get -u ./...

go.mod

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
module github.com/yannh/kubeconform
22

3-
go 1.20
3+
go 1.21
44

55
require (
66
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1
7-
sigs.k8s.io/yaml v1.3.0
7+
sigs.k8s.io/yaml v1.4.0
88
)
9-
10-
require gopkg.in/yaml.v2 v2.4.0 // indirect

go.sum

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
2-
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1+
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
2+
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
33
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6NgVqpn3+iol9aGu4=
44
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY=
55
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
66
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
7-
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
8-
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
9-
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
10-
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
7+
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
8+
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=

pkg/cache/ondisk.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"crypto/sha256"
55
"encoding/hex"
66
"fmt"
7-
"io/ioutil"
7+
"io"
88
"os"
99
"path"
1010
"sync"
@@ -37,12 +37,12 @@ func (c *onDisk) Get(resourceKind, resourceAPIVersion, k8sVersion string) (inter
3737
return nil, err
3838
}
3939

40-
return ioutil.ReadAll(f)
40+
return io.ReadAll(f)
4141
}
4242

4343
// Set adds a JSON schema to the schema cache
4444
func (c *onDisk) Set(resourceKind, resourceAPIVersion, k8sVersion string, schema interface{}) error {
4545
c.Lock()
4646
defer c.Unlock()
47-
return ioutil.WriteFile(cachePath(c.folder, resourceKind, resourceAPIVersion, k8sVersion), schema.([]byte), 0644)
47+
return os.WriteFile(cachePath(c.folder, resourceKind, resourceAPIVersion, k8sVersion), schema.([]byte), 0644)
4848
}

pkg/registry/http.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"crypto/tls"
55
"errors"
66
"fmt"
7-
"io/ioutil"
7+
"io"
88
"log"
99
"net/http"
1010
"os"
@@ -99,7 +99,7 @@ func (r SchemaRegistry) DownloadSchema(resourceKind, resourceAPIVersion, k8sVers
9999
return url, nil, fmt.Errorf(msg)
100100
}
101101

102-
body, err := ioutil.ReadAll(resp.Body)
102+
body, err := io.ReadAll(resp.Body)
103103
if err != nil {
104104
msg := fmt.Sprintf("failed parsing schema from %s: %s", url, err)
105105
if r.debug {

pkg/registry/http_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package registry
33
import (
44
"bytes"
55
"fmt"
6-
"io/ioutil"
6+
"io"
77
"net/http"
88
"strings"
99
"testing"
@@ -50,7 +50,7 @@ func TestDownloadSchema(t *testing.T) {
5050
newMockHTTPGetter(func(url string) (resp *http.Response, err error) {
5151
return &http.Response{
5252
StatusCode: http.StatusNotFound,
53-
Body: ioutil.NopCloser(strings.NewReader("http response mock body")),
53+
Body: io.NopCloser(strings.NewReader("http response mock body")),
5454
}, nil
5555
}),
5656
"http://kubernetesjson.dev",
@@ -66,7 +66,7 @@ func TestDownloadSchema(t *testing.T) {
6666
newMockHTTPGetter(func(url string) (resp *http.Response, err error) {
6767
return &http.Response{
6868
StatusCode: http.StatusServiceUnavailable,
69-
Body: ioutil.NopCloser(strings.NewReader("http response mock body")),
69+
Body: io.NopCloser(strings.NewReader("http response mock body")),
7070
}, nil
7171
}),
7272
"http://kubernetesjson.dev",
@@ -82,7 +82,7 @@ func TestDownloadSchema(t *testing.T) {
8282
newMockHTTPGetter(func(url string) (resp *http.Response, err error) {
8383
return &http.Response{
8484
StatusCode: http.StatusOK,
85-
Body: ioutil.NopCloser(strings.NewReader("http response mock body")),
85+
Body: io.NopCloser(strings.NewReader("http response mock body")),
8686
}, nil
8787
}),
8888
"http://kubernetesjson.dev",

pkg/registry/local.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package registry
33
import (
44
"errors"
55
"fmt"
6-
"io/ioutil"
6+
"io"
77
"log"
88
"os"
99
)
@@ -47,7 +47,7 @@ func (r LocalRegistry) DownloadSchema(resourceKind, resourceAPIVersion, k8sVersi
4747
}
4848

4949
defer f.Close()
50-
content, err := ioutil.ReadAll(f)
50+
content, err := io.ReadAll(f)
5151
if err != nil {
5252
msg := fmt.Sprintf("failed to read schema at %s: %s", schemaFile, err)
5353
if r.debug {

vendor/gopkg.in/yaml.v2/.travis.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

vendor/modules.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
## explicit; go 1.19
33
github.com/santhosh-tekuri/jsonschema/v5
44
github.com/santhosh-tekuri/jsonschema/v5/httploader
5-
# gopkg.in/yaml.v2 v2.4.0
6-
## explicit; go 1.15
7-
gopkg.in/yaml.v2
8-
# sigs.k8s.io/yaml v1.3.0
5+
# sigs.k8s.io/yaml v1.4.0
96
## explicit; go 1.12
107
sigs.k8s.io/yaml
8+
sigs.k8s.io/yaml/goyaml.v2

0 commit comments

Comments
 (0)