diff --git a/cmd/gofmtmd/main.go b/cmd/gofmtmd/main.go index 2d5fe29..7c9f6a6 100644 --- a/cmd/gofmtmd/main.go +++ b/cmd/gofmtmd/main.go @@ -2,7 +2,7 @@ package main import ( "fmt" - "io/ioutil" + "io" "log" "os" @@ -28,9 +28,9 @@ var rootCmd = &cobra.Command{ var md []byte var err error if filename != "" { - md, err = ioutil.ReadFile(filename) + md, err = os.ReadFile(filename) } else { - md, err = ioutil.ReadAll(os.Stdin) + md, err = io.ReadAll(os.Stdin) } if err != nil { log.Fatalf("[gofmtmd] failed to read bytes from %v: %v", filename, err) @@ -42,7 +42,7 @@ var rootCmd = &cobra.Command{ if filename != "" { if replace { - err = ioutil.WriteFile(filename, out, 0644) + err = os.WriteFile(filename, out, 0644) if err != nil { log.Fatalf("[gofmtmd] failed to writes to %v: %v", filename, err) } @@ -50,7 +50,7 @@ var rootCmd = &cobra.Command{ } } if outputfile != "" { - err := ioutil.WriteFile(outputfile, out, 0644) + err := os.WriteFile(outputfile, out, 0644) if err != nil { log.Fatalf("[gofmtmd] failed to writes to %v: %v", outputfile, err) } diff --git a/gofmtmd_test.go b/gofmtmd_test.go index f8a7c47..f336112 100644 --- a/gofmtmd_test.go +++ b/gofmtmd_test.go @@ -3,7 +3,7 @@ package gofmtmd_test import ( "bytes" "fmt" - "io/ioutil" + "os" "testing" "github.com/po3rin/gofmtmd" @@ -32,11 +32,11 @@ func TestFmtGoCodeInMarkdown(t *testing.T) { tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() - md, err := ioutil.ReadFile(tt.inputfile) + md, err := os.ReadFile(tt.inputfile) if err != nil { t.Fatalf("failed to read bytes from %v: ", tt.inputfile) } - want, err := ioutil.ReadFile(tt.goldenfile) + want, err := os.ReadFile(tt.goldenfile) if err != nil { t.Fatalf("failed to read bytes from %v: ", tt.inputfile) }