From 8d1e0fd8ec0179e9ad7ecc7a892d099729bf8dbf Mon Sep 17 00:00:00 2001 From: Shulhan Date: Sun, 26 Jan 2025 00:08:29 +0700 Subject: lib/memfs: return nil on AddChild if path is not included Checking if child is nil is impossible here, because the AddChild create and return new child. --- lib/memfs/memfs.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/memfs/memfs.go b/lib/memfs/memfs.go index 9e02fc95..012b9839 100644 --- a/lib/memfs/memfs.go +++ b/lib/memfs/memfs.go @@ -76,13 +76,8 @@ func (mfs *MemFS) AddChild(parent *Node, fi os.FileInfo) (child *Node, err error return nil, nil } if !mfs.Opts.isIncluded(sysPath, fi) { - if child != nil { - // The path being watched, but not included. - // Set the generate function name to empty, to prevent - // GoEmbed embed the content of this node. - child.GenFuncName = "" - } - return child, nil + // The path being watched, but not included. + return nil, nil } child, err = parent.addChild(sysPath, fi, mfs.Opts.MaxFileSize) -- cgit v1.3