Skip to content

Commit

Permalink
Fix ioutil deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
der-eismann committed Dec 3, 2024
1 parent 9bb95d2 commit ade1d89
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pkg/lokiutil/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package lokiutil

import (
"bytes"
"io/ioutil"
"io"
"net/http"
"os"
"time"
Expand Down Expand Up @@ -156,7 +156,7 @@ func (c *Client) sendBatch(batch Batch) error {
}
defer resp.Body.Close()

resBody, err := ioutil.ReadAll(resp.Body)
resBody, err := io.ReadAll(resp.Body)
if err != nil {
return errors.WithStack(err)
}
Expand Down
5 changes: 2 additions & 3 deletions pkg/testutil/golden.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package testutil

import (
"encoding/json"
"io/ioutil"
"os"

"github.com/pmezard/go-difflib/difflib"
Expand All @@ -21,14 +20,14 @@ type TB interface {

func assertGolden(t TB, filename string, data []byte, showDiff bool) {
if os.Getenv(GoldenUpdateEnv) != "" {
err := ioutil.WriteFile(filename, data, os.FileMode(0644))
err := os.WriteFile(filename, data, os.FileMode(0644))
if err != nil {
t.Error(err)
return
}
}

golden, err := ioutil.ReadFile(filename)
golden, err := os.ReadFile(filename)
if os.IsNotExist(err) {
golden = []byte{}
} else if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/vaultutil/kubernetes.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package vaultutil

import (
"io/ioutil"
"os"
"path"

"github.com/hashicorp/vault/api"
Expand All @@ -14,7 +14,7 @@ const (
)

func KubernetesToken(client *api.Client, role string) (*api.Secret, error) {
jwt, err := ioutil.ReadFile(KubernetesTokenPath)
jwt, err := os.ReadFile(KubernetesTokenPath)
if err != nil {
return nil, errors.WithStack(err)
}
Expand Down

0 comments on commit ade1d89

Please sign in to comment.