Skip to content

Commit

Permalink
Merge pull request #18 from KamLar/master
Browse files Browse the repository at this point in the history
fixed Replace method return type
  • Loading branch information
adranwit authored Mar 13, 2023
2 parents 307d93c + 74dbd36 commit 7c7f7aa
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea
local_test.go
*.iml
2 changes: 1 addition & 1 deletion modifier/replacer.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

//Replace return modification handler with the specified replacements map
func Replace(replacements map[string]string) option.Modifier {
return func(info os.FileInfo, reader io.ReadCloser) (os.FileInfo, io.ReadCloser, error) {
return func(_ string, info os.FileInfo, reader io.ReadCloser) (os.FileInfo, io.ReadCloser, error) {
data, err := ioutil.ReadAll(reader)
if err != nil {
return nil, nil, err
Expand Down
2 changes: 1 addition & 1 deletion modifier/replacer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func TestReplace(t *testing.T) {
})

info := file.NewInfo("blah", 0, 0644, time.Now(), false)
_, reader, err := replaceer(info, ioutil.NopCloser(strings.NewReader("test is test")))
_, reader, err := replaceer("", info, ioutil.NopCloser(strings.NewReader("test is test")))
assert.Nil(t, err)
actual, _ := ioutil.ReadAll(reader)
assert.EqualValues(t, "Test is Test", actual)
Expand Down

0 comments on commit 7c7f7aa

Please sign in to comment.