diff options
| author | Shulhan <ms@kilabit.info> | 2024-03-06 03:06:54 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2024-03-06 03:06:54 +0700 |
| commit | 1e7cb99f42bcd41e98326bd9406d3cecfb2a4542 (patch) | |
| tree | 9981f1ebc98670f516939374012646314dda663f /lib/memfs/node.go | |
| parent | 16607dc13477ee53d95ee0295192643f6e726652 (diff) | |
| download | pakakeh.go-1e7cb99f42bcd41e98326bd9406d3cecfb2a4542.tar.xz | |
all: conform with linter gosec, ineffasign, and makezero
Some of warnings from those linter are false positives, so we just
annotated them.
Diffstat (limited to 'lib/memfs/node.go')
| -rw-r--r-- | lib/memfs/node.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/memfs/node.go b/lib/memfs/node.go index 34ed18a5..5ed87b02 100644 --- a/lib/memfs/node.go +++ b/lib/memfs/node.go @@ -262,9 +262,10 @@ func (node *Node) Readdir(count int) (fis []os.FileInfo, err error) { return nil, nil } if count <= 0 || count >= len(node.Childs) { - fis = make([]os.FileInfo, len(node.Childs)) - for x := 0; x < len(node.Childs); x++ { - fis[x] = node.Childs[x] + fis = make([]os.FileInfo, 0, len(node.Childs)) + var child *Node + for _, child = range node.Childs { + fis = append(fis, child) } node.off = 0 return fis, nil |
