Skip to content
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

chore: replace usages of ioutil #1792

Merged
merged 1 commit into from
Oct 14, 2023
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
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 @@
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 @@

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 {

Check warning on line 402 in pkg/container/client.go

View check run for this annotation

Codecov / codecov/patch

pkg/container/client.go#L402

Added line #L402 was not covered by tests
log.Error(err)
return err
}
Expand Down
Loading