Skip to content

Commit

Permalink
ioutil -> io (deprecated) (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
replicadse authored Nov 2, 2022
1 parent 7c00d05 commit cee79a5
Show file tree
Hide file tree
Showing 22 changed files with 43 additions and 43 deletions.
4 changes: 2 additions & 2 deletions src/targets/go/native/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const native: Client<GoNativeOptions> = {
push('"net/http"', indent);

if (printBody) {
push('"io/ioutil"', indent);
push('"io"', indent);
}

push(')');
Expand Down Expand Up @@ -140,7 +140,7 @@ export const native: Client<GoNativeOptions> = {
if (printBody) {
blank();
push('defer res.Body.Close()', indent);
push(`body, ${errorPlaceholder} := ioutil.ReadAll(res.Body)`, indent);
push(`body, ${errorPlaceholder} := io.ReadAll(res.Body)`, indent);
errorCheck();
}

Expand Down
4 changes: 2 additions & 2 deletions src/targets/go/native/fixtures/application-form-encoded.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"net/http"
"io/ioutil"
"io"
)

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

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
body, _ := io.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))
Expand Down
4 changes: 2 additions & 2 deletions src/targets/go/native/fixtures/application-json.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"net/http"
"io/ioutil"
"io"
)

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

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
body, _ := io.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))
Expand Down
2 changes: 1 addition & 1 deletion src/targets/go/native/fixtures/boilerplate-option.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ req.Header.Add("content-type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
body, _ := io.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))
4 changes: 2 additions & 2 deletions src/targets/go/native/fixtures/check-errors-option.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"net/http"
"io/ioutil"
"io"
)

func main() {
Expand All @@ -28,7 +28,7 @@ func main() {
}

defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
body, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
Expand Down
4 changes: 2 additions & 2 deletions src/targets/go/native/fixtures/cookies.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"fmt"
"net/http"
"io/ioutil"
"io"
)

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

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
body, _ := io.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))
Expand Down
4 changes: 2 additions & 2 deletions src/targets/go/native/fixtures/custom-method.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"fmt"
"net/http"
"io/ioutil"
"io"
)

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

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
body, _ := io.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))
Expand Down
4 changes: 2 additions & 2 deletions src/targets/go/native/fixtures/full.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"net/http"
"io/ioutil"
"io"
)

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

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
body, _ := io.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))
Expand Down
4 changes: 2 additions & 2 deletions src/targets/go/native/fixtures/headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"fmt"
"net/http"
"io/ioutil"
"io"
)

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

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
body, _ := io.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))
Expand Down
4 changes: 2 additions & 2 deletions src/targets/go/native/fixtures/https.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"fmt"
"net/http"
"io/ioutil"
"io"
)

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

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
body, _ := io.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))
Expand Down
4 changes: 2 additions & 2 deletions src/targets/go/native/fixtures/insecure-skip-verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"crypto/tls"
"strings"
"net/http"
"io/ioutil"
"io"
)

func main() {
Expand All @@ -29,7 +29,7 @@ func main() {
res, _ := client.Do(req)

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
body, _ := io.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))
Expand Down
4 changes: 2 additions & 2 deletions src/targets/go/native/fixtures/jsonObj-multiline.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"net/http"
"io/ioutil"
"io"
)

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

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
body, _ := io.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))
Expand Down
4 changes: 2 additions & 2 deletions src/targets/go/native/fixtures/jsonObj-null-value.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"net/http"
"io/ioutil"
"io"
)

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

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
body, _ := io.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))
Expand Down
4 changes: 2 additions & 2 deletions src/targets/go/native/fixtures/multipart-data.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"net/http"
"io/ioutil"
"io"
)

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

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
body, _ := io.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))
Expand Down
4 changes: 2 additions & 2 deletions src/targets/go/native/fixtures/multipart-file.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"net/http"
"io/ioutil"
"io"
)

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

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
body, _ := io.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"fmt"
"net/http"
"io/ioutil"
"io"
)

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

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
body, _ := io.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))
Expand Down
4 changes: 2 additions & 2 deletions src/targets/go/native/fixtures/multipart-form-data.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"net/http"
"io/ioutil"
"io"
)

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

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
body, _ := io.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))
Expand Down
4 changes: 2 additions & 2 deletions src/targets/go/native/fixtures/nested.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"fmt"
"net/http"
"io/ioutil"
"io"
)

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

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
body, _ := io.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))
Expand Down
4 changes: 2 additions & 2 deletions src/targets/go/native/fixtures/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"fmt"
"net/http"
"io/ioutil"
"io"
)

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

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
body, _ := io.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))
Expand Down
4 changes: 2 additions & 2 deletions src/targets/go/native/fixtures/short.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"fmt"
"net/http"
"io/ioutil"
"io"
)

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

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
body, _ := io.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))
Expand Down
4 changes: 2 additions & 2 deletions src/targets/go/native/fixtures/text-plain.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"net/http"
"io/ioutil"
"io"
)

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

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
body, _ := io.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))
Expand Down
4 changes: 2 additions & 2 deletions src/targets/go/native/fixtures/timeout-option.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"time"
"strings"
"net/http"
"io/ioutil"
"io"
)

func main() {
Expand All @@ -27,7 +27,7 @@ func main() {
res, _ := client.Do(req)

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
body, _ := io.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))
Expand Down

0 comments on commit cee79a5

Please sign in to comment.