Skip to content

[Update] Update Go to 1.19 #1216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,14 @@ run:
linters:
disable-all: true
enable:
- deadcode
- gosimple
- govet
- ineffassign
- staticcheck
- structcheck
- staticcheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- unused
- importas
- gci

Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: go

go:
- "1.17"
- "1.19"

go_import_path: github.com/arangodb/kube-arangodb

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ ifndef KEEP_GOPATH
endif

GOBUILDARGS ?=
GOBASEVERSION := 1.17
GOVERSION := $(GOBASEVERSION)-alpine3.15
GOBASEVERSION := 1.19
GOVERSION := $(GOBASEVERSION)-alpine3.17
DISTRIBUTION := alpine:3.15

PULSAR := $(GOBUILDDIR)/bin/pulsar$(shell go env GOEXE)
Expand Down Expand Up @@ -494,7 +494,7 @@ init: tools update-generated $(BIN) vendor
.PHONY: tools
tools: update-vendor
@echo ">> Fetching golangci-lint linter"
@GOBIN=$(GOPATH)/bin go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.46.2
@GOBIN=$(GOPATH)/bin go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.1
@echo ">> Fetching goimports"
@GOBIN=$(GOPATH)/bin go install golang.org/x/tools/cmd/goimports@0bb7e5c47b1a31f85d4f173edc878a8e049764a5
@echo ">> Fetching license check"
Expand Down
5 changes: 2 additions & 3 deletions cmd/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ package cmd

import (
"context"
"io/ioutil"
"os"
"os/signal"
"syscall"
Expand Down Expand Up @@ -89,7 +88,7 @@ func cmdExporterCheckE() error {
return "", nil
}

data, err := ioutil.ReadFile(exporterInput.jwtFile)
data, err := os.ReadFile(exporterInput.jwtFile)
if err != nil {
return "", err
}
Expand All @@ -105,7 +104,7 @@ func cmdExporterCheckE() error {
return "", nil
}

data, err := ioutil.ReadFile(exporterInput.jwtFile)
data, err := os.ReadFile(exporterInput.jwtFile)
if err != nil {
return "", err
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/lifecycle_probes.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"crypto/tls"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"os"
"path"
Expand Down Expand Up @@ -138,7 +138,7 @@ func readJWTFile(file string) ([]byte, error) {
}

defer f.Close()
data, err := ioutil.ReadAll(f)
data, err := io.ReadAll(f)
if err != nil {
return nil, err
}
Expand All @@ -159,7 +159,7 @@ func getJWTToken() ([]byte, error) {
return token, nil
}

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

if resp.StatusCode != http.StatusOK {
if resp.Body != nil {
if data, err := ioutil.ReadAll(resp.Body); err == nil {
if data, err := io.ReadAll(resp.Body); err == nil {
return errors.Errorf("Unexpected code: %d - %s", resp.StatusCode, string(data))
}
}
Expand All @@ -238,7 +238,7 @@ func cmdLifecycleProbeRunE(cmd *cobra.Command) error {
if resp.Body == nil {
return errors.Errorf("Expected body from the \"%s\" endpoint", endpoint)
}
data, err := ioutil.ReadAll(resp.Body)
data, err := io.ReadAll(resp.Body)
if err != nil {
return errors.Errorf("Failed to read body from the \"%s\" endpoint", endpoint)
}
Expand Down
5 changes: 2 additions & 3 deletions cmd/uuid.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ package cmd

import (
"fmt"
"io/ioutil"
"os"
"strings"

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

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

func checkFileContent(path, expected string) (bool, string, error) {
content, err := ioutil.ReadFile(path)
content, err := os.ReadFile(path)
if err != nil {
return false, "", err
}
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/arangodb/kube-arangodb

go 1.17
go 1.19

replace (
github.com/arangodb/go-driver => github.com/arangodb/go-driver v1.2.1
Expand Down Expand Up @@ -81,7 +81,6 @@ require (
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/uuid v1.1.2 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/hashicorp/golang-lru v0.5.3 // indirect
github.com/imdario/mergo v0.3.5 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
Expand All @@ -92,7 +91,6 @@ require (
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/onsi/gomega v1.10.1 // indirect
github.com/pavel-v-chernykh/keystore-go v2.1.0+incompatible // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/common v0.26.0 // indirect
Expand Down
Loading