Skip to content

Commit cee79a5

Browse files
author
Alexander Weber
authored
ioutil -> io (deprecated) (Kong#305)
1 parent 7c00d05 commit cee79a5

22 files changed

Lines changed: 43 additions & 43 deletions

src/targets/go/native/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export const native: Client<GoNativeOptions> = {
7272
push('"net/http"', indent);
7373

7474
if (printBody) {
75-
push('"io/ioutil"', indent);
75+
push('"io"', indent);
7676
}
7777

7878
push(')');
@@ -140,7 +140,7 @@ export const native: Client<GoNativeOptions> = {
140140
if (printBody) {
141141
blank();
142142
push('defer res.Body.Close()', indent);
143-
push(`body, ${errorPlaceholder} := ioutil.ReadAll(res.Body)`, indent);
143+
push(`body, ${errorPlaceholder} := io.ReadAll(res.Body)`, indent);
144144
errorCheck();
145145
}
146146

src/targets/go/native/fixtures/application-form-encoded.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"fmt"
55
"strings"
66
"net/http"
7-
"io/ioutil"
7+
"io"
88
)
99

1010
func main() {
@@ -20,7 +20,7 @@ func main() {
2020
res, _ := http.DefaultClient.Do(req)
2121

2222
defer res.Body.Close()
23-
body, _ := ioutil.ReadAll(res.Body)
23+
body, _ := io.ReadAll(res.Body)
2424

2525
fmt.Println(res)
2626
fmt.Println(string(body))

src/targets/go/native/fixtures/application-json.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"fmt"
55
"strings"
66
"net/http"
7-
"io/ioutil"
7+
"io"
88
)
99

1010
func main() {
@@ -20,7 +20,7 @@ func main() {
2020
res, _ := http.DefaultClient.Do(req)
2121

2222
defer res.Body.Close()
23-
body, _ := ioutil.ReadAll(res.Body)
23+
body, _ := io.ReadAll(res.Body)
2424

2525
fmt.Println(res)
2626
fmt.Println(string(body))

src/targets/go/native/fixtures/boilerplate-option.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ req.Header.Add("content-type", "application/x-www-form-urlencoded")
1111
res, _ := http.DefaultClient.Do(req)
1212

1313
defer res.Body.Close()
14-
body, _ := ioutil.ReadAll(res.Body)
14+
body, _ := io.ReadAll(res.Body)
1515

1616
fmt.Println(res)
1717
fmt.Println(string(body))

src/targets/go/native/fixtures/check-errors-option.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"fmt"
55
"strings"
66
"net/http"
7-
"io/ioutil"
7+
"io"
88
)
99

1010
func main() {
@@ -28,7 +28,7 @@ func main() {
2828
}
2929

3030
defer res.Body.Close()
31-
body, err := ioutil.ReadAll(res.Body)
31+
body, err := io.ReadAll(res.Body)
3232
if err != nil {
3333
panic(err)
3434
}

src/targets/go/native/fixtures/cookies.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package main
33
import (
44
"fmt"
55
"net/http"
6-
"io/ioutil"
6+
"io"
77
)
88

99
func main() {
@@ -17,7 +17,7 @@ func main() {
1717
res, _ := http.DefaultClient.Do(req)
1818

1919
defer res.Body.Close()
20-
body, _ := ioutil.ReadAll(res.Body)
20+
body, _ := io.ReadAll(res.Body)
2121

2222
fmt.Println(res)
2323
fmt.Println(string(body))

src/targets/go/native/fixtures/custom-method.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package main
33
import (
44
"fmt"
55
"net/http"
6-
"io/ioutil"
6+
"io"
77
)
88

99
func main() {
@@ -15,7 +15,7 @@ func main() {
1515
res, _ := http.DefaultClient.Do(req)
1616

1717
defer res.Body.Close()
18-
body, _ := ioutil.ReadAll(res.Body)
18+
body, _ := io.ReadAll(res.Body)
1919

2020
fmt.Println(res)
2121
fmt.Println(string(body))

src/targets/go/native/fixtures/full.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"fmt"
55
"strings"
66
"net/http"
7-
"io/ioutil"
7+
"io"
88
)
99

1010
func main() {
@@ -22,7 +22,7 @@ func main() {
2222
res, _ := http.DefaultClient.Do(req)
2323

2424
defer res.Body.Close()
25-
body, _ := ioutil.ReadAll(res.Body)
25+
body, _ := io.ReadAll(res.Body)
2626

2727
fmt.Println(res)
2828
fmt.Println(string(body))

src/targets/go/native/fixtures/headers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package main
33
import (
44
"fmt"
55
"net/http"
6-
"io/ioutil"
6+
"io"
77
)
88

99
func main() {
@@ -19,7 +19,7 @@ func main() {
1919
res, _ := http.DefaultClient.Do(req)
2020

2121
defer res.Body.Close()
22-
body, _ := ioutil.ReadAll(res.Body)
22+
body, _ := io.ReadAll(res.Body)
2323

2424
fmt.Println(res)
2525
fmt.Println(string(body))

src/targets/go/native/fixtures/https.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package main
33
import (
44
"fmt"
55
"net/http"
6-
"io/ioutil"
6+
"io"
77
)
88

99
func main() {
@@ -15,7 +15,7 @@ func main() {
1515
res, _ := http.DefaultClient.Do(req)
1616

1717
defer res.Body.Close()
18-
body, _ := ioutil.ReadAll(res.Body)
18+
body, _ := io.ReadAll(res.Body)
1919

2020
fmt.Println(res)
2121
fmt.Println(string(body))

0 commit comments

Comments
 (0)