-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tighearnán Carroll
committed
Mar 27, 2023
1 parent
3e06956
commit 43cbcbe
Showing
2 changed files
with
23 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package storage | ||
|
||
import ( | ||
"io/fs" | ||
"os" | ||
) | ||
|
||
// FS is a wrapper that falls back to `os`. | ||
type FS struct { | ||
FS fs.FS | ||
} | ||
|
||
// Open a file in the provided `fs.FS`. If none provided, | ||
// open via `os.Open` | ||
func (f FS) Open(name string) (fs.File, error) { | ||
if f.FS == nil { | ||
return os.Open(name) | ||
} | ||
|
||
return f.FS.Open(name) | ||
} |
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