Skip to content

Commit

Permalink
Replace deprecated ioutil usage with equivalents (#77)
Browse files Browse the repository at this point in the history
As of Go 1.16, the same functionality is now provided by package io or
package os, and those implementations should be preferred in new code.
  • Loading branch information
jparise authored Dec 16, 2023
1 parent 25eeb27 commit 5d223ac
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions linter.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"path/filepath"
Expand Down Expand Up @@ -56,7 +55,7 @@ func WithIncludes(includes []string) Option {
func NewLinter(checks Checks, options ...Option) *Linter {
l := &Linter{
checks: checks,
logger: log.New(ioutil.Discard, "", 0),
logger: log.New(io.Discard, "", 0),
}
for _, option := range options {
option(l)
Expand Down
4 changes: 2 additions & 2 deletions linter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package thriftcheck

import (
"io/ioutil"
"io"
"log"
"reflect"
"strings"
Expand All @@ -25,7 +25,7 @@ import (
)

func TestWithLogger(t *testing.T) {
logger := log.New(ioutil.Discard, "", 0)
logger := log.New(io.Discard, "", 0)
linter := NewLinter(Checks{}, WithLogger(logger))
if linter.logger != logger {
t.Errorf("expected logger to be %v, got %v", logger, linter.logger)
Expand Down
3 changes: 1 addition & 2 deletions parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package thriftcheck
import (
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"

Expand All @@ -27,7 +26,7 @@ import (

// Parse parses Thrift document content.
func Parse(r io.Reader) (*ast.Program, *idl.Info, error) {
b, err := ioutil.ReadAll(r)
b, err := io.ReadAll(r)
if err != nil {
return nil, nil, err
}
Expand Down

0 comments on commit 5d223ac

Please sign in to comment.