Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #59 from ipld/ioutil
Browse files Browse the repository at this point in the history
chore: replace deprecated ioutil with io/os
  • Loading branch information
galargh committed Sep 2, 2022
2 parents 941f417 + 7485b8d commit 305fd37
Show file tree
Hide file tree
Showing 6 changed files with 963 additions and 969 deletions.
2 changes: 1 addition & 1 deletion blueprints/base/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var (
IOReadCloser = &cg.GoRef{PkgPath: "io", Name: "ReadCloser"}
IOEOF = &cg.GoRef{PkgPath: "io", Name: "EOF"}
IOErrUnexpectedEOF = &cg.GoRef{PkgPath: "io", Name: "ErrUnexpectedEOF"}
IOUtilReadAll = &cg.GoRef{PkgPath: "io/ioutil", Name: "ReadAll"}
IOReadAll = &cg.GoRef{PkgPath: "io", Name: "ReadAll"}
)

const EdelweissServicesPkg = services.PkgPath
Expand Down
4 changes: 2 additions & 2 deletions blueprints/services/dagjson-over-http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (x GoServerImpl) GoDef() cg.Blueprint {
"HTTPResponseWriter": base.HTTPResponseWriter,
"IPLDDecode": base.IPLDDecode,
"DAGJSONDecode": base.DAGJSONDecode,
"IOUtilReadAll": base.IOUtilReadAll,
"IOReadAll": base.IOReadAll,
//
"Interface": x.Ref.Append("_Server"),
"AsyncHandler": x.Ref.Append("_AsyncHandler"),
Expand Down Expand Up @@ -168,7 +168,7 @@ type {{.Interface}} interface {
func {{.AsyncHandler}}(s {{.Interface}}) {{.HTTPHandlerFunc}} {
return func(writer {{.HTTPResponseWriter}}, request *{{.HTTPRequest}}) {
// parse request
msg, err := {{.IOUtilReadAll}}(request.Body)
msg, err := {{.IOReadAll}}(request.Body)
if err != nil {
{{.LoggerVar}}.Errorf("reading request body (%v)", err)
writer.WriteHeader(400)
Expand Down
3 changes: 1 addition & 2 deletions codegen/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package codegen
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"path"
)
Expand All @@ -28,7 +27,7 @@ func (f *GoFile) Build() error {
if err != nil {
return err
}
return ioutil.WriteFile(f.FilePath, body, 0644)
return os.WriteFile(f.FilePath, body, 0644)
}

func (f *GoFile) Generate() ([]byte, error) {
Expand Down
Loading

0 comments on commit 305fd37

Please sign in to comment.