-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introduce FileIO abstraction instead of hardcoded os.* function calls (…
- Loading branch information
Showing
7 changed files
with
100 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package fileio | ||
|
||
import "os" | ||
|
||
// OSFile provides a storage based on Go's standard "os" package for filesystem support. | ||
type OSFile struct{} | ||
|
||
func (*OSFile) MkdirAll(path string, perm os.FileMode) error { | ||
return os.MkdirAll(path, perm) | ||
} | ||
|
||
func (*OSFile) ReadFile(name string) ([]byte, error) { | ||
return os.ReadFile(name) | ||
} | ||
|
||
func (*OSFile) WriteFile(name string, data []byte, perm os.FileMode) error { | ||
return os.WriteFile(name, data, perm) | ||
} | ||
|
||
func (*OSFile) IsNotExist(err error) bool { | ||
return os.IsNotExist(err) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters