doc + bugfix
This commit is contained in:
parent
8ace5844f6
commit
0e24590e1d
@ -61,7 +61,7 @@ func (c *Command) Execute(args []string) (err error) {
|
|||||||
return fmt.Errorf("create: %w", err)
|
return fmt.Errorf("create: %w", err)
|
||||||
}
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
err1 = outf.Close()
|
err1 := outf.Close()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = err1
|
err = err1
|
||||||
}
|
}
|
||||||
|
1
main.go
1
main.go
@ -4,7 +4,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
|
|
||||||
goflags "github.com/jessevdk/go-flags"
|
goflags "github.com/jessevdk/go-flags"
|
||||||
|
|
||||||
"github.com/motiejus/code/undocker/internal/cmdlxcconfig"
|
"github.com/motiejus/code/undocker/internal/cmdlxcconfig"
|
||||||
"github.com/motiejus/code/undocker/internal/cmdrootfs"
|
"github.com/motiejus/code/undocker/internal/cmdrootfs"
|
||||||
)
|
)
|
||||||
|
@ -31,10 +31,10 @@ func (t *tree) Add(path string) {
|
|||||||
|
|
||||||
// HasPrefix returns if tree contains a prefix matching a given sequence.
|
// HasPrefix returns if tree contains a prefix matching a given sequence.
|
||||||
// Search algorithm is naive: it does linear search when going through the
|
// Search algorithm is naive: it does linear search when going through the
|
||||||
// nodes instead of binary-search. Since we expect number of children to be
|
// nodes, whereas binary search would work here too. Since we expect number of
|
||||||
// really small (usually 1 or 2), it does not really matter. If you find a
|
// children to be really small (usually 1 or 2), it does not really matter. If
|
||||||
// real-world container with 30+ whiteout paths on a single path, please ping
|
// you find a real-world container with 30+ whiteout paths on a single path, it
|
||||||
// the author/maintainer of this code.
|
// may make sense to replace the algorithm.
|
||||||
func (t *tree) HasPrefix(path string) bool {
|
func (t *tree) HasPrefix(path string) bool {
|
||||||
return t.hasprefix(strings.Split(filepath.Clean(path), "/"))
|
return t.hasprefix(strings.Split(filepath.Clean(path), "/"))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user