agiledragon / agiledragon/gomonkey
feature: replace the arguments of a function
Open
- Dominant language
- Go
- Stars
- 2.3k
- Forks
- 192
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 1
Description
Is there a more appropriate way to change the parameters of a function?
more complicated way....
```golang
var patchReadDir = gomonkey.NewPatches()
var readDir func(name string) ([]os.DirEntry, error)
readDir = func(name string) ([]os.DirEntry, error) {
patchReadDir.Reset()
defer patchReadDir.ApplyFunc(os.ReadDir, readDir)
return os.ReadDir(filepath.Join(c.baseDir, name))
}
patchReadDir.ApplyFunc(os.ReadDir, readDir)
c.patches = append(c.patches, patchReadDir)
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.