From 04faa7ff3ad4ab9b274d9da949601c3285b9c554 Mon Sep 17 00:00:00 2001 From: Richard Wall Date: Thu, 4 Jan 2024 14:59:11 +0000 Subject: [PATCH 1/2] Show ioutil deprecations Signed-off-by: Richard Wall --- .golangci.ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.golangci.ci.yaml b/.golangci.ci.yaml index 3efdb88f4..bc5fa1ffe 100644 --- a/.golangci.ci.yaml +++ b/.golangci.ci.yaml @@ -34,4 +34,4 @@ issues: text: "SA(1002|1006|4000|4006)" - linters: - staticcheck - text: "(ioutil|KubeCtl|NewCertManagerBasicCertificate|DeprecatedCertificateTemplateFromCertificateRequestAndAllowInsecureCSRUsageDefinition|eab.KeyAlgorithm|testCA.Subjects|RootCAs.Subjects|pki.GenerateTemplate|adal.NewServicePrincipalTokenFromFederatedToken|azure-sdk-for-go|c.SingleInflight|x509.ParseCRL|v.client.RawRequest)" + text: "(KubeCtl|NewCertManagerBasicCertificate|DeprecatedCertificateTemplateFromCertificateRequestAndAllowInsecureCSRUsageDefinition|eab.KeyAlgorithm|testCA.Subjects|RootCAs.Subjects|pki.GenerateTemplate|adal.NewServicePrincipalTokenFromFederatedToken|azure-sdk-for-go|c.SingleInflight|x509.ParseCRL|v.client.RawRequest)" From 7bda41c28240e84cf9f9b03c6137e06bac719505 Mon Sep 17 00:00:00 2001 From: Richard Wall Date: Thu, 4 Jan 2024 15:05:24 +0000 Subject: [PATCH 2/2] Use io instead of deprecated ioutil Signed-off-by: Richard Wall --- pkg/healthz/healthz_test.go | 4 ++-- pkg/issuer/acme/dns/util/wait.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/healthz/healthz_test.go b/pkg/healthz/healthz_test.go index d97235548..4487f945c 100644 --- a/pkg/healthz/healthz_test.go +++ b/pkg/healthz/healthz_test.go @@ -20,7 +20,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net" "net/http" "sync" @@ -281,7 +281,7 @@ func TestHealthzLivezLeaderElection(t *testing.T) { defer func() { require.NoError(t, resp.Body.Close()) }() - bodyBytes, err := ioutil.ReadAll(resp.Body) + bodyBytes, err := io.ReadAll(resp.Body) require.NoError(t, err) lastResponseCode = resp.StatusCode diff --git a/pkg/issuer/acme/dns/util/wait.go b/pkg/issuer/acme/dns/util/wait.go index 59a5e21cf..5cdde9b24 100644 --- a/pkg/issuer/acme/dns/util/wait.go +++ b/pkg/issuer/acme/dns/util/wait.go @@ -12,7 +12,7 @@ import ( "bytes" "context" "fmt" - "io/ioutil" + "io" "net" "net/http" "strings" @@ -255,7 +255,7 @@ func (c *httpDNSClient) Exchange(ctx context.Context, m *dns.Msg, a string) (r * return nil, 0, fmt.Errorf("dns: unexpected Content-Type %q; expected %q", ct, dohMimeType) } - p, err = ioutil.ReadAll(resp.Body) + p, err = io.ReadAll(resp.Body) if err != nil { return nil, 0, err }