Skip to content

Commit

Permalink
upgraded deprecated call
Browse files Browse the repository at this point in the history
  • Loading branch information
adranwit committed Mar 16, 2024
1 parent 4e60ffd commit 0029bdd
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions modifier/replacer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import (
"github.com/viant/afs/file"
"github.com/viant/afs/option"
"io"
"io/ioutil"
"os"
"strings"
)

//Replace return modification handler with the specified replacements map
// Replace return modification handler with the specified replacements map
func Replace(replacements map[string]string) option.Modifier {
return func(_ string, info os.FileInfo, reader io.ReadCloser) (os.FileInfo, io.ReadCloser, error) {
data, err := ioutil.ReadAll(reader)
data, err := io.ReadAll(reader)
if err != nil {
return nil, nil, err
}
Expand All @@ -24,6 +23,6 @@ func Replace(replacements map[string]string) option.Modifier {
}
}
info = file.AdjustInfoSize(info, len(text))
return info, ioutil.NopCloser(strings.NewReader(text)), nil
return info, io.NopCloser(strings.NewReader(text)), nil
}
}

0 comments on commit 0029bdd

Please sign in to comment.