Skip to content

Commit 91f89c4

Browse files
authored
Merge pull request #133 from fluxcd/remove-ioutil
Remove deprecated `io/ioutil`
2 parents eb55926 + e73e690 commit 91f89c4

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

github/integration_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"context"
2121
"errors"
2222
"fmt"
23-
"io/ioutil"
2423
"math/rand"
2524
"net/http"
2625
"os"
@@ -140,7 +139,7 @@ var _ = Describe("GitHub Provider", func() {
140139
BeforeSuite(func() {
141140
githubToken := os.Getenv("GITHUB_TOKEN")
142141
if len(githubToken) == 0 {
143-
b, err := ioutil.ReadFile(ghTokenFile)
142+
b, err := os.ReadFile(ghTokenFile)
144143
if token := string(b); err == nil && len(token) != 0 {
145144
githubToken = token
146145
} else {

gitlab/integration_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"errors"
2424
"fmt"
2525
"io"
26-
"io/ioutil"
2726
"math/rand"
2827
"net/http"
2928
"os"
@@ -90,9 +89,9 @@ type customTransport struct {
9089
}
9190

9291
func getBodyFromReaderWithoutConsuming(r *io.ReadCloser) string {
93-
body, _ := ioutil.ReadAll(*r)
92+
body, _ := io.ReadAll(*r)
9493
(*r).Close()
95-
*r = ioutil.NopCloser(bytes.NewBuffer(body))
94+
*r = io.NopCloser(bytes.NewBuffer(body))
9695
return string(body)
9796
}
9897

@@ -124,7 +123,7 @@ func (t *customTransport) RoundTrip(req *http.Request) (*http.Response, error) {
124123
strings.Contains(string(responseBody), ProjectStillBeingDeleted) {
125124
time.Sleep(2 * time.Second)
126125
if req != nil && req.Body != nil {
127-
req.Body = ioutil.NopCloser(strings.NewReader(requestBody))
126+
req.Body = io.NopCloser(strings.NewReader(requestBody))
128127
}
129128
retryCount--
130129
continue
@@ -189,7 +188,7 @@ var _ = Describe("GitLab Provider", func() {
189188
BeforeSuite(func() {
190189
gitlabToken := os.Getenv("GITLAB_TOKEN")
191190
if len(gitlabToken) == 0 {
192-
b, err := ioutil.ReadFile(ghTokenFile)
191+
b, err := os.ReadFile(ghTokenFile)
193192
if token := string(b); err == nil && len(token) != 0 {
194193
gitlabToken = token
195194
} else {

stash/integration_suite_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package stash
1919
import (
2020
"context"
2121
"fmt"
22-
"io/ioutil"
2322
"math/rand"
2423
"net/http"
2524
"os"
@@ -186,7 +185,7 @@ var _ = Describe("Stash Provider", func() {
186185

187186
stashToken := os.Getenv("STASH_TOKEN")
188187
if stashToken == "" {
189-
b, err := ioutil.ReadFile(stashTokenFile)
188+
b, err := os.ReadFile(stashTokenFile)
190189
if token := string(b); err == nil && token != "" {
191190
stashToken = token
192191
} else {

0 commit comments

Comments
 (0)