Skip to content

Commit

Permalink
Replaced deprecated io/ioutil package with proper implementations of …
Browse files Browse the repository at this point in the history
…io/os packages.

As of Go v1.16, the io/ioutil package has been deprecated and replaced with io and os implementations.
https://go.dev/doc/go1.16#ioutil
  • Loading branch information
zachary-walters committed Oct 3, 2023
1 parent 9acf7fa commit 1ca489a
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 37 deletions.
8 changes: 4 additions & 4 deletions .schema/openapi/templates/go/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package {{packageName}}
import (
"bytes"
"context"
"io/ioutil"
"io"
"net/http"
"net/url"
{{#imports}} "{{import}}"
Expand Down Expand Up @@ -243,7 +243,7 @@ func (a *{{{classname}}}Service) {{nickname}}Execute(r {{#structPrefix}}{{&class
}
{{/required}}
if localVarFile != nil {
fbs, _ := ioutil.ReadAll(localVarFile)
fbs, _ := io.ReadAll(localVarFile)
localVarFileBytes = fbs
localVarFileName = localVarFile.Name()
localVarFile.Close()
Expand Down Expand Up @@ -321,9 +321,9 @@ func (a *{{{classname}}}Service) {{nickname}}Execute(r {{#structPrefix}}{{&class
return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, err
}

localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, err
}
Expand Down
3 changes: 1 addition & 2 deletions .schema/openapi/templates/go/signing.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"encoding/pem"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/textproto"
"os"
Expand Down Expand Up @@ -178,7 +177,7 @@ func (h *HttpSignatureAuth) loadPrivateKey() (err error) {
err = file.Close()
}()
var priv []byte
priv, err = ioutil.ReadAll(file)
priv, err = io.ReadAll(file)
if err != nil {
return err
}
Expand Down
14 changes: 7 additions & 7 deletions internal/httpclient/api_metadata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions internal/httpclient/api_permission.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions internal/httpclient/api_relationship.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1ca489a

Please sign in to comment.