diff options
| author | Shulhan <ms@kilabit.info> | 2022-03-03 15:37:19 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2022-03-03 15:37:19 +0700 |
| commit | 6299999165e2ff01528a6d9ba4a20b201fc2b6b7 (patch) | |
| tree | 81daf3a278abe4c51adc70a8ed695f6482babf97 | |
| parent | 9cdda70f54ed3a1631f39d20e4c3a95f63f9eeec (diff) | |
| download | pakakeh.go-6299999165e2ff01528a6d9ba4a20b201fc2b6b7.tar.xz | |
lib/memfs: export the Remount method
The Remount method reset the memfs instance to force rescanning
the files again from file system.
| -rw-r--r-- | lib/memfs/embed.go | 3 | ||||
| -rw-r--r-- | lib/memfs/memfs.go | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/memfs/embed.go b/lib/memfs/embed.go index 8b1ad19a..550a7470 100644 --- a/lib/memfs/embed.go +++ b/lib/memfs/embed.go @@ -24,6 +24,9 @@ type generateData struct { // // GoEmbed write the tree nodes as Go generated source file. +// This method assume that the files inside the mfs instance is already +// up-to-date. +// If you are not sure, call Remount. // func (mfs *MemFS) GoEmbed() (err error) { logp := "GoEmbed" diff --git a/lib/memfs/memfs.go b/lib/memfs/memfs.go index 59cbe234..79caae1d 100644 --- a/lib/memfs/memfs.go +++ b/lib/memfs/memfs.go @@ -509,8 +509,9 @@ func (mfs *MemFS) mount() (err error) { return nil } -// remount reset the memfs to scanning the files again. -func (mfs *MemFS) remount() (err error) { +// Remount reset the memfs instance to force rescanning the files again from +// file system. +func (mfs *MemFS) Remount() (err error) { mfs.Root = nil mfs.PathNodes = nil return mfs.mount() |
