Skip to content

Commit bdecf39

Browse files
authored
Bump Go to v1.23 and replace deprecated io/ioutil package (jsonnet-libs#541)
* bump go and pin jsonnet * bump go to v1.23 * remove depracecated io/ioutil package
1 parent ad974e6 commit bdecf39

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.20 AS base
1+
FROM golang:1.23 AS base
22

33
ENV GO111MODULE=on
44
WORKDIR /app
@@ -17,12 +17,12 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
1717
-ldflags='-s -w -extldflags "-static"' \
1818
-o k8s-gen .
1919

20-
FROM golang:1.20-alpine3.18 AS jsonnet
20+
FROM golang:1.23-alpine AS jsonnet
2121

2222
RUN apk add --no-cache git
23-
RUN go install github.com/google/go-jsonnet/cmd/jsonnet@v0.20.0
23+
RUN go install github.com/google/go-jsonnet/cmd/jsonnet@v0.21.0
2424

25-
FROM alpine:3.18
25+
FROM alpine:3.20
2626

2727
WORKDIR /app
2828

@@ -37,4 +37,4 @@ COPY scripts .
3737
COPY jsonnet jsonnet
3838
COPY LICENSE .
3939

40-
ENTRYPOINT ["./gen.sh"]
40+
ENTRYPOINT ["./gen.sh"]

go.mod

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

3-
go 1.20
3+
go 1.23
44

55
require (
66
github.com/fatih/camelcase v1.0.0

go.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV
1111
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
1212
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
1313
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
14+
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
1415
github.com/google/go-jsonnet v0.20.0 h1:WG4TTSARuV7bSm4PMB4ohjxe33IHT5WVTrJSU33uT4g=
1516
github.com/google/go-jsonnet v0.20.0/go.mod h1:VbgWF9JX7ztlv770x/TolZNGGFfiHEVx9G6ca2eUmeA=
1617
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=

main.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package main
22

33
import (
44
"fmt"
5-
"io/ioutil"
65
"log"
76
"os"
87
"path/filepath"
@@ -101,7 +100,7 @@ func hasStr(slice []string, s string) bool {
101100
}
102101

103102
func loadConfig(file string) Config {
104-
data, err := ioutil.ReadFile(file)
103+
data, err := os.ReadFile(file)
105104
if err != nil {
106105
log.Fatalln(err)
107106
}
@@ -177,7 +176,7 @@ func writeJsonnet(to, data string) error {
177176
return fmt.Errorf("%s: %s", err, data)
178177
}
179178

180-
return ioutil.WriteFile(to, []byte(s), 0644)
179+
return os.WriteFile(to, []byte(s), 0644)
181180
}
182181

183182
func copyDirLibsonnet(dir, to string) ([]string, error) {
@@ -199,14 +198,14 @@ func copyDirLibsonnet(dir, to string) ([]string, error) {
199198
})
200199

201200
for _, a := range adds {
202-
content, err := ioutil.ReadFile(a)
201+
content, err := os.ReadFile(a)
203202
if err != nil {
204203
return nil, err
205204
}
206205

207206
a = filepath.Join(to, filepath.Base(a))
208207
os.MkdirAll(filepath.Dir(a), os.ModePerm)
209-
if err := ioutil.WriteFile(a, content, 0644); err != nil {
208+
if err := os.WriteFile(a, content, 0644); err != nil {
210209
return nil, err
211210
}
212211
}

0 commit comments

Comments
 (0)