Skip to content

Commit

Permalink
chore: replace usages of ioutil (#1792)
Browse files Browse the repository at this point in the history
  • Loading branch information
donuts-are-good committed Oct 14, 2023
1 parent 8aa41b8 commit 72e437f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions pkg/api/metrics/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ package metrics_test

import (
"fmt"
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
"strings"
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"github.com/containrrr/watchtower/pkg/api"
metricsAPI "github.com/containrrr/watchtower/pkg/api/metrics"
"github.com/containrrr/watchtower/pkg/metrics"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)

const (
Expand All @@ -36,7 +36,7 @@ func getWithToken(handler http.Handler) map[string]string {
handler.ServeHTTP(respWriter, req)

res := respWriter.Result()
body, _ := ioutil.ReadAll(res.Body)
body, _ := io.ReadAll(res.Body)

for _, line := range strings.Split(string(body), "\n") {
if len(line) < 1 || line[0] == '#' {
Expand Down
12 changes: 6 additions & 6 deletions pkg/container/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ package container
import (
"bytes"
"fmt"
"io/ioutil"
"io"
"strings"
"time"

"github.com/containrrr/watchtower/pkg/registry"
"github.com/containrrr/watchtower/pkg/registry/digest"

t "github.com/containrrr/watchtower/pkg/types"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/network"
sdkClient "github.com/docker/docker/client"
log "github.com/sirupsen/logrus"
"golang.org/x/net/context"

"github.com/containrrr/watchtower/pkg/registry"
"github.com/containrrr/watchtower/pkg/registry/digest"
t "github.com/containrrr/watchtower/pkg/types"
)

const defaultStopSignal = "SIGTERM"
Expand Down Expand Up @@ -399,7 +399,7 @@ func (client dockerClient) PullImage(ctx context.Context, container t.Container)

defer response.Close()
// the pull request will be aborted prematurely unless the response is read
if _, err = ioutil.ReadAll(response); err != nil {
if _, err = io.ReadAll(response); err != nil {
log.Error(err)
return err
}
Expand Down

0 comments on commit 72e437f

Please sign in to comment.