diff options
| author | Shulhan <ms@kilabit.info> | 2023-11-08 02:23:45 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2023-11-08 03:26:14 +0700 |
| commit | bb97c79454eeddf7815752a48cd16889f5b16ae4 (patch) | |
| tree | 5b585e117791ecb403f9faeb2e60522cbe67f5f6 /lib/memfs | |
| parent | 24be7f0256933fec01450fa01e4013dc0180880f (diff) | |
| download | pakakeh.go-bb97c79454eeddf7815752a48cd16889f5b16ae4.tar.xz | |
lib/memfs: remove embedding os.FileInfo and http.File
The original idea of embedding those interface is to guard the Node
implementation to always follow all methods in the os.FileInfo and
http.File, in case there is additional methods in the future.
But, embedding interfaces make the struct store it as field "FileInfo"
and File with "<nil>" values, which add storage cost to Node.
Diffstat (limited to 'lib/memfs')
| -rw-r--r-- | lib/memfs/node.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/memfs/node.go b/lib/memfs/node.go index c4843b26..94ba1dae 100644 --- a/lib/memfs/node.go +++ b/lib/memfs/node.go @@ -39,12 +39,11 @@ var ( ) // Node represent a single file. +// +// This Node implement os.FileInfo and http.File. type Node struct { modTime time.Time // ModTime contains file modification time. - os.FileInfo - http.File - Parent *Node // Pointer to parent directory. SysPath string // The original file path in system. |
