Skip to content

Commit fe664c2

Browse files
authored
[Update] Update Go to 1.19 (#1216)
1 parent aa31a19 commit fe664c2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+124
-162
lines changed

.golangci.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,14 @@ run:
1212
linters:
1313
disable-all: true
1414
enable:
15-
- deadcode
1615
- gosimple
1716
- govet
1817
- ineffassign
19-
- staticcheck
20-
- structcheck
18+
- staticcheck
2119
- typecheck
2220
- unconvert
2321
- unparam
24-
- unused
25-
- varcheck
22+
- unused
2623
- importas
2724
- gci
2825

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: go
22

33
go:
4-
- "1.17"
4+
- "1.19"
55

66
go_import_path: github.com/arangodb/kube-arangodb
77

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ ifndef KEEP_GOPATH
3939
endif
4040

4141
GOBUILDARGS ?=
42-
GOBASEVERSION := 1.17
43-
GOVERSION := $(GOBASEVERSION)-alpine3.15
42+
GOBASEVERSION := 1.19
43+
GOVERSION := $(GOBASEVERSION)-alpine3.17
4444
DISTRIBUTION := alpine:3.15
4545

4646
PULSAR := $(GOBUILDDIR)/bin/pulsar$(shell go env GOEXE)
@@ -494,7 +494,7 @@ init: tools update-generated $(BIN) vendor
494494
.PHONY: tools
495495
tools: update-vendor
496496
@echo ">> Fetching golangci-lint linter"
497-
@GOBIN=$(GOPATH)/bin go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.46.2
497+
@GOBIN=$(GOPATH)/bin go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.1
498498
@echo ">> Fetching goimports"
499499
@GOBIN=$(GOPATH)/bin go install golang.org/x/tools/cmd/goimports@0bb7e5c47b1a31f85d4f173edc878a8e049764a5
500500
@echo ">> Fetching license check"

cmd/exporter.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ package cmd
2222

2323
import (
2424
"context"
25-
"io/ioutil"
2625
"os"
2726
"os/signal"
2827
"syscall"
@@ -89,7 +88,7 @@ func cmdExporterCheckE() error {
8988
return "", nil
9089
}
9190

92-
data, err := ioutil.ReadFile(exporterInput.jwtFile)
91+
data, err := os.ReadFile(exporterInput.jwtFile)
9392
if err != nil {
9493
return "", err
9594
}
@@ -105,7 +104,7 @@ func cmdExporterCheckE() error {
105104
return "", nil
106105
}
107106

108-
data, err := ioutil.ReadFile(exporterInput.jwtFile)
107+
data, err := os.ReadFile(exporterInput.jwtFile)
109108
if err != nil {
110109
return "", err
111110
}

cmd/lifecycle_probes.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"crypto/tls"
2525
"encoding/json"
2626
"fmt"
27-
"io/ioutil"
27+
"io"
2828
"net/http"
2929
"os"
3030
"path"
@@ -138,7 +138,7 @@ func readJWTFile(file string) ([]byte, error) {
138138
}
139139

140140
defer f.Close()
141-
data, err := ioutil.ReadAll(f)
141+
data, err := io.ReadAll(f)
142142
if err != nil {
143143
return nil, err
144144
}
@@ -159,7 +159,7 @@ func getJWTToken() ([]byte, error) {
159159
return token, nil
160160
}
161161

162-
if files, err := ioutil.ReadDir(probeInput.JWTPath); err == nil {
162+
if files, err := os.ReadDir(probeInput.JWTPath); err == nil {
163163
for _, file := range files {
164164
if token, err := readJWTFile(file.Name()); err == nil {
165165
log.Info().Str("token", file.Name()).Msgf("Using JWT Token")
@@ -224,7 +224,7 @@ func cmdLifecycleProbeRunE(cmd *cobra.Command) error {
224224

225225
if resp.StatusCode != http.StatusOK {
226226
if resp.Body != nil {
227-
if data, err := ioutil.ReadAll(resp.Body); err == nil {
227+
if data, err := io.ReadAll(resp.Body); err == nil {
228228
return errors.Errorf("Unexpected code: %d - %s", resp.StatusCode, string(data))
229229
}
230230
}
@@ -238,7 +238,7 @@ func cmdLifecycleProbeRunE(cmd *cobra.Command) error {
238238
if resp.Body == nil {
239239
return errors.Errorf("Expected body from the \"%s\" endpoint", endpoint)
240240
}
241-
data, err := ioutil.ReadAll(resp.Body)
241+
data, err := io.ReadAll(resp.Body)
242242
if err != nil {
243243
return errors.Errorf("Failed to read body from the \"%s\" endpoint", endpoint)
244244
}

cmd/uuid.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ package cmd
2222

2323
import (
2424
"fmt"
25-
"io/ioutil"
2625
"os"
2726
"strings"
2827

@@ -96,7 +95,7 @@ func cmdUUIDSave(cmd *cobra.Command, args []string) error {
9695
}
9796

9897
fileContent := fmt.Sprintf("%s\n", cmdUUIDInput.uuid)
99-
if err := ioutil.WriteFile(cmdUUIDInput.uuidPath, []byte(fileContent), 0644); err != nil {
98+
if err := os.WriteFile(cmdUUIDInput.uuidPath, []byte(fileContent), 0644); err != nil {
10099
log.Error().Err(err).Msg("Unable to save UUID")
101100
return err
102101
}
@@ -151,7 +150,7 @@ func fileExists(path string) (bool, error) {
151150
}
152151

153152
func checkFileContent(path, expected string) (bool, string, error) {
154-
content, err := ioutil.ReadFile(path)
153+
content, err := os.ReadFile(path)
155154
if err != nil {
156155
return false, "", err
157156
}

go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/arangodb/kube-arangodb
22

3-
go 1.17
3+
go 1.19
44

55
replace (
66
github.com/arangodb/go-driver => github.com/arangodb/go-driver v1.2.1
@@ -81,7 +81,6 @@ require (
8181
github.com/google/gofuzz v1.1.0 // indirect
8282
github.com/google/uuid v1.1.2 // indirect
8383
github.com/googleapis/gnostic v0.5.5 // indirect
84-
github.com/hashicorp/golang-lru v0.5.3 // indirect
8584
github.com/imdario/mergo v0.3.5 // indirect
8685
github.com/inconshreveable/mousetrap v1.0.0 // indirect
8786
github.com/josharian/intern v1.0.0 // indirect
@@ -92,7 +91,6 @@ require (
9291
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
9392
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
9493
github.com/modern-go/reflect2 v1.0.1 // indirect
95-
github.com/onsi/gomega v1.10.1 // indirect
9694
github.com/pavel-v-chernykh/keystore-go v2.1.0+incompatible // indirect
9795
github.com/pmezard/go-difflib v1.0.0 // indirect
9896
github.com/prometheus/common v0.26.0 // indirect

0 commit comments

Comments
 (0)