summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-07-07 19:29:27 +0700
committerShulhan <ms@kilabit.info>2022-07-07 19:29:27 +0700
commita0689d4cb2f23033e7c984a7d7a66087c157542e (patch)
treed6981e3027e4c6e3b2c25e8371cc752ba958954c
parentec8dcf9eba1fc69a3b3369a2494ee8f01ef4f196 (diff)
downloadpakakeh.go-a0689d4cb2f23033e7c984a7d7a66087c157542e.tar.xz
lib/memfs: ignore error on Get when calling node Update
If node exist in memory, error on Update does not means the file is not exist. The node may have been embedded and then merged with other MemFS instance with Development flag set to true.
-rw-r--r--lib/memfs/memfs.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/memfs/memfs.go b/lib/memfs/memfs.go
index fb811822..ed44000e 100644
--- a/lib/memfs/memfs.go
+++ b/lib/memfs/memfs.go
@@ -240,10 +240,10 @@ func (mfs *MemFS) Get(path string) (node *Node, err error) {
}
if mfs.Opts.Development {
- err = node.Update(nil, mfs.Opts.MaxFileSize)
- if err != nil {
- return nil, fmt.Errorf("%s: %s: %w", logp, path, err)
- }
+ _ = node.Update(nil, mfs.Opts.MaxFileSize)
+ // Ignore error if the file is not exist in storage.
+ // Use case: the node maybe have been result of embed and the
+ // merged with other MemFS instance that use Development flag.
}
return node, nil