Skip to content

Commit

Permalink
Merge pull request #108 from testwill/ioutil
Browse files Browse the repository at this point in the history
chore: remove refs to deprecated io/ioutil
  • Loading branch information
dave committed Aug 2, 2023
2 parents ff106b2 + 7e90580 commit e319413
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions genjen/main.go
Expand Up @@ -2,7 +2,7 @@ package main

import (
"bytes"
"io/ioutil"
"os"
)

func main() {
Expand All @@ -11,7 +11,7 @@ func main() {
if err := render(buf); err != nil {
panic(err)
}
if err := ioutil.WriteFile("./jen/generated.go", buf.Bytes(), 0644); err != nil {
if err := os.WriteFile("./jen/generated.go", buf.Bytes(), 0644); err != nil {
panic(err)
}
}
4 changes: 2 additions & 2 deletions genjen/render_test.go
@@ -1,7 +1,7 @@
package main

import (
"io/ioutil"
"os"
"regexp"
"testing"

Expand All @@ -17,7 +17,7 @@ func TestRender(t *testing.T) {
generatedString := buf.String()

existingFilePath := "../jen/generated.go"
existingBytes, err := ioutil.ReadFile(existingFilePath)
existingBytes, err := os.ReadFile(existingFilePath)
if err != nil {
t.Fatal(err.Error())
}
Expand Down
4 changes: 2 additions & 2 deletions gennames/main.go
Expand Up @@ -3,8 +3,8 @@ package main
import (
"bytes"
"flag"
"io/ioutil"
"log"
"os"
)

func main() {
Expand All @@ -23,7 +23,7 @@ func main() {
if err := hints(buf, *pkg, *name, *goListPath, *filter, *standard, *novendor); err != nil {
log.Fatal(err.Error())
}
if err := ioutil.WriteFile(*out, buf.Bytes(), 0644); err != nil {
if err := os.WriteFile(*out, buf.Bytes(), 0644); err != nil {
log.Fatal(err.Error())
}
}
4 changes: 2 additions & 2 deletions jen/jen.go
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"go/format"
"io"
"io/ioutil"
"os"
"sort"
"strconv"
)
Expand All @@ -24,7 +24,7 @@ func (f *File) Save(filename string) error {
if err := f.Render(buf); err != nil {
return err
}
if err := ioutil.WriteFile(filename, buf.Bytes(), 0644); err != nil {
if err := os.WriteFile(filename, buf.Bytes(), 0644); err != nil {
return err
}
return nil
Expand Down

0 comments on commit e319413

Please sign in to comment.