Skip to content

Commit

Permalink
Remove deprecated ioutil from generator
Browse files Browse the repository at this point in the history
  • Loading branch information
marwan-at-work committed Sep 16, 2022
1 parent da0d7f5 commit 7c67b85
Show file tree
Hide file tree
Showing 41 changed files with 238 additions and 212 deletions.
4 changes: 2 additions & 2 deletions clientcompat/gocompat/gocompat.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ package main

import (
"context"
"io/ioutil"
"io"
"log"
"net/http"
"os"
Expand All @@ -28,7 +28,7 @@ import (

func main() {
var in clientcompat.ClientCompatMessage
inBytes, err := ioutil.ReadAll(os.Stdin)
inBytes, err := io.ReadAll(os.Stdin)
if err != nil {
log.Fatalf("read stdin err: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion clientcompat/internal/clientcompat/clientcompat.pb.go

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

26 changes: 14 additions & 12 deletions clientcompat/internal/clientcompat/clientcompat.twirp.go

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

2 changes: 1 addition & 1 deletion example/service.pb.go

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

22 changes: 12 additions & 10 deletions example/service.twirp.go

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

4 changes: 2 additions & 2 deletions internal/descriptors/descriptors.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package descriptors
import (
"bytes"
"compress/gzip"
"io/ioutil"
"io"

"google.golang.org/protobuf/proto"
protobuf "google.golang.org/protobuf/types/descriptorpb"
Expand All @@ -36,7 +36,7 @@ func UnpackFile(gz []byte) (*protobuf.FileDescriptorProto, error) {
}
defer r.Close()

b, err := ioutil.ReadAll(r)
b, err := io.ReadAll(r)
if err != nil {
return nil, errors.Wrap(err, "failed to uncompress descriptor")
}
Expand Down
3 changes: 1 addition & 2 deletions internal/gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ package gen

import (
"io"
"io/ioutil"
"os"

"google.golang.org/protobuf/proto"
Expand Down Expand Up @@ -50,7 +49,7 @@ Outer:
}

func readGenRequest(r io.Reader) *plugin.CodeGeneratorRequest {
data, err := ioutil.ReadAll(r)
data, err := io.ReadAll(r)
if err != nil {
Error(err, "reading input")
}
Expand Down
4 changes: 2 additions & 2 deletions internal/gen/typemap/typemap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
package typemap

import (
"io/ioutil"
"os"
"path/filepath"
"testing"

Expand All @@ -25,7 +25,7 @@ import (
)

func loadTestPb(t *testing.T) []*descriptor.FileDescriptorProto {
f, err := ioutil.ReadFile(filepath.Join("testdata", "fileset.pb"))
f, err := os.ReadFile(filepath.Join("testdata", "fileset.pb"))
require.NoError(t, err, "unable to read testdata protobuf file")

set := new(descriptor.FileDescriptorSet)
Expand Down
2 changes: 1 addition & 1 deletion internal/twirptest/empty_service/empty_service.pb.go

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

22 changes: 12 additions & 10 deletions internal/twirptest/empty_service/empty_service.twirp.go

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

2 changes: 1 addition & 1 deletion internal/twirptest/google_protobuf_imports/service.pb.go

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

Loading

0 comments on commit 7c67b85

Please sign in to comment.