Skip to content

Commit

Permalink
replace uses of the deprecated io/ioutil
Browse files Browse the repository at this point in the history
  • Loading branch information
testwill committed Jul 22, 2023
1 parent 65fce05 commit be057e9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions cmd/xurls/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"flag"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
Expand Down Expand Up @@ -197,7 +196,7 @@ func scanPath(re *regexp.Regexp, path string) error {
// Overwrite the file, if we weren't reading stdin. Report its
// path too.
fmt.Println(path)
if err := ioutil.WriteFile(path, outBuf.Bytes(), 0o666); err != nil {
if err := os.WriteFile(path, outBuf.Bytes(), 0o666); err != nil {
return err
}
}
Expand Down
3 changes: 1 addition & 2 deletions cmd/xurls/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package main
import (
"context"
"fmt"
"io/ioutil"
"net"
"net/http"
"os"
Expand Down Expand Up @@ -116,7 +115,7 @@ func TestScript(t *testing.T) {
for _, arg := range args {
data := ts.ReadFile(arg)
data = os.Expand(data, ts.Getenv)
err := ioutil.WriteFile(ts.MkAbs(arg), []byte(data), 0o666)
err := os.WriteFile(ts.MkAbs(arg), []byte(data), 0o666)
ts.Check(err)
}
},
Expand Down

0 comments on commit be057e9

Please sign in to comment.