Skip to content

Commit 3c5fe71

Browse files
Alexander Weberpimterry
authored andcommitted
ioutil -> io (deprecated)
(Cherry-picked from upstream)
1 parent b3174ae commit 3c5fe71

File tree

18 files changed

+41
-41
lines changed

18 files changed

+41
-41
lines changed

src/targets/go/native.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ module.exports = function (source, options) {
5858
code.push(indent, '"net/http"')
5959

6060
if (opts.printBody) {
61-
code.push(indent, '"io/ioutil"')
61+
code.push(indent, '"io"')
6262
}
6363

6464
code.push(')')
@@ -126,7 +126,7 @@ module.exports = function (source, options) {
126126
if (opts.printBody) {
127127
code.blank()
128128
.push(indent, 'defer res.Body.Close()')
129-
.push(indent, 'body, %s := ioutil.ReadAll(res.Body)', errorPlaceholder)
129+
.push(indent, 'body, %s := io.ReadAll(res.Body)', errorPlaceholder)
130130
errorCheck()
131131
}
132132

test/fixtures/output/go/native/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))

test/fixtures/output/go/native/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))

test/fixtures/output/go/native/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))

test/fixtures/output/go/native/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))

test/fixtures/output/go/native/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))

test/fixtures/output/go/native/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))

test/fixtures/output/go/native/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))

test/fixtures/output/go/native/jsonObj-multiline.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))

test/fixtures/output/go/native/jsonObj-null-value.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))

0 commit comments

Comments
 (0)