diff options
author | Mike Crute <mike@crute.us> | 2023-08-18 09:36:31 -0700 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2023-08-18 09:36:31 -0700 |
commit | e93af9c1bd2684898f5ebc31733df667ca0a8f12 (patch) | |
tree | 0069185b07c40455184412fcf9c95521cee1ca79 | |
parent | 9956e64f2c9f8c055c60bc82fcbb1e979bfb0b47 (diff) | |
download | golib-e93af9c1bd2684898f5ebc31733df667ca0a8f12.tar.bz2 golib-e93af9c1bd2684898f5ebc31733df667ca0a8f12.tar.xz golib-e93af9c1bd2684898f5ebc31733df667ca0a8f12.zip |
fs: add MustSubv0.6.1
-rw-r--r-- | fs/sub.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/sub.go b/fs/sub.go new file mode 100644 index 0000000..7c051b7 --- /dev/null +++ b/fs/sub.go | |||
@@ -0,0 +1,14 @@ | |||
1 | package fs | ||
2 | |||
3 | import ( | ||
4 | "fmt" | ||
5 | "io/fs" | ||
6 | ) | ||
7 | |||
8 | func MustSub(t fs.FS, prefix string) fs.FS { | ||
9 | s, err := fs.Sub(t, prefix) | ||
10 | if err != nil { | ||
11 | panic(fmt.Errorf("Error creating sub-filesystem: %w", err)) | ||
12 | } | ||
13 | return s | ||
14 | } | ||