From d88f61738d73fd9670af812c9906b2a52b910c73 Mon Sep 17 00:00:00 2001 From: Kotaro Inoue Date: Tue, 26 Sep 2023 03:38:44 +0900 Subject: [PATCH 01/76] Fix to respect special bit specified in the mode of copier Signed-off-by: Kotaro Inoue --- copy/copy_linux.go | 8 +++++++- copy/copy_unix.go | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/copy/copy_linux.go b/copy/copy_linux.go index 971cb5c5..d2553098 100644 --- a/copy/copy_linux.go +++ b/copy/copy_linux.go @@ -30,7 +30,13 @@ func (c *copier) copyFileInfo(fi os.FileInfo, src, name string) error { m := fi.Mode() if c.mode != nil { - m = (m & ^os.FileMode(0777)) | os.FileMode(*c.mode&0777) + m = os.FileMode(*c.mode & 0777) + sb := *c.mode & 0777 + if sb != 0 { + m |= os.FileMode(sb) + } else { + m |= m & ^os.FileMode(0777) + } } if (fi.Mode() & os.ModeSymlink) != os.ModeSymlink { if err := os.Chmod(name, m); err != nil { diff --git a/copy/copy_unix.go b/copy/copy_unix.go index 945e96c5..4a79e63d 100644 --- a/copy/copy_unix.go +++ b/copy/copy_unix.go @@ -31,7 +31,13 @@ func (c *copier) copyFileInfo(fi os.FileInfo, src, name string) error { m := fi.Mode() if c.mode != nil { - m = (m & ^os.FileMode(0777)) | os.FileMode(*c.mode&0777) + m = os.FileMode(*c.mode & 0777) + sb := *c.mode & 0777 + if sb != 0 { + m |= os.FileMode(sb) + } else { + m |= m & ^os.FileMode(0777) + } } if (fi.Mode() & os.ModeSymlink) != os.ModeSymlink { if err := os.Chmod(name, m); err != nil { From 0db3c1fbec08c77441b3f49a0dc2ac9d66b6000d Mon Sep 17 00:00:00 2001 From: Kotaro Inoue Date: Tue, 26 Sep 2023 03:39:03 +0900 Subject: [PATCH 02/76] Add tests Signed-off-by: Kotaro Inoue --- copy/copy_unix_test.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/copy/copy_unix_test.go b/copy/copy_unix_test.go index df710d4c..5156a875 100644 --- a/copy/copy_unix_test.go +++ b/copy/copy_unix_test.go @@ -56,3 +56,33 @@ func TestCopyDevicesAndFifo(t *testing.T) { assert.NotEqual(t, os.ModeSocket, fi.Mode()&os.ModeSocket) // socket copied as stub assert.Equal(t, os.FileMode(0555), fi.Mode()&0777) } + +func TestCopySetuid(t *testing.T) { + requiresRoot(t) + + t1 := t.TempDir() + + err := mknod(filepath.Join(t1, "char"), unix.S_IFCHR|0444, int(unix.Mkdev(1, 9))) + require.NoError(t, err) + + t2 := t.TempDir() + + err = Copy(context.TODO(), t1, ".", t2, ".") + require.NoError(t, err) + + fi, err := os.Lstat(filepath.Join(t2, "char")) + require.NoError(t, err) + assert.Equal(t, os.FileMode(0444), fi.Mode()&07777) + + t3 := t.TempDir() + + p := 04444 + err = Copy(context.TODO(), t1, ".", t3, ".", WithCopyInfo(CopyInfo{ + Mode: &p, + })) + require.NoError(t, err) + + fi, err = os.Lstat(filepath.Join(t3, "char")) + require.NoError(t, err) + assert.Equal(t, os.FileMode(04444), fi.Mode()&07777) +} From 03de04d2236a1d6e1f6be20acb8687cdfd35ec5b Mon Sep 17 00:00:00 2001 From: Erik Sipsma Date: Sun, 5 Nov 2023 19:56:31 -0800 Subject: [PATCH 03/76] Add support for always overwriting existing paths Before this, copy would always refuse to replace an existing path in the dest with something from the source of a different type. E.g. if there was a symlink at the dest, you'd get an error if copying src meant replacing the symlink w/ a directory. This is the right default behavior but there are situations in which callers may want to opt in to instead always replacing what's in dest with what's in source. This adds an option to enable that behavior. Signed-off-by: Erik Sipsma --- copy/copy.go | 69 ++++++++++++++++++++++++++++++++--------------- copy/copy_test.go | 54 +++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 22 deletions(-) diff --git a/copy/copy.go b/copy/copy.go index 558c553f..f8cc0a43 100644 --- a/copy/copy.go +++ b/copy/copy.go @@ -88,7 +88,7 @@ func Copy(ctx context.Context, srcRoot, src, dstRoot, dst string, opts ...Opt) e return err } - c, err := newCopier(dstRoot, ci.Chown, ci.Utime, ci.Mode, ci.XAttrErrorHandler, ci.IncludePatterns, ci.ExcludePatterns, ci.ChangeFunc) + c, err := newCopier(dstRoot, ci.Chown, ci.Utime, ci.Mode, ci.XAttrErrorHandler, ci.IncludePatterns, ci.ExcludePatterns, ci.AlwaysReplaceExistingDestPaths, ci.ChangeFunc) if err != nil { return err } @@ -172,7 +172,11 @@ type CopyInfo struct { IncludePatterns []string // Exclude files/dir matching any of these patterns (even if they match an include pattern) ExcludePatterns []string - ChangeFunc fsutil.ChangeFunc + // If true, any source path that overwrite existing destination paths will always replace + // the existing destination path, even if they are of different types (e.g. a directory will + // replace any existing symlink or file) + AlwaysReplaceExistingDestPaths bool + ChangeFunc fsutil.ChangeFunc } type Opt func(*CopyInfo) @@ -227,16 +231,17 @@ func WithChangeNotifier(fn fsutil.ChangeFunc) Opt { } type copier struct { - chown Chowner - utime *time.Time - mode *int - inodes map[uint64]string - xattrErrorHandler XAttrErrorHandler - includePatternMatcher *patternmatcher.PatternMatcher - excludePatternMatcher *patternmatcher.PatternMatcher - parentDirs []parentDir - changefn fsutil.ChangeFunc - root string + chown Chowner + utime *time.Time + mode *int + inodes map[uint64]string + xattrErrorHandler XAttrErrorHandler + includePatternMatcher *patternmatcher.PatternMatcher + excludePatternMatcher *patternmatcher.PatternMatcher + parentDirs []parentDir + changefn fsutil.ChangeFunc + root string + alwaysReplaceExistingDestPaths bool } type parentDir struct { @@ -245,7 +250,7 @@ type parentDir struct { copied bool } -func newCopier(root string, chown Chowner, tm *time.Time, mode *int, xeh XAttrErrorHandler, includePatterns, excludePatterns []string, changeFunc fsutil.ChangeFunc) (*copier, error) { +func newCopier(root string, chown Chowner, tm *time.Time, mode *int, xeh XAttrErrorHandler, includePatterns, excludePatterns []string, alwaysReplaceExistingDestPaths bool, changeFunc fsutil.ChangeFunc) (*copier, error) { if xeh == nil { xeh = func(dst, src, key string, err error) error { return err @@ -271,15 +276,16 @@ func newCopier(root string, chown Chowner, tm *time.Time, mode *int, xeh XAttrEr } return &copier{ - root: root, - inodes: map[uint64]string{}, - chown: chown, - utime: tm, - xattrErrorHandler: xeh, - mode: mode, - includePatternMatcher: includePatternMatcher, - excludePatternMatcher: excludePatternMatcher, - changefn: changeFunc, + root: root, + inodes: map[uint64]string{}, + chown: chown, + utime: tm, + xattrErrorHandler: xeh, + mode: mode, + includePatternMatcher: includePatternMatcher, + excludePatternMatcher: excludePatternMatcher, + changefn: changeFunc, + alwaysReplaceExistingDestPaths: alwaysReplaceExistingDestPaths, }, nil } @@ -324,6 +330,10 @@ func (c *copier) copy(ctx context.Context, src, srcComponents, target string, ov } if include { + if err := c.removeTargetIfNeeded(src, target, fi, targetFi); err != nil { + return err + } + if err := c.createParentDirs(src, srcComponents, target, overwriteTargetMetadata); err != nil { return err } @@ -440,6 +450,21 @@ func (c *copier) exclude(path string, fi os.FileInfo, parentExcludeMatchInfo pat return m, matchInfo, nil } +func (c *copier) removeTargetIfNeeded(src, target string, srcFi, targetFi os.FileInfo) error { + if !c.alwaysReplaceExistingDestPaths { + return nil + } + if targetFi == nil { + // already doesn't exist + return nil + } + if srcFi.IsDir() && targetFi.IsDir() { + // directories are merged, not replaced + return nil + } + return os.RemoveAll(target) +} + // Delayed creation of parent directories when a file or dir matches an include // pattern. func (c *copier) createParentDirs(src, srcComponents, target string, overwriteTargetMetadata bool) error { diff --git a/copy/copy_test.go b/copy/copy_test.go index e77d54e7..425ade68 100644 --- a/copy/copy_test.go +++ b/copy/copy_test.go @@ -359,6 +359,60 @@ func TestCopySymlinks(t *testing.T) { require.Equal(t, "foo.txt", link) } +func TestCopyWithAlwaysReplaceExistingDestPaths(t *testing.T) { + destDir := t.TempDir() + require.NoError(t, fstest.Apply( + fstest.CreateDir("root", 0755), + fstest.CreateDir("root/overwritedir", 0755), + fstest.CreateFile("root/overwritedir/subfile", nil, 0755), + fstest.CreateFile("root/overwritefile", nil, 0755), + fstest.Symlink("dir", "root/overwritesymlink"), + fstest.CreateDir("root/dir", 0755), + fstest.CreateFile("root/dir/dirfile1", nil, 0755), + fstest.CreateDir("root/dir/overwritesubdir", 0755), + fstest.CreateFile("root/dir/overwritesubfile", nil, 0755), + fstest.Symlink("dirfile1", "root/dir/overwritesymlink"), + ).Apply(destDir)) + + srcDir := t.TempDir() + require.NoError(t, fstest.Apply( + fstest.CreateDir("root", 0755), + fstest.CreateFile("root/overwritedir", nil, 0755), + fstest.CreateDir("root/overwritefile", 0755), + fstest.CreateFile("root/overwritefile/foo", nil, 0755), + fstest.CreateDir("root/overwritesymlink", 0755), + fstest.CreateDir("root/dir", 0755), + fstest.CreateFile("root/dir/dirfile2", nil, 0755), + fstest.CreateFile("root/dir/overwritesubdir", nil, 0755), + fstest.CreateDir("root/dir/overwritesubfile", 0755), + fstest.CreateDir("root/dir/overwritesymlink", 0755), + ).Apply(srcDir)) + + expectedDir := t.TempDir() + require.NoError(t, fstest.Apply( + fstest.CreateDir("root", 0755), + fstest.CreateFile("root/overwritedir", nil, 0755), + fstest.CreateDir("root/overwritefile", 0755), + fstest.CreateFile("root/overwritefile/foo", nil, 0755), + fstest.CreateDir("root/overwritesymlink", 0755), + fstest.CreateDir("root/dir", 0755), + fstest.CreateFile("root/dir/dirfile1", nil, 0755), + fstest.CreateFile("root/dir/dirfile2", nil, 0755), + fstest.CreateFile("root/dir/overwritesubdir", nil, 0755), + fstest.CreateDir("root/dir/overwritesubfile", 0755), + fstest.CreateDir("root/dir/overwritesymlink", 0755), + ).Apply(expectedDir)) + + err := Copy(context.TODO(), srcDir, "root", destDir, "root", WithCopyInfo(CopyInfo{ + AlwaysReplaceExistingDestPaths: true, + CopyDirContents: true, + })) + require.NoError(t, err) + + err = fstest.CheckDirectoryEqual(destDir, expectedDir) + require.NoError(t, err) +} + func testCopy(t *testing.T, apply fstest.Applier, exp string) error { t1 := t.TempDir() t2 := t.TempDir() From bea810c0c14d36b7b141c4cf236a2830e29a14a7 Mon Sep 17 00:00:00 2001 From: Kazuyoshi Kato Date: Thu, 16 Nov 2023 00:45:26 -0800 Subject: [PATCH 04/76] Migrate off of gogo/protobuf gogo/protobuf has been deprecated since 2022. This change uses Google's code generator instead of gogo/protobuf. Signed-off-by: Kazuyoshi Kato --- diff_containerd.go | 8 +- diskwriter.go | 12 +- fs.go | 11 +- fs_test.go | 4 +- go.mod | 4 +- go.sum | 29 -- receive.go | 3 +- receive_test.go | 33 +- send.go | 5 +- stat.go | 21 +- stat_test.go | 6 +- stat_unix.go | 2 +- types/generate.go | 10 +- types/stat.go | 2 +- types/stat.pb.go | 1014 +++++++------------------------------------- types/stat.proto | 2 +- types/wire.pb.go | 701 ++++++++---------------------- types/wire.proto | 2 +- 18 files changed, 428 insertions(+), 1441 deletions(-) diff --git a/diff_containerd.go b/diff_containerd.go index d8619abf..261431b8 100644 --- a/diff_containerd.go +++ b/diff_containerd.go @@ -106,11 +106,11 @@ func doubleWalkDiff(ctx context.Context, changeFn ChangeFunc, a, b walkerFn, fil var f *types.Stat var f2copy *currentPath if f2 != nil { - statCopy := *f2.stat + statCopy := cloneStat(f2.stat) if filter != nil { - filter(f2.path, &statCopy) + filter(f2.path, statCopy) } - f2copy = ¤tPath{path: f2.path, stat: &statCopy} + f2copy = ¤tPath{path: f2.path, stat: statCopy} } k, p := pathChange(f1, f2copy) switch k { @@ -188,7 +188,7 @@ func sameFile(f1, f2 *currentPath, differ DiffType) (same bool, retErr error) { } // If not a directory also check size, modtime, and content if !f1.stat.IsDir() { - if f1.stat.Size_ != f2.stat.Size_ { + if f1.stat.Size != f2.stat.Size { return false, nil } diff --git a/diskwriter.go b/diskwriter.go index 10b60851..815f4e07 100644 --- a/diskwriter.go +++ b/diskwriter.go @@ -124,10 +124,10 @@ func (dw *DiskWriter) HandleChange(kind ChangeKind, p string, fi os.FileInfo, er return errors.WithStack(&os.PathError{Path: p, Err: syscall.EBADMSG, Op: "change without stat info"}) } - statCopy := *stat + statCopy := cloneStat(stat) if dw.filter != nil { - if ok := dw.filter(p, &statCopy); !ok { + if ok := dw.filter(p, statCopy); !ok { return nil } } @@ -146,7 +146,7 @@ func (dw *DiskWriter) HandleChange(kind ChangeKind, p string, fi os.FileInfo, er } if oldFi != nil && fi.IsDir() && oldFi.IsDir() { - if err := rewriteMetadata(destPath, &statCopy); err != nil { + if err := rewriteMetadata(destPath, statCopy); err != nil { return errors.Wrapf(err, "error setting dir metadata for %s", destPath) } return nil @@ -170,7 +170,7 @@ func (dw *DiskWriter) HandleChange(kind ChangeKind, p string, fi os.FileInfo, er } dw.dirModTimes[destPath] = statCopy.ModTime case fi.Mode()&os.ModeDevice != 0 || fi.Mode()&os.ModeNamedPipe != 0: - if err := handleTarTypeBlockCharFifo(newPath, &statCopy); err != nil { + if err := handleTarTypeBlockCharFifo(newPath, statCopy); err != nil { return errors.Wrapf(err, "failed to create device %s", newPath) } case fi.Mode()&os.ModeSymlink != 0: @@ -198,7 +198,7 @@ func (dw *DiskWriter) HandleChange(kind ChangeKind, p string, fi os.FileInfo, er } } - if err := rewriteMetadata(newPath, &statCopy); err != nil { + if err := rewriteMetadata(newPath, statCopy); err != nil { return errors.Wrapf(err, "error setting metadata for %s", newPath) } @@ -216,7 +216,7 @@ func (dw *DiskWriter) HandleChange(kind ChangeKind, p string, fi os.FileInfo, er if isRegularFile { if dw.opt.AsyncDataCb != nil { - dw.requestAsyncFileData(p, destPath, fi, &statCopy) + dw.requestAsyncFileData(p, destPath, fi, statCopy) } } else { return dw.processChange(kind, p, fi, nil) diff --git a/fs.go b/fs.go index fe370194..8b7a702e 100644 --- a/fs.go +++ b/fs.go @@ -91,7 +91,7 @@ func (fs *fs) Open(p string) (io.ReadCloser, error) { } type Dir struct { - Stat types.Stat + Stat *types.Stat FS FS } @@ -125,12 +125,12 @@ func (fs *subDirFS) Walk(ctx context.Context, target string, fn gofs.WalkDirFunc continue } - fi := &StatInfo{&d.Stat} + fi := &StatInfo{d.Stat} if !fi.IsDir() { return errors.WithStack(&os.PathError{Path: d.Stat.Path, Err: syscall.ENOTDIR, Op: "walk subdir"}) } dStat := d.Stat - if err := fn(d.Stat.Path, &DirEntryInfo{Stat: &dStat}, nil); err != nil { + if err := fn(d.Stat.Path, &DirEntryInfo{Stat: dStat}, nil); err != nil { return err } if err := d.FS.Walk(ctx, rest, func(p string, entry gofs.DirEntry, err error) error { @@ -191,7 +191,7 @@ func (s *StatInfo) Name() string { return filepath.Base(s.Stat.Path) } func (s *StatInfo) Size() int64 { - return s.Stat.Size_ + return s.Stat.Size } func (s *StatInfo) Mode() os.FileMode { return os.FileMode(s.Stat.Mode) @@ -246,6 +246,5 @@ func (s *DirEntryInfo) Info() (gofs.FileInfo, error) { s.Stat = stat } - st := *s.Stat - return &StatInfo{&st}, nil + return &StatInfo{s.Stat}, nil } diff --git a/fs_test.go b/fs_test.go index 54e7653b..df6cef62 100644 --- a/fs_test.go +++ b/fs_test.go @@ -73,14 +73,14 @@ func TestWalkDir(t *testing.T) { f, err := SubDirFS([]Dir{ { - Stat: types.Stat{ + Stat: &types.Stat{ Mode: uint32(os.ModeDir | 0755), Path: "1", }, FS: tmpfs, }, { - Stat: types.Stat{ + Stat: &types.Stat{ Mode: uint32(os.ModeDir | 0755), Path: "2", }, diff --git a/go.mod b/go.mod index 3dceea97..a261438c 100644 --- a/go.mod +++ b/go.mod @@ -5,13 +5,13 @@ go 1.19 require ( github.com/Microsoft/go-winio v0.5.2 github.com/containerd/continuity v0.4.1 - github.com/gogo/protobuf v1.3.2 github.com/moby/patternmatcher v0.5.0 github.com/opencontainers/go-digest v1.0.0 github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.8.4 golang.org/x/sync v0.1.0 golang.org/x/sys v0.1.0 + google.golang.org/protobuf v1.26.0 ) require ( @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/sirupsen/logrus v1.8.1 // indirect - google.golang.org/protobuf v1.26.0 // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 46c6359f..234ef4d8 100644 --- a/go.sum +++ b/go.sum @@ -4,13 +4,9 @@ github.com/containerd/continuity v0.4.1 h1:wQnVrjIyQ8vhU2sgOiL5T07jo+ouqc2bnKsv5 github.com/containerd/continuity v0.4.1/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -30,37 +26,12 @@ github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/receive.go b/receive.go index 209d1d2f..82da82ae 100644 --- a/receive.go +++ b/receive.go @@ -9,6 +9,7 @@ import ( "github.com/pkg/errors" "github.com/tonistiigi/fsutil/types" "golang.org/x/sync/errgroup" + "google.golang.org/protobuf/proto" ) type DiffType int @@ -170,7 +171,7 @@ func (r *receiver) run(ctx context.Context) error { return err } if r.progressCb != nil { - size += p.Size() + size += proto.Size(&p) r.progressCb(size, false) } diff --git a/receive_test.go b/receive_test.go index a36d5013..ebb92475 100644 --- a/receive_test.go +++ b/receive_test.go @@ -19,6 +19,7 @@ import ( "github.com/stretchr/testify/require" "github.com/tonistiigi/fsutil/types" "golang.org/x/sync/errgroup" + "google.golang.org/protobuf/proto" ) func TestSendError(t *testing.T) { @@ -79,7 +80,7 @@ func TestCopyWithSubDir(t *testing.T) { eg.Go(func() error { defer s1.(*fakeConnProto).closeSend() - subdir, err := SubDirFS([]Dir{{FS: fs, Stat: types.Stat{Path: "sub", Mode: uint32(os.ModeDir | 0755)}}}) + subdir, err := SubDirFS([]Dir{{FS: fs, Stat: &types.Stat{Path: "sub", Mode: uint32(os.ModeDir | 0755)}}}) if err != nil { return err } @@ -385,6 +386,19 @@ func sockPairProto(ctx context.Context) (Stream, Stream) { return &fakeConnProto{ctx, c1, c2}, &fakeConnProto{ctx, c2, c1} } +//nolint:unused +func clonePacket(from *types.Packet) *types.Packet { + var data []byte + copy(data, from.Data) + + return &types.Packet{ + Type: from.Type, + Stat: cloneStat(from.Stat), + ID: from.ID, + Data: data, + } +} + //nolint:unused type fakeConn struct { ctx context.Context @@ -399,15 +413,14 @@ func (fc *fakeConn) Context() context.Context { //nolint:unused func (fc *fakeConn) RecvMsg(m interface{}) error { - p, ok := m.(*types.Packet) + _, ok := m.(*types.Packet) if !ok { return errors.Errorf("invalid msg: %#v", m) } select { case <-fc.ctx.Done(): return fc.ctx.Err() - case p2 := <-fc.recvChan: - *p = *p2 + case _ = <-fc.recvChan: return nil } } @@ -418,12 +431,12 @@ func (fc *fakeConn) SendMsg(m interface{}) error { if !ok { return errors.Errorf("invalid msg: %#v", m) } - p2 := *p + p2 := clonePacket(p) p2.Data = append([]byte{}, p2.Data...) select { case <-fc.ctx.Done(): return fc.ctx.Err() - case fc.sendChan <- &p2: + case fc.sendChan <- p2: return nil } } @@ -450,7 +463,7 @@ func (fc *fakeConnProto) RecvMsg(m interface{}) error { if !ok { return io.EOF } - return p.Unmarshal(dt) + return proto.Unmarshal(dt, p) } } @@ -459,7 +472,7 @@ func (fc *fakeConnProto) SendMsg(m interface{}) error { if !ok { return errors.Errorf("invalid msg: %#v", m) } - dt, err := p.Marshal() + dt, err := proto.Marshal(p) if err != nil { return err } @@ -493,7 +506,7 @@ func (c *changes) HandleChange(kind ChangeKind, p string, fi os.FileInfo, err er func simpleSHA256Hasher(s *types.Stat) (hash.Hash, error) { h := sha256.New() - ss := *s + ss := cloneStat(s) ss.ModTime = 0 // Unlike Linux, on FreeBSD's stat() call returns -1 in st_rdev for regular files ss.Devminor = 0 @@ -503,7 +516,7 @@ func simpleSHA256Hasher(s *types.Stat) (hash.Hash, error) { ss.Mode = ss.Mode | 0777 } - dt, err := ss.Marshal() + dt, err := proto.Marshal(ss) if err != nil { return nil, err } diff --git a/send.go b/send.go index a044d04d..fac2de68 100644 --- a/send.go +++ b/send.go @@ -10,6 +10,7 @@ import ( "github.com/pkg/errors" "github.com/tonistiigi/fsutil/types" "golang.org/x/sync/errgroup" + "google.golang.org/protobuf/proto" ) var bufPool = sync.Pool{ @@ -167,7 +168,7 @@ func (s *sender) walk(ctx context.Context) error { s.mu.Unlock() } i++ - s.updateProgress(p.Size(), false) + s.updateProgress(proto.Size(p), false) return errors.Wrapf(s.conn.SendMsg(p), "failed to send stat %s", path) }) if err != nil { @@ -195,7 +196,7 @@ func (fs *fileSender) Write(dt []byte) (int, error) { if err := fs.sender.conn.SendMsg(p); err != nil { return 0, err } - fs.sender.updateProgress(p.Size(), false) + fs.sender.updateProgress(proto.Size(p), false) return len(dt), nil } diff --git a/stat.go b/stat.go index 2ab8da11..2217f833 100644 --- a/stat.go +++ b/stat.go @@ -27,7 +27,7 @@ func mkstat(path, relpath string, fi os.FileInfo, inodemap map[uint64]string) (* setUnixOpt(fi, stat, relpath, inodemap) if !fi.IsDir() { - stat.Size_ = fi.Size() + stat.Size = fi.Size() if fi.Mode()&os.ModeSymlink != 0 { link, err := os.Readlink(path) if err != nil { @@ -62,3 +62,22 @@ func Stat(path string) (*types.Stat, error) { } return mkstat(path, filepath.Base(path), fi, nil) } + +func cloneStat(from *types.Stat) *types.Stat { + clone := &types.Stat{ + Path: from.Path, + Mode: from.Mode, + Uid: from.Uid, + Gid: from.Gid, + Size: from.Size, + ModTime: from.ModTime, + Linkname: from.Linkname, + Devmajor: from.Devmajor, + Devminor: from.Devminor, + Xattrs: make(map[string][]byte, len(from.Xattrs)), + } + for k, v := range from.Xattrs { + clone.Xattrs[k] = v + } + return clone +} diff --git a/stat_test.go b/stat_test.go index 0678a850..05eb0af6 100644 --- a/stat_test.go +++ b/stat_test.go @@ -28,7 +28,7 @@ func TestStat(t *testing.T) { assert.NoError(t, err) assert.NotZero(t, st.ModTime) st.ModTime = 0 - assert.Equal(t, &types.Stat{Path: "foo", Mode: 0644, Size_: 5}, st) + assert.Equal(t, &types.Stat{Path: "foo", Mode: 0644, Size: 5}, st) st, err = Stat(filepath.Join(d, "zzz")) assert.NoError(t, err) @@ -40,13 +40,13 @@ func TestStat(t *testing.T) { assert.NoError(t, err) assert.NotZero(t, st.ModTime) st.ModTime = 0 - assert.Equal(t, &types.Stat{Path: "aa", Mode: 0644, Size_: 5}, st) + assert.Equal(t, &types.Stat{Path: "aa", Mode: 0644, Size: 5}, st) st, err = Stat(filepath.Join(d, "zzz/bb/cc/dd")) assert.NoError(t, err) assert.NotZero(t, st.ModTime) st.ModTime = 0 - assert.Equal(t, &types.Stat{Path: "dd", Mode: uint32(os.ModeSymlink | 0777), Size_: 6, Linkname: "../../"}, st) + assert.Equal(t, &types.Stat{Path: "dd", Mode: uint32(os.ModeSymlink | 0777), Size: 6, Linkname: "../../"}, st) st, err = Stat(filepath.Join(d, "sock")) assert.NoError(t, err) diff --git a/stat_unix.go b/stat_unix.go index 5923aefe..def901e3 100644 --- a/stat_unix.go +++ b/stat_unix.go @@ -52,7 +52,7 @@ func setUnixOpt(fi os.FileInfo, stat *types.Stat, path string, seenFiles map[uin if s.Nlink > 1 { if oldpath, ok := seenFiles[ino]; ok { stat.Linkname = oldpath - stat.Size_ = 0 + stat.Size = 0 linked = true } } diff --git a/types/generate.go b/types/generate.go index 5c03178f..e8a1183e 100644 --- a/types/generate.go +++ b/types/generate.go @@ -1,3 +1,11 @@ package types -//go:generate protoc --gogoslick_out=. stat.proto wire.proto +//go:generate protoc --go_out=paths=source_relative:. stat.proto wire.proto + +const ( + PACKET_STAT = Packet_PACKET_STAT + PACKET_REQ = Packet_PACKET_REQ + PACKET_DATA = Packet_PACKET_DATA + PACKET_FIN = Packet_PACKET_FIN + PACKET_ERR = Packet_PACKET_ERR +) diff --git a/types/stat.go b/types/stat.go index b79fd2bd..fd04e15c 100644 --- a/types/stat.go +++ b/types/stat.go @@ -2,6 +2,6 @@ package types import "os" -func (s Stat) IsDir() bool { +func (s *Stat) IsDir() bool { return os.FileMode(s.Mode).IsDir() } diff --git a/types/stat.pb.go b/types/stat.pb.go index 91200fb7..c9678ba3 100644 --- a/types/stat.pb.go +++ b/types/stat.pb.go @@ -1,37 +1,35 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.12.4 // source: stat.proto package types import ( - bytes "bytes" - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" - strings "strings" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type Stat struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` Mode uint32 `protobuf:"varint,2,opt,name=mode,proto3" json:"mode,omitempty"` Uid uint32 `protobuf:"varint,3,opt,name=uid,proto3" json:"uid,omitempty"` Gid uint32 `protobuf:"varint,4,opt,name=gid,proto3" json:"gid,omitempty"` - Size_ int64 `protobuf:"varint,5,opt,name=size,proto3" json:"size,omitempty"` + Size int64 `protobuf:"varint,5,opt,name=size,proto3" json:"size,omitempty"` ModTime int64 `protobuf:"varint,6,opt,name=modTime,proto3" json:"modTime,omitempty"` // int32 typeflag = 7; Linkname string `protobuf:"bytes,7,opt,name=linkname,proto3" json:"linkname,omitempty"` @@ -40,890 +38,200 @@ type Stat struct { Xattrs map[string][]byte `protobuf:"bytes,10,rep,name=xattrs,proto3" json:"xattrs,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } -func (m *Stat) Reset() { *m = Stat{} } -func (*Stat) ProtoMessage() {} -func (*Stat) Descriptor() ([]byte, []int) { - return fileDescriptor_01fabdc1b78bd68b, []int{0} +func (x *Stat) Reset() { + *x = Stat{} + if protoimpl.UnsafeEnabled { + mi := &file_stat_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Stat) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *Stat) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Stat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Stat.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*Stat) ProtoMessage() {} + +func (x *Stat) ProtoReflect() protoreflect.Message { + mi := &file_stat_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *Stat) XXX_Merge(src proto.Message) { - xxx_messageInfo_Stat.Merge(m, src) -} -func (m *Stat) XXX_Size() int { - return m.Size() -} -func (m *Stat) XXX_DiscardUnknown() { - xxx_messageInfo_Stat.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_Stat proto.InternalMessageInfo +// Deprecated: Use Stat.ProtoReflect.Descriptor instead. +func (*Stat) Descriptor() ([]byte, []int) { + return file_stat_proto_rawDescGZIP(), []int{0} +} -func (m *Stat) GetPath() string { - if m != nil { - return m.Path +func (x *Stat) GetPath() string { + if x != nil { + return x.Path } return "" } -func (m *Stat) GetMode() uint32 { - if m != nil { - return m.Mode +func (x *Stat) GetMode() uint32 { + if x != nil { + return x.Mode } return 0 } -func (m *Stat) GetUid() uint32 { - if m != nil { - return m.Uid +func (x *Stat) GetUid() uint32 { + if x != nil { + return x.Uid } return 0 } -func (m *Stat) GetGid() uint32 { - if m != nil { - return m.Gid +func (x *Stat) GetGid() uint32 { + if x != nil { + return x.Gid } return 0 } -func (m *Stat) GetSize_() int64 { - if m != nil { - return m.Size_ +func (x *Stat) GetSize() int64 { + if x != nil { + return x.Size } return 0 } -func (m *Stat) GetModTime() int64 { - if m != nil { - return m.ModTime +func (x *Stat) GetModTime() int64 { + if x != nil { + return x.ModTime } return 0 } -func (m *Stat) GetLinkname() string { - if m != nil { - return m.Linkname +func (x *Stat) GetLinkname() string { + if x != nil { + return x.Linkname } return "" } -func (m *Stat) GetDevmajor() int64 { - if m != nil { - return m.Devmajor +func (x *Stat) GetDevmajor() int64 { + if x != nil { + return x.Devmajor } return 0 } -func (m *Stat) GetDevminor() int64 { - if m != nil { - return m.Devminor +func (x *Stat) GetDevminor() int64 { + if x != nil { + return x.Devminor } return 0 } -func (m *Stat) GetXattrs() map[string][]byte { - if m != nil { - return m.Xattrs +func (x *Stat) GetXattrs() map[string][]byte { + if x != nil { + return x.Xattrs } return nil } -func init() { - proto.RegisterType((*Stat)(nil), "fsutil.types.Stat") - proto.RegisterMapType((map[string][]byte)(nil), "fsutil.types.Stat.XattrsEntry") -} - -func init() { proto.RegisterFile("stat.proto", fileDescriptor_01fabdc1b78bd68b) } - -var fileDescriptor_01fabdc1b78bd68b = []byte{ - // 317 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x91, 0xbd, 0x4e, 0xc3, 0x30, - 0x14, 0x85, 0x73, 0x9b, 0xfe, 0xba, 0x45, 0x42, 0x16, 0x83, 0xd5, 0xe1, 0x2a, 0x62, 0xca, 0x94, - 0x01, 0x24, 0xc4, 0xcf, 0x86, 0xc4, 0x0b, 0x04, 0x06, 0xc4, 0x66, 0x64, 0x53, 0x4c, 0x9b, 0xb8, - 0x4a, 0xdc, 0x8a, 0x32, 0xf1, 0x08, 0x3c, 0x06, 0x6f, 0x02, 0x63, 0xc7, 0x8e, 0xd4, 0x5d, 0x18, - 0xfb, 0x08, 0xc8, 0x4e, 0x5b, 0xba, 0x9d, 0xf3, 0x9d, 0x7b, 0x95, 0x9c, 0x6b, 0x42, 0x4a, 0xc3, - 0x4d, 0x32, 0x2e, 0xb4, 0xd1, 0xb4, 0xf7, 0x54, 0x4e, 0x8c, 0x1a, 0x25, 0x66, 0x36, 0x96, 0xe5, - 0xf1, 0x57, 0x8d, 0xd4, 0x6f, 0x0d, 0x37, 0x94, 0x92, 0xfa, 0x98, 0x9b, 0x67, 0x06, 0x11, 0xc4, - 0x9d, 0xd4, 0x6b, 0xc7, 0x32, 0x2d, 0x24, 0xab, 0x45, 0x10, 0x1f, 0xa4, 0x5e, 0xd3, 0x43, 0x12, - 0x4e, 0x94, 0x60, 0xa1, 0x47, 0x4e, 0x3a, 0x32, 0x50, 0x82, 0xd5, 0x2b, 0x32, 0x50, 0xc2, 0xed, - 0x95, 0xea, 0x4d, 0xb2, 0x46, 0x04, 0x71, 0x98, 0x7a, 0x4d, 0x19, 0x69, 0x65, 0x5a, 0xdc, 0xa9, - 0x4c, 0xb2, 0xa6, 0xc7, 0x5b, 0x4b, 0xfb, 0xa4, 0x3d, 0x52, 0xf9, 0x30, 0xe7, 0x99, 0x64, 0x2d, - 0xff, 0xf5, 0x9d, 0x77, 0x99, 0x90, 0xd3, 0x8c, 0xbf, 0xe8, 0x82, 0xb5, 0xfd, 0xda, 0xce, 0x6f, - 0x33, 0x95, 0xeb, 0x82, 0x75, 0xfe, 0x33, 0xe7, 0xe9, 0x19, 0x69, 0xbe, 0x72, 0x63, 0x8a, 0x92, - 0x91, 0x28, 0x8c, 0xbb, 0x27, 0x98, 0xec, 0xb7, 0x4e, 0x5c, 0xe3, 0xe4, 0xde, 0x0f, 0xdc, 0xe4, - 0xa6, 0x98, 0xa5, 0x9b, 0xe9, 0xfe, 0x05, 0xe9, 0xee, 0x61, 0x57, 0x6d, 0x28, 0x67, 0x9b, 0x9b, - 0x38, 0x49, 0x8f, 0x48, 0x63, 0xca, 0x47, 0x93, 0xea, 0x26, 0xbd, 0xb4, 0x32, 0x97, 0xb5, 0x73, - 0xb8, 0xbe, 0x9a, 0x2f, 0x31, 0x58, 0x2c, 0x31, 0x58, 0x2f, 0x11, 0xde, 0x2d, 0xc2, 0xa7, 0x45, - 0xf8, 0xb6, 0x08, 0x73, 0x8b, 0xf0, 0x63, 0x11, 0x7e, 0x2d, 0x06, 0x6b, 0x8b, 0xf0, 0xb1, 0xc2, - 0x60, 0xbe, 0xc2, 0x60, 0xb1, 0xc2, 0xe0, 0xa1, 0xe1, 0x7f, 0xe8, 0xb1, 0xe9, 0xdf, 0xe6, 0xf4, - 0x2f, 0x00, 0x00, 0xff, 0xff, 0x06, 0x97, 0xf3, 0xd7, 0xa9, 0x01, 0x00, 0x00, -} - -func (this *Stat) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Stat) - if !ok { - that2, ok := that.(Stat) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Path != that1.Path { - return false - } - if this.Mode != that1.Mode { - return false - } - if this.Uid != that1.Uid { - return false - } - if this.Gid != that1.Gid { - return false - } - if this.Size_ != that1.Size_ { - return false - } - if this.ModTime != that1.ModTime { - return false - } - if this.Linkname != that1.Linkname { - return false - } - if this.Devmajor != that1.Devmajor { - return false - } - if this.Devminor != that1.Devminor { - return false - } - if len(this.Xattrs) != len(that1.Xattrs) { - return false - } - for i := range this.Xattrs { - if !bytes.Equal(this.Xattrs[i], that1.Xattrs[i]) { - return false - } - } - return true -} -func (this *Stat) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 14) - s = append(s, "&types.Stat{") - s = append(s, "Path: "+fmt.Sprintf("%#v", this.Path)+",\n") - s = append(s, "Mode: "+fmt.Sprintf("%#v", this.Mode)+",\n") - s = append(s, "Uid: "+fmt.Sprintf("%#v", this.Uid)+",\n") - s = append(s, "Gid: "+fmt.Sprintf("%#v", this.Gid)+",\n") - s = append(s, "Size_: "+fmt.Sprintf("%#v", this.Size_)+",\n") - s = append(s, "ModTime: "+fmt.Sprintf("%#v", this.ModTime)+",\n") - s = append(s, "Linkname: "+fmt.Sprintf("%#v", this.Linkname)+",\n") - s = append(s, "Devmajor: "+fmt.Sprintf("%#v", this.Devmajor)+",\n") - s = append(s, "Devminor: "+fmt.Sprintf("%#v", this.Devminor)+",\n") - keysForXattrs := make([]string, 0, len(this.Xattrs)) - for k, _ := range this.Xattrs { - keysForXattrs = append(keysForXattrs, k) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForXattrs) - mapStringForXattrs := "map[string][]byte{" - for _, k := range keysForXattrs { - mapStringForXattrs += fmt.Sprintf("%#v: %#v,", k, this.Xattrs[k]) - } - mapStringForXattrs += "}" - if this.Xattrs != nil { - s = append(s, "Xattrs: "+mapStringForXattrs+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringStat(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func (m *Stat) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Stat) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +var File_stat_proto protoreflect.FileDescriptor + +var file_stat_proto_rawDesc = []byte{ + 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x66, 0x73, + 0x75, 0x74, 0x69, 0x6c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x22, 0xc7, 0x02, 0x0a, 0x04, 0x53, + 0x74, 0x61, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, + 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x10, 0x0a, + 0x03, 0x67, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x67, 0x69, 0x64, 0x12, + 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, + 0x69, 0x7a, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1a, 0x0a, + 0x08, 0x6c, 0x69, 0x6e, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x6c, 0x69, 0x6e, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x76, + 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x76, + 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x76, 0x6d, 0x69, 0x6e, 0x6f, + 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x76, 0x6d, 0x69, 0x6e, 0x6f, + 0x72, 0x12, 0x36, 0x0a, 0x06, 0x78, 0x61, 0x74, 0x74, 0x72, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1e, 0x2e, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x53, 0x74, 0x61, 0x74, 0x2e, 0x58, 0x61, 0x74, 0x74, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x52, 0x06, 0x78, 0x61, 0x74, 0x74, 0x72, 0x73, 0x1a, 0x39, 0x0a, 0x0b, 0x58, 0x61, 0x74, + 0x74, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x3a, 0x02, 0x38, 0x01, 0x42, 0x24, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x74, 0x6f, 0x6e, 0x69, 0x73, 0x74, 0x69, 0x69, 0x67, 0x69, 0x2f, 0x66, 0x73, + 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } -func (m *Stat) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Xattrs) > 0 { - for k := range m.Xattrs { - v := m.Xattrs[k] - baseI := i - if len(v) > 0 { - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarintStat(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - } - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarintStat(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarintStat(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x52 - } - } - if m.Devminor != 0 { - i = encodeVarintStat(dAtA, i, uint64(m.Devminor)) - i-- - dAtA[i] = 0x48 - } - if m.Devmajor != 0 { - i = encodeVarintStat(dAtA, i, uint64(m.Devmajor)) - i-- - dAtA[i] = 0x40 - } - if len(m.Linkname) > 0 { - i -= len(m.Linkname) - copy(dAtA[i:], m.Linkname) - i = encodeVarintStat(dAtA, i, uint64(len(m.Linkname))) - i-- - dAtA[i] = 0x3a - } - if m.ModTime != 0 { - i = encodeVarintStat(dAtA, i, uint64(m.ModTime)) - i-- - dAtA[i] = 0x30 - } - if m.Size_ != 0 { - i = encodeVarintStat(dAtA, i, uint64(m.Size_)) - i-- - dAtA[i] = 0x28 - } - if m.Gid != 0 { - i = encodeVarintStat(dAtA, i, uint64(m.Gid)) - i-- - dAtA[i] = 0x20 - } - if m.Uid != 0 { - i = encodeVarintStat(dAtA, i, uint64(m.Uid)) - i-- - dAtA[i] = 0x18 - } - if m.Mode != 0 { - i = encodeVarintStat(dAtA, i, uint64(m.Mode)) - i-- - dAtA[i] = 0x10 - } - if len(m.Path) > 0 { - i -= len(m.Path) - copy(dAtA[i:], m.Path) - i = encodeVarintStat(dAtA, i, uint64(len(m.Path))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintStat(dAtA []byte, offset int, v uint64) int { - offset -= sovStat(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Stat) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Path) - if l > 0 { - n += 1 + l + sovStat(uint64(l)) - } - if m.Mode != 0 { - n += 1 + sovStat(uint64(m.Mode)) - } - if m.Uid != 0 { - n += 1 + sovStat(uint64(m.Uid)) - } - if m.Gid != 0 { - n += 1 + sovStat(uint64(m.Gid)) - } - if m.Size_ != 0 { - n += 1 + sovStat(uint64(m.Size_)) - } - if m.ModTime != 0 { - n += 1 + sovStat(uint64(m.ModTime)) - } - l = len(m.Linkname) - if l > 0 { - n += 1 + l + sovStat(uint64(l)) - } - if m.Devmajor != 0 { - n += 1 + sovStat(uint64(m.Devmajor)) - } - if m.Devminor != 0 { - n += 1 + sovStat(uint64(m.Devminor)) - } - if len(m.Xattrs) > 0 { - for k, v := range m.Xattrs { - _ = k - _ = v - l = 0 - if len(v) > 0 { - l = 1 + len(v) + sovStat(uint64(len(v))) - } - mapEntrySize := 1 + len(k) + sovStat(uint64(len(k))) + l - n += mapEntrySize + 1 + sovStat(uint64(mapEntrySize)) - } - } - return n -} - -func sovStat(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozStat(x uint64) (n int) { - return sovStat(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *Stat) String() string { - if this == nil { - return "nil" - } - keysForXattrs := make([]string, 0, len(this.Xattrs)) - for k, _ := range this.Xattrs { - keysForXattrs = append(keysForXattrs, k) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForXattrs) - mapStringForXattrs := "map[string][]byte{" - for _, k := range keysForXattrs { - mapStringForXattrs += fmt.Sprintf("%v: %v,", k, this.Xattrs[k]) - } - mapStringForXattrs += "}" - s := strings.Join([]string{`&Stat{`, - `Path:` + fmt.Sprintf("%v", this.Path) + `,`, - `Mode:` + fmt.Sprintf("%v", this.Mode) + `,`, - `Uid:` + fmt.Sprintf("%v", this.Uid) + `,`, - `Gid:` + fmt.Sprintf("%v", this.Gid) + `,`, - `Size_:` + fmt.Sprintf("%v", this.Size_) + `,`, - `ModTime:` + fmt.Sprintf("%v", this.ModTime) + `,`, - `Linkname:` + fmt.Sprintf("%v", this.Linkname) + `,`, - `Devmajor:` + fmt.Sprintf("%v", this.Devmajor) + `,`, - `Devminor:` + fmt.Sprintf("%v", this.Devminor) + `,`, - `Xattrs:` + mapStringForXattrs + `,`, - `}`, - }, "") - return s -} -func valueToStringStat(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *Stat) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Stat: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Stat: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthStat - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStat - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Path = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Mode", wireType) - } - m.Mode = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Mode |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Uid", wireType) - } - m.Uid = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Uid |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Gid", wireType) - } - m.Gid = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Gid |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Size_", wireType) - } - m.Size_ = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Size_ |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ModTime", wireType) - } - m.ModTime = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ModTime |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Linkname", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthStat - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStat - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Linkname = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Devmajor", wireType) - } - m.Devmajor = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Devmajor |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Devminor", wireType) - } - m.Devminor = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Devminor |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Xattrs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStat - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStat - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Xattrs == nil { - m.Xattrs = make(map[string][]byte) - } - var mapkey string - mapvalue := []byte{} - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthStat - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthStat - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapbyteLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapbyteLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intMapbyteLen := int(mapbyteLen) - if intMapbyteLen < 0 { - return ErrInvalidLengthStat - } - postbytesIndex := iNdEx + intMapbyteLen - if postbytesIndex < 0 { - return ErrInvalidLengthStat - } - if postbytesIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = make([]byte, mapbyteLen) - copy(mapvalue, dAtA[iNdEx:postbytesIndex]) - iNdEx = postbytesIndex - } else { - iNdEx = entryPreIndex - skippy, err := skipStat(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStat - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Xattrs[mapkey] = mapvalue - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStat(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStat - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthStat - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } +var ( + file_stat_proto_rawDescOnce sync.Once + file_stat_proto_rawDescData = file_stat_proto_rawDesc +) - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipStat(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowStat - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowStat - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowStat - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthStat +func file_stat_proto_rawDescGZIP() []byte { + file_stat_proto_rawDescOnce.Do(func() { + file_stat_proto_rawDescData = protoimpl.X.CompressGZIP(file_stat_proto_rawDescData) + }) + return file_stat_proto_rawDescData +} + +var file_stat_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_stat_proto_goTypes = []interface{}{ + (*Stat)(nil), // 0: fsutil.types.Stat + nil, // 1: fsutil.types.Stat.XattrsEntry +} +var file_stat_proto_depIdxs = []int32{ + 1, // 0: fsutil.types.Stat.xattrs:type_name -> fsutil.types.Stat.XattrsEntry + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_stat_proto_init() } +func file_stat_proto_init() { + if File_stat_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_stat_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Stat); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupStat - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthStat - } - if depth == 0 { - return iNdEx, nil } } - return 0, io.ErrUnexpectedEOF + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_stat_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_stat_proto_goTypes, + DependencyIndexes: file_stat_proto_depIdxs, + MessageInfos: file_stat_proto_msgTypes, + }.Build() + File_stat_proto = out.File + file_stat_proto_rawDesc = nil + file_stat_proto_goTypes = nil + file_stat_proto_depIdxs = nil } - -var ( - ErrInvalidLengthStat = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowStat = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupStat = fmt.Errorf("proto: unexpected end of group") -) diff --git a/types/stat.proto b/types/stat.proto index 4138be69..9b7728c4 100644 --- a/types/stat.proto +++ b/types/stat.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package fsutil.types; -option go_package = "types"; +option go_package = "github.com/tonistiigi/fsutil/types"; message Stat { string path = 1; diff --git a/types/wire.pb.go b/types/wire.pb.go index 9e22269e..fdf28ef1 100644 --- a/types/wire.pb.go +++ b/types/wire.pb.go @@ -1,575 +1,242 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.12.4 // source: wire.proto package types import ( - bytes "bytes" - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" - strconv "strconv" - strings "strings" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type Packet_PacketType int32 const ( - PACKET_STAT Packet_PacketType = 0 - PACKET_REQ Packet_PacketType = 1 - PACKET_DATA Packet_PacketType = 2 - PACKET_FIN Packet_PacketType = 3 - PACKET_ERR Packet_PacketType = 4 + Packet_PACKET_STAT Packet_PacketType = 0 + Packet_PACKET_REQ Packet_PacketType = 1 + Packet_PACKET_DATA Packet_PacketType = 2 + Packet_PACKET_FIN Packet_PacketType = 3 + Packet_PACKET_ERR Packet_PacketType = 4 +) + +// Enum value maps for Packet_PacketType. +var ( + Packet_PacketType_name = map[int32]string{ + 0: "PACKET_STAT", + 1: "PACKET_REQ", + 2: "PACKET_DATA", + 3: "PACKET_FIN", + 4: "PACKET_ERR", + } + Packet_PacketType_value = map[string]int32{ + "PACKET_STAT": 0, + "PACKET_REQ": 1, + "PACKET_DATA": 2, + "PACKET_FIN": 3, + "PACKET_ERR": 4, + } ) -var Packet_PacketType_name = map[int32]string{ - 0: "PACKET_STAT", - 1: "PACKET_REQ", - 2: "PACKET_DATA", - 3: "PACKET_FIN", - 4: "PACKET_ERR", +func (x Packet_PacketType) Enum() *Packet_PacketType { + p := new(Packet_PacketType) + *p = x + return p } -var Packet_PacketType_value = map[string]int32{ - "PACKET_STAT": 0, - "PACKET_REQ": 1, - "PACKET_DATA": 2, - "PACKET_FIN": 3, - "PACKET_ERR": 4, +func (x Packet_PacketType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } +func (Packet_PacketType) Descriptor() protoreflect.EnumDescriptor { + return file_wire_proto_enumTypes[0].Descriptor() +} + +func (Packet_PacketType) Type() protoreflect.EnumType { + return &file_wire_proto_enumTypes[0] +} + +func (x Packet_PacketType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Packet_PacketType.Descriptor instead. func (Packet_PacketType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_f2dcdddcdf68d8e0, []int{0, 0} + return file_wire_proto_rawDescGZIP(), []int{0, 0} } type Packet struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + Type Packet_PacketType `protobuf:"varint,1,opt,name=type,proto3,enum=fsutil.types.Packet_PacketType" json:"type,omitempty"` Stat *Stat `protobuf:"bytes,2,opt,name=stat,proto3" json:"stat,omitempty"` ID uint32 `protobuf:"varint,3,opt,name=ID,proto3" json:"ID,omitempty"` Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` } -func (m *Packet) Reset() { *m = Packet{} } -func (*Packet) ProtoMessage() {} -func (*Packet) Descriptor() ([]byte, []int) { - return fileDescriptor_f2dcdddcdf68d8e0, []int{0} -} -func (m *Packet) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Packet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Packet.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *Packet) Reset() { + *x = Packet{} + if protoimpl.UnsafeEnabled { + mi := &file_wire_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *Packet) XXX_Merge(src proto.Message) { - xxx_messageInfo_Packet.Merge(m, src) -} -func (m *Packet) XXX_Size() int { - return m.Size() -} -func (m *Packet) XXX_DiscardUnknown() { - xxx_messageInfo_Packet.DiscardUnknown(m) + +func (x *Packet) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_Packet proto.InternalMessageInfo +func (*Packet) ProtoMessage() {} -func (m *Packet) GetType() Packet_PacketType { - if m != nil { - return m.Type +func (x *Packet) ProtoReflect() protoreflect.Message { + mi := &file_wire_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return PACKET_STAT + return mi.MessageOf(x) } -func (m *Packet) GetStat() *Stat { - if m != nil { - return m.Stat - } - return nil +// Deprecated: Use Packet.ProtoReflect.Descriptor instead. +func (*Packet) Descriptor() ([]byte, []int) { + return file_wire_proto_rawDescGZIP(), []int{0} } -func (m *Packet) GetID() uint32 { - if m != nil { - return m.ID +func (x *Packet) GetType() Packet_PacketType { + if x != nil { + return x.Type } - return 0 + return Packet_PACKET_STAT } -func (m *Packet) GetData() []byte { - if m != nil { - return m.Data +func (x *Packet) GetStat() *Stat { + if x != nil { + return x.Stat } return nil } -func init() { - proto.RegisterEnum("fsutil.types.Packet_PacketType", Packet_PacketType_name, Packet_PacketType_value) - proto.RegisterType((*Packet)(nil), "fsutil.types.Packet") -} - -func init() { proto.RegisterFile("wire.proto", fileDescriptor_f2dcdddcdf68d8e0) } - -var fileDescriptor_f2dcdddcdf68d8e0 = []byte{ - // 276 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0xcf, 0x2c, 0x4a, - 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x49, 0x2b, 0x2e, 0x2d, 0xc9, 0xcc, 0xd1, 0x2b, - 0xa9, 0x2c, 0x48, 0x2d, 0x96, 0xe2, 0x2a, 0x2e, 0x49, 0x2c, 0x81, 0xc8, 0x28, 0xbd, 0x64, 0xe4, - 0x62, 0x0b, 0x48, 0x4c, 0xce, 0x4e, 0x2d, 0x11, 0x32, 0xe6, 0x62, 0x01, 0xc9, 0x4b, 0x30, 0x2a, - 0x30, 0x6a, 0xf0, 0x19, 0xc9, 0xeb, 0x21, 0xeb, 0xd1, 0x83, 0xa8, 0x81, 0x52, 0x21, 0x95, 0x05, - 0xa9, 0x41, 0x60, 0xc5, 0x42, 0x6a, 0x5c, 0x2c, 0x20, 0xd3, 0x24, 0x98, 0x14, 0x18, 0x35, 0xb8, - 0x8d, 0x84, 0x50, 0x35, 0x05, 0x97, 0x24, 0x96, 0x04, 0x81, 0xe5, 0x85, 0xf8, 0xb8, 0x98, 0x3c, - 0x5d, 0x24, 0x98, 0x15, 0x18, 0x35, 0x78, 0x83, 0x98, 0x3c, 0x5d, 0x84, 0x84, 0xb8, 0x58, 0x52, - 0x12, 0x4b, 0x12, 0x25, 0x58, 0x14, 0x18, 0x35, 0x78, 0x82, 0xc0, 0x6c, 0xa5, 0x38, 0x2e, 0x2e, - 0x84, 0xf9, 0x42, 0xfc, 0x5c, 0xdc, 0x01, 0x8e, 0xce, 0xde, 0xae, 0x21, 0xf1, 0xc1, 0x21, 0x8e, - 0x21, 0x02, 0x0c, 0x42, 0x7c, 0x5c, 0x5c, 0x50, 0x81, 0x20, 0xd7, 0x40, 0x01, 0x46, 0x24, 0x05, - 0x2e, 0x8e, 0x21, 0x8e, 0x02, 0x4c, 0x48, 0x0a, 0xdc, 0x3c, 0xfd, 0x04, 0x98, 0x91, 0xf8, 0xae, - 0x41, 0x41, 0x02, 0x2c, 0x4e, 0xd6, 0x17, 0x1e, 0xca, 0x31, 0xdc, 0x78, 0x28, 0xc7, 0xf0, 0xe1, - 0xa1, 0x1c, 0x63, 0xc3, 0x23, 0x39, 0xc6, 0x15, 0x8f, 0xe4, 0x18, 0x4f, 0x3c, 0x92, 0x63, 0xbc, - 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x17, 0x8f, 0xe4, 0x18, 0x3e, 0x3c, 0x92, 0x63, - 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x58, 0xc1, - 0x7e, 0x49, 0x62, 0x03, 0x87, 0x97, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x9d, 0xe3, 0x51, - 0x57, 0x01, 0x00, 0x00, -} - -func (x Packet_PacketType) String() string { - s, ok := Packet_PacketType_name[int32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} -func (this *Packet) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Packet) - if !ok { - that2, ok := that.(Packet) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Type != that1.Type { - return false - } - if !this.Stat.Equal(that1.Stat) { - return false - } - if this.ID != that1.ID { - return false - } - if !bytes.Equal(this.Data, that1.Data) { - return false +func (x *Packet) GetID() uint32 { + if x != nil { + return x.ID } - return true -} -func (this *Packet) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 8) - s = append(s, "&types.Packet{") - s = append(s, "Type: "+fmt.Sprintf("%#v", this.Type)+",\n") - if this.Stat != nil { - s = append(s, "Stat: "+fmt.Sprintf("%#v", this.Stat)+",\n") - } - s = append(s, "ID: "+fmt.Sprintf("%#v", this.ID)+",\n") - s = append(s, "Data: "+fmt.Sprintf("%#v", this.Data)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringWire(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func (m *Packet) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Packet) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return 0 } -func (m *Packet) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintWire(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0x22 - } - if m.ID != 0 { - i = encodeVarintWire(dAtA, i, uint64(m.ID)) - i-- - dAtA[i] = 0x18 - } - if m.Stat != nil { - { - size, err := m.Stat.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWire(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Type != 0 { - i = encodeVarintWire(dAtA, i, uint64(m.Type)) - i-- - dAtA[i] = 0x8 +func (x *Packet) GetData() []byte { + if x != nil { + return x.Data } - return len(dAtA) - i, nil + return nil } -func encodeVarintWire(dAtA []byte, offset int, v uint64) int { - offset -= sovWire(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Packet) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Type != 0 { - n += 1 + sovWire(uint64(m.Type)) - } - if m.Stat != nil { - l = m.Stat.Size() - n += 1 + l + sovWire(uint64(l)) - } - if m.ID != 0 { - n += 1 + sovWire(uint64(m.ID)) - } - l = len(m.Data) - if l > 0 { - n += 1 + l + sovWire(uint64(l)) - } - return n +var File_wire_proto protoreflect.FileDescriptor + +var file_wire_proto_rawDesc = []byte{ + 0x0a, 0x0a, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x66, 0x73, + 0x75, 0x74, 0x69, 0x6c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x1a, 0x0a, 0x73, 0x74, 0x61, 0x74, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe9, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x63, 0x6b, 0x65, + 0x74, 0x12, 0x33, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x1f, 0x2e, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, + 0x61, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, + 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x73, 0x74, 0x61, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2e, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, 0x04, 0x73, 0x74, 0x61, 0x74, 0x12, 0x0e, + 0x0a, 0x02, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x49, 0x44, 0x12, 0x12, + 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, + 0x74, 0x61, 0x22, 0x5e, 0x0a, 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x0f, 0x0a, 0x0b, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x10, + 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x52, 0x45, 0x51, 0x10, + 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x44, 0x41, 0x54, 0x41, + 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x46, 0x49, 0x4e, + 0x10, 0x03, 0x12, 0x0e, 0x0a, 0x0a, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x45, 0x52, 0x52, + 0x10, 0x04, 0x42, 0x24, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x74, 0x6f, 0x6e, 0x69, 0x73, 0x74, 0x69, 0x69, 0x67, 0x69, 0x2f, 0x66, 0x73, 0x75, 0x74, + 0x69, 0x6c, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -func sovWire(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozWire(x uint64) (n int) { - return sovWire(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *Packet) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Packet{`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `Stat:` + strings.Replace(fmt.Sprintf("%v", this.Stat), "Stat", "Stat", 1) + `,`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, - `Data:` + fmt.Sprintf("%v", this.Data) + `,`, - `}`, - }, "") - return s -} -func valueToStringWire(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *Packet) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWire - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Packet: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Packet: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWire - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= Packet_PacketType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Stat", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWire - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWire - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWire - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Stat == nil { - m.Stat = &Stat{} - } - if err := m.Stat.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - m.ID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWire - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ID |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWire - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWire - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWire - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipWire(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthWire - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthWire - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } +var ( + file_wire_proto_rawDescOnce sync.Once + file_wire_proto_rawDescData = file_wire_proto_rawDesc +) - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipWire(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowWire - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break +func file_wire_proto_rawDescGZIP() []byte { + file_wire_proto_rawDescOnce.Do(func() { + file_wire_proto_rawDescData = protoimpl.X.CompressGZIP(file_wire_proto_rawDescData) + }) + return file_wire_proto_rawDescData +} + +var file_wire_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_wire_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_wire_proto_goTypes = []interface{}{ + (Packet_PacketType)(0), // 0: fsutil.types.Packet.PacketType + (*Packet)(nil), // 1: fsutil.types.Packet + (*Stat)(nil), // 2: fsutil.types.Stat +} +var file_wire_proto_depIdxs = []int32{ + 0, // 0: fsutil.types.Packet.type:type_name -> fsutil.types.Packet.PacketType + 2, // 1: fsutil.types.Packet.stat:type_name -> fsutil.types.Stat + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_wire_proto_init() } +func file_wire_proto_init() { + if File_wire_proto != nil { + return + } + file_stat_proto_init() + if !protoimpl.UnsafeEnabled { + file_wire_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Packet); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil } } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowWire - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowWire - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthWire - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupWire - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthWire - } - if depth == 0 { - return iNdEx, nil - } } - return 0, io.ErrUnexpectedEOF + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_wire_proto_rawDesc, + NumEnums: 1, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_wire_proto_goTypes, + DependencyIndexes: file_wire_proto_depIdxs, + EnumInfos: file_wire_proto_enumTypes, + MessageInfos: file_wire_proto_msgTypes, + }.Build() + File_wire_proto = out.File + file_wire_proto_rawDesc = nil + file_wire_proto_goTypes = nil + file_wire_proto_depIdxs = nil } - -var ( - ErrInvalidLengthWire = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowWire = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupWire = fmt.Errorf("proto: unexpected end of group") -) diff --git a/types/wire.proto b/types/wire.proto index 3e85000c..a00300b9 100644 --- a/types/wire.proto +++ b/types/wire.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package fsutil.types; -option go_package = "types"; +option go_package = "github.com/tonistiigi/fsutil/types"; import "stat.proto"; From 8bcf9db06cc560425eb26d3e5175c68de7694eba Mon Sep 17 00:00:00 2001 From: Kotaro Inoue Date: Sat, 6 Jan 2024 22:16:41 +0900 Subject: [PATCH 05/76] Fix to use internal representation for setting special bits Signed-off-by: Kotaro Inoue --- copy/copy_linux.go | 15 +++++++++------ copy/copy_unix.go | 15 +++++++++------ copy/copy_unix_test.go | 13 ++++++++++--- 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/copy/copy_linux.go b/copy/copy_linux.go index d2553098..6d9b490c 100644 --- a/copy/copy_linux.go +++ b/copy/copy_linux.go @@ -30,12 +30,15 @@ func (c *copier) copyFileInfo(fi os.FileInfo, src, name string) error { m := fi.Mode() if c.mode != nil { - m = os.FileMode(*c.mode & 0777) - sb := *c.mode & 0777 - if sb != 0 { - m |= os.FileMode(sb) - } else { - m |= m & ^os.FileMode(0777) + m = os.FileMode(*c.mode).Perm() + if *c.mode&syscall.S_ISGID != 0 { + m |= os.ModeSetgid + } + if *c.mode&syscall.S_ISUID != 0 { + m |= os.ModeSetuid + } + if *c.mode&syscall.S_ISVTX != 0 { + m |= os.ModeSticky } } if (fi.Mode() & os.ModeSymlink) != os.ModeSymlink { diff --git a/copy/copy_unix.go b/copy/copy_unix.go index 4a79e63d..4a7d0c86 100644 --- a/copy/copy_unix.go +++ b/copy/copy_unix.go @@ -31,12 +31,15 @@ func (c *copier) copyFileInfo(fi os.FileInfo, src, name string) error { m := fi.Mode() if c.mode != nil { - m = os.FileMode(*c.mode & 0777) - sb := *c.mode & 0777 - if sb != 0 { - m |= os.FileMode(sb) - } else { - m |= m & ^os.FileMode(0777) + m = os.FileMode(*c.mode).Perm() + if *c.mode&syscall.S_ISGID != 0 { + m |= os.ModeSetgid + } + if *c.mode&syscall.S_ISUID != 0 { + m |= os.ModeSetuid + } + if *c.mode&syscall.S_ISVTX != 0 { + m |= os.ModeSticky } } if (fi.Mode() & os.ModeSymlink) != os.ModeSymlink { diff --git a/copy/copy_unix_test.go b/copy/copy_unix_test.go index 5156a875..405f757c 100644 --- a/copy/copy_unix_test.go +++ b/copy/copy_unix_test.go @@ -7,6 +7,7 @@ import ( "context" "os" "path/filepath" + "syscall" "testing" "github.com/stretchr/testify/assert" @@ -72,11 +73,14 @@ func TestCopySetuid(t *testing.T) { fi, err := os.Lstat(filepath.Join(t2, "char")) require.NoError(t, err) - assert.Equal(t, os.FileMode(0444), fi.Mode()&07777) + assert.Equal(t, os.FileMode(0444), fi.Mode().Perm()) + assert.Equal(t, os.FileMode(0), fi.Mode()&os.ModeSetuid) + assert.Equal(t, os.FileMode(0), fi.Mode()&os.ModeSetgid) + assert.Equal(t, os.FileMode(0), fi.Mode()&os.ModeSticky) t3 := t.TempDir() - p := 04444 + p := 0444 | syscall.S_ISUID err = Copy(context.TODO(), t1, ".", t3, ".", WithCopyInfo(CopyInfo{ Mode: &p, })) @@ -84,5 +88,8 @@ func TestCopySetuid(t *testing.T) { fi, err = os.Lstat(filepath.Join(t3, "char")) require.NoError(t, err) - assert.Equal(t, os.FileMode(04444), fi.Mode()&07777) + assert.Equal(t, os.FileMode(0444), fi.Mode().Perm()) + assert.Equal(t, os.ModeSetuid, fi.Mode()&os.ModeSetuid) + assert.Equal(t, os.FileMode(0), fi.Mode()&os.ModeSetgid) + assert.Equal(t, os.FileMode(0), fi.Mode()&os.ModeSticky) } From 9ff87189278a250dfc7e49764a9642e93fcbfb65 Mon Sep 17 00:00:00 2001 From: Marat Radchenko Date: Sun, 12 Nov 2023 21:33:02 +0300 Subject: [PATCH 06/76] Fix cross-device copy failing on macOS Downstream issue: https://github.com/macOScontainers/rund/issues/28 Signed-off-by: Marat Radchenko --- copy/copy_darwin.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copy/copy_darwin.go b/copy/copy_darwin.go index bc93b21c..0cdc00a8 100644 --- a/copy/copy_darwin.go +++ b/copy/copy_darwin.go @@ -13,7 +13,7 @@ import ( func copyFile(source, target string) error { if err := unix.Clonefileat(unix.AT_FDCWD, source, unix.AT_FDCWD, target, unix.CLONE_NOFOLLOW); err != nil { - if err != unix.EINVAL { + if err != unix.EINVAL && err != unix.EXDEV { return err } } else { From b3997ab7d31242a855e8dd5b27c82208efeaa3f4 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Wed, 24 Jan 2024 17:11:15 +0100 Subject: [PATCH 07/76] followlinks: sanitize root path Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- followlinks.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/followlinks.go b/followlinks.go index 3a0bd2bb..7a843cb1 100644 --- a/followlinks.go +++ b/followlinks.go @@ -137,7 +137,7 @@ func (r *symlinkResolver) readSymlink(p string, allowWildcard bool) ([]string, e func statFile(fs FS, root string) (os.DirEntry, error) { var out os.DirEntry - root = filepath.Clean(root) + root = filepath.ToSlash(filepath.Clean(root)) if root == "/" || root == "." { return nil, nil } @@ -168,7 +168,7 @@ func statFile(fs FS, root string) (os.DirEntry, error) { func readDir(fs FS, root string) ([]os.DirEntry, error) { var out []os.DirEntry - root = filepath.Clean(root) + root = filepath.ToSlash(filepath.Clean(root)) if root == "/" || root == "." { root = "." out = make([]gofs.DirEntry, 0) From b6cfc0f0a7b0671222dcb3a9e73b066ebb0d5bb9 Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Wed, 24 Jan 2024 16:54:17 +0000 Subject: [PATCH 08/76] chore: fix typos in NewFilterFS docstring Signed-off-by: Justin Chadwell --- filter.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/filter.go b/filter.go index 05f4a466..6585db4b 100644 --- a/filter.go +++ b/filter.go @@ -66,9 +66,9 @@ type filterFS struct { // NewFilterFS creates a new FS that filters the given FS using the given // FilterOpt. - +// // The returned FS will not contain any paths that do not match the provided -// include and exclude patterns, or that are are exlcluded using the mapping +// include and exclude patterns, or that are are excluded using the mapping // function. // // The FS is assumed to be a snapshot of the filesystem at the time of the From 6ec7d912485e80580d8de8bf13f7e9b74b6d8eb2 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:46:48 +0100 Subject: [PATCH 09/76] Revert "Migrate off of gogo/protobuf" This reverts commit bea810c0c14d36b7b141c4cf236a2830e29a14a7. Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- diff_containerd.go | 8 +- diskwriter.go | 12 +- fs.go | 11 +- fs_test.go | 4 +- go.mod | 4 +- go.sum | 29 ++ receive.go | 3 +- receive_test.go | 33 +- send.go | 5 +- stat.go | 21 +- stat_test.go | 6 +- stat_unix.go | 2 +- types/generate.go | 10 +- types/stat.go | 2 +- types/stat.pb.go | 1014 +++++++++++++++++++++++++++++++++++++------- types/stat.proto | 2 +- types/wire.pb.go | 701 ++++++++++++++++++++++-------- types/wire.proto | 2 +- 18 files changed, 1441 insertions(+), 428 deletions(-) diff --git a/diff_containerd.go b/diff_containerd.go index 261431b8..d8619abf 100644 --- a/diff_containerd.go +++ b/diff_containerd.go @@ -106,11 +106,11 @@ func doubleWalkDiff(ctx context.Context, changeFn ChangeFunc, a, b walkerFn, fil var f *types.Stat var f2copy *currentPath if f2 != nil { - statCopy := cloneStat(f2.stat) + statCopy := *f2.stat if filter != nil { - filter(f2.path, statCopy) + filter(f2.path, &statCopy) } - f2copy = ¤tPath{path: f2.path, stat: statCopy} + f2copy = ¤tPath{path: f2.path, stat: &statCopy} } k, p := pathChange(f1, f2copy) switch k { @@ -188,7 +188,7 @@ func sameFile(f1, f2 *currentPath, differ DiffType) (same bool, retErr error) { } // If not a directory also check size, modtime, and content if !f1.stat.IsDir() { - if f1.stat.Size != f2.stat.Size { + if f1.stat.Size_ != f2.stat.Size_ { return false, nil } diff --git a/diskwriter.go b/diskwriter.go index 815f4e07..10b60851 100644 --- a/diskwriter.go +++ b/diskwriter.go @@ -124,10 +124,10 @@ func (dw *DiskWriter) HandleChange(kind ChangeKind, p string, fi os.FileInfo, er return errors.WithStack(&os.PathError{Path: p, Err: syscall.EBADMSG, Op: "change without stat info"}) } - statCopy := cloneStat(stat) + statCopy := *stat if dw.filter != nil { - if ok := dw.filter(p, statCopy); !ok { + if ok := dw.filter(p, &statCopy); !ok { return nil } } @@ -146,7 +146,7 @@ func (dw *DiskWriter) HandleChange(kind ChangeKind, p string, fi os.FileInfo, er } if oldFi != nil && fi.IsDir() && oldFi.IsDir() { - if err := rewriteMetadata(destPath, statCopy); err != nil { + if err := rewriteMetadata(destPath, &statCopy); err != nil { return errors.Wrapf(err, "error setting dir metadata for %s", destPath) } return nil @@ -170,7 +170,7 @@ func (dw *DiskWriter) HandleChange(kind ChangeKind, p string, fi os.FileInfo, er } dw.dirModTimes[destPath] = statCopy.ModTime case fi.Mode()&os.ModeDevice != 0 || fi.Mode()&os.ModeNamedPipe != 0: - if err := handleTarTypeBlockCharFifo(newPath, statCopy); err != nil { + if err := handleTarTypeBlockCharFifo(newPath, &statCopy); err != nil { return errors.Wrapf(err, "failed to create device %s", newPath) } case fi.Mode()&os.ModeSymlink != 0: @@ -198,7 +198,7 @@ func (dw *DiskWriter) HandleChange(kind ChangeKind, p string, fi os.FileInfo, er } } - if err := rewriteMetadata(newPath, statCopy); err != nil { + if err := rewriteMetadata(newPath, &statCopy); err != nil { return errors.Wrapf(err, "error setting metadata for %s", newPath) } @@ -216,7 +216,7 @@ func (dw *DiskWriter) HandleChange(kind ChangeKind, p string, fi os.FileInfo, er if isRegularFile { if dw.opt.AsyncDataCb != nil { - dw.requestAsyncFileData(p, destPath, fi, statCopy) + dw.requestAsyncFileData(p, destPath, fi, &statCopy) } } else { return dw.processChange(kind, p, fi, nil) diff --git a/fs.go b/fs.go index 8b7a702e..fe370194 100644 --- a/fs.go +++ b/fs.go @@ -91,7 +91,7 @@ func (fs *fs) Open(p string) (io.ReadCloser, error) { } type Dir struct { - Stat *types.Stat + Stat types.Stat FS FS } @@ -125,12 +125,12 @@ func (fs *subDirFS) Walk(ctx context.Context, target string, fn gofs.WalkDirFunc continue } - fi := &StatInfo{d.Stat} + fi := &StatInfo{&d.Stat} if !fi.IsDir() { return errors.WithStack(&os.PathError{Path: d.Stat.Path, Err: syscall.ENOTDIR, Op: "walk subdir"}) } dStat := d.Stat - if err := fn(d.Stat.Path, &DirEntryInfo{Stat: dStat}, nil); err != nil { + if err := fn(d.Stat.Path, &DirEntryInfo{Stat: &dStat}, nil); err != nil { return err } if err := d.FS.Walk(ctx, rest, func(p string, entry gofs.DirEntry, err error) error { @@ -191,7 +191,7 @@ func (s *StatInfo) Name() string { return filepath.Base(s.Stat.Path) } func (s *StatInfo) Size() int64 { - return s.Stat.Size + return s.Stat.Size_ } func (s *StatInfo) Mode() os.FileMode { return os.FileMode(s.Stat.Mode) @@ -246,5 +246,6 @@ func (s *DirEntryInfo) Info() (gofs.FileInfo, error) { s.Stat = stat } - return &StatInfo{s.Stat}, nil + st := *s.Stat + return &StatInfo{&st}, nil } diff --git a/fs_test.go b/fs_test.go index df6cef62..54e7653b 100644 --- a/fs_test.go +++ b/fs_test.go @@ -73,14 +73,14 @@ func TestWalkDir(t *testing.T) { f, err := SubDirFS([]Dir{ { - Stat: &types.Stat{ + Stat: types.Stat{ Mode: uint32(os.ModeDir | 0755), Path: "1", }, FS: tmpfs, }, { - Stat: &types.Stat{ + Stat: types.Stat{ Mode: uint32(os.ModeDir | 0755), Path: "2", }, diff --git a/go.mod b/go.mod index a261438c..3dceea97 100644 --- a/go.mod +++ b/go.mod @@ -5,13 +5,13 @@ go 1.19 require ( github.com/Microsoft/go-winio v0.5.2 github.com/containerd/continuity v0.4.1 + github.com/gogo/protobuf v1.3.2 github.com/moby/patternmatcher v0.5.0 github.com/opencontainers/go-digest v1.0.0 github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.8.4 golang.org/x/sync v0.1.0 golang.org/x/sys v0.1.0 - google.golang.org/protobuf v1.26.0 ) require ( @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/sirupsen/logrus v1.8.1 // indirect - golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + google.golang.org/protobuf v1.26.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 234ef4d8..46c6359f 100644 --- a/go.sum +++ b/go.sum @@ -4,9 +4,13 @@ github.com/containerd/continuity v0.4.1 h1:wQnVrjIyQ8vhU2sgOiL5T07jo+ouqc2bnKsv5 github.com/containerd/continuity v0.4.1/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -26,12 +30,37 @@ github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/receive.go b/receive.go index 82da82ae..209d1d2f 100644 --- a/receive.go +++ b/receive.go @@ -9,7 +9,6 @@ import ( "github.com/pkg/errors" "github.com/tonistiigi/fsutil/types" "golang.org/x/sync/errgroup" - "google.golang.org/protobuf/proto" ) type DiffType int @@ -171,7 +170,7 @@ func (r *receiver) run(ctx context.Context) error { return err } if r.progressCb != nil { - size += proto.Size(&p) + size += p.Size() r.progressCb(size, false) } diff --git a/receive_test.go b/receive_test.go index ebb92475..a36d5013 100644 --- a/receive_test.go +++ b/receive_test.go @@ -19,7 +19,6 @@ import ( "github.com/stretchr/testify/require" "github.com/tonistiigi/fsutil/types" "golang.org/x/sync/errgroup" - "google.golang.org/protobuf/proto" ) func TestSendError(t *testing.T) { @@ -80,7 +79,7 @@ func TestCopyWithSubDir(t *testing.T) { eg.Go(func() error { defer s1.(*fakeConnProto).closeSend() - subdir, err := SubDirFS([]Dir{{FS: fs, Stat: &types.Stat{Path: "sub", Mode: uint32(os.ModeDir | 0755)}}}) + subdir, err := SubDirFS([]Dir{{FS: fs, Stat: types.Stat{Path: "sub", Mode: uint32(os.ModeDir | 0755)}}}) if err != nil { return err } @@ -386,19 +385,6 @@ func sockPairProto(ctx context.Context) (Stream, Stream) { return &fakeConnProto{ctx, c1, c2}, &fakeConnProto{ctx, c2, c1} } -//nolint:unused -func clonePacket(from *types.Packet) *types.Packet { - var data []byte - copy(data, from.Data) - - return &types.Packet{ - Type: from.Type, - Stat: cloneStat(from.Stat), - ID: from.ID, - Data: data, - } -} - //nolint:unused type fakeConn struct { ctx context.Context @@ -413,14 +399,15 @@ func (fc *fakeConn) Context() context.Context { //nolint:unused func (fc *fakeConn) RecvMsg(m interface{}) error { - _, ok := m.(*types.Packet) + p, ok := m.(*types.Packet) if !ok { return errors.Errorf("invalid msg: %#v", m) } select { case <-fc.ctx.Done(): return fc.ctx.Err() - case _ = <-fc.recvChan: + case p2 := <-fc.recvChan: + *p = *p2 return nil } } @@ -431,12 +418,12 @@ func (fc *fakeConn) SendMsg(m interface{}) error { if !ok { return errors.Errorf("invalid msg: %#v", m) } - p2 := clonePacket(p) + p2 := *p p2.Data = append([]byte{}, p2.Data...) select { case <-fc.ctx.Done(): return fc.ctx.Err() - case fc.sendChan <- p2: + case fc.sendChan <- &p2: return nil } } @@ -463,7 +450,7 @@ func (fc *fakeConnProto) RecvMsg(m interface{}) error { if !ok { return io.EOF } - return proto.Unmarshal(dt, p) + return p.Unmarshal(dt) } } @@ -472,7 +459,7 @@ func (fc *fakeConnProto) SendMsg(m interface{}) error { if !ok { return errors.Errorf("invalid msg: %#v", m) } - dt, err := proto.Marshal(p) + dt, err := p.Marshal() if err != nil { return err } @@ -506,7 +493,7 @@ func (c *changes) HandleChange(kind ChangeKind, p string, fi os.FileInfo, err er func simpleSHA256Hasher(s *types.Stat) (hash.Hash, error) { h := sha256.New() - ss := cloneStat(s) + ss := *s ss.ModTime = 0 // Unlike Linux, on FreeBSD's stat() call returns -1 in st_rdev for regular files ss.Devminor = 0 @@ -516,7 +503,7 @@ func simpleSHA256Hasher(s *types.Stat) (hash.Hash, error) { ss.Mode = ss.Mode | 0777 } - dt, err := proto.Marshal(ss) + dt, err := ss.Marshal() if err != nil { return nil, err } diff --git a/send.go b/send.go index fac2de68..a044d04d 100644 --- a/send.go +++ b/send.go @@ -10,7 +10,6 @@ import ( "github.com/pkg/errors" "github.com/tonistiigi/fsutil/types" "golang.org/x/sync/errgroup" - "google.golang.org/protobuf/proto" ) var bufPool = sync.Pool{ @@ -168,7 +167,7 @@ func (s *sender) walk(ctx context.Context) error { s.mu.Unlock() } i++ - s.updateProgress(proto.Size(p), false) + s.updateProgress(p.Size(), false) return errors.Wrapf(s.conn.SendMsg(p), "failed to send stat %s", path) }) if err != nil { @@ -196,7 +195,7 @@ func (fs *fileSender) Write(dt []byte) (int, error) { if err := fs.sender.conn.SendMsg(p); err != nil { return 0, err } - fs.sender.updateProgress(proto.Size(p), false) + fs.sender.updateProgress(p.Size(), false) return len(dt), nil } diff --git a/stat.go b/stat.go index 2217f833..2ab8da11 100644 --- a/stat.go +++ b/stat.go @@ -27,7 +27,7 @@ func mkstat(path, relpath string, fi os.FileInfo, inodemap map[uint64]string) (* setUnixOpt(fi, stat, relpath, inodemap) if !fi.IsDir() { - stat.Size = fi.Size() + stat.Size_ = fi.Size() if fi.Mode()&os.ModeSymlink != 0 { link, err := os.Readlink(path) if err != nil { @@ -62,22 +62,3 @@ func Stat(path string) (*types.Stat, error) { } return mkstat(path, filepath.Base(path), fi, nil) } - -func cloneStat(from *types.Stat) *types.Stat { - clone := &types.Stat{ - Path: from.Path, - Mode: from.Mode, - Uid: from.Uid, - Gid: from.Gid, - Size: from.Size, - ModTime: from.ModTime, - Linkname: from.Linkname, - Devmajor: from.Devmajor, - Devminor: from.Devminor, - Xattrs: make(map[string][]byte, len(from.Xattrs)), - } - for k, v := range from.Xattrs { - clone.Xattrs[k] = v - } - return clone -} diff --git a/stat_test.go b/stat_test.go index 05eb0af6..0678a850 100644 --- a/stat_test.go +++ b/stat_test.go @@ -28,7 +28,7 @@ func TestStat(t *testing.T) { assert.NoError(t, err) assert.NotZero(t, st.ModTime) st.ModTime = 0 - assert.Equal(t, &types.Stat{Path: "foo", Mode: 0644, Size: 5}, st) + assert.Equal(t, &types.Stat{Path: "foo", Mode: 0644, Size_: 5}, st) st, err = Stat(filepath.Join(d, "zzz")) assert.NoError(t, err) @@ -40,13 +40,13 @@ func TestStat(t *testing.T) { assert.NoError(t, err) assert.NotZero(t, st.ModTime) st.ModTime = 0 - assert.Equal(t, &types.Stat{Path: "aa", Mode: 0644, Size: 5}, st) + assert.Equal(t, &types.Stat{Path: "aa", Mode: 0644, Size_: 5}, st) st, err = Stat(filepath.Join(d, "zzz/bb/cc/dd")) assert.NoError(t, err) assert.NotZero(t, st.ModTime) st.ModTime = 0 - assert.Equal(t, &types.Stat{Path: "dd", Mode: uint32(os.ModeSymlink | 0777), Size: 6, Linkname: "../../"}, st) + assert.Equal(t, &types.Stat{Path: "dd", Mode: uint32(os.ModeSymlink | 0777), Size_: 6, Linkname: "../../"}, st) st, err = Stat(filepath.Join(d, "sock")) assert.NoError(t, err) diff --git a/stat_unix.go b/stat_unix.go index def901e3..5923aefe 100644 --- a/stat_unix.go +++ b/stat_unix.go @@ -52,7 +52,7 @@ func setUnixOpt(fi os.FileInfo, stat *types.Stat, path string, seenFiles map[uin if s.Nlink > 1 { if oldpath, ok := seenFiles[ino]; ok { stat.Linkname = oldpath - stat.Size = 0 + stat.Size_ = 0 linked = true } } diff --git a/types/generate.go b/types/generate.go index e8a1183e..5c03178f 100644 --- a/types/generate.go +++ b/types/generate.go @@ -1,11 +1,3 @@ package types -//go:generate protoc --go_out=paths=source_relative:. stat.proto wire.proto - -const ( - PACKET_STAT = Packet_PACKET_STAT - PACKET_REQ = Packet_PACKET_REQ - PACKET_DATA = Packet_PACKET_DATA - PACKET_FIN = Packet_PACKET_FIN - PACKET_ERR = Packet_PACKET_ERR -) +//go:generate protoc --gogoslick_out=. stat.proto wire.proto diff --git a/types/stat.go b/types/stat.go index fd04e15c..b79fd2bd 100644 --- a/types/stat.go +++ b/types/stat.go @@ -2,6 +2,6 @@ package types import "os" -func (s *Stat) IsDir() bool { +func (s Stat) IsDir() bool { return os.FileMode(s.Mode).IsDir() } diff --git a/types/stat.pb.go b/types/stat.pb.go index c9678ba3..91200fb7 100644 --- a/types/stat.pb.go +++ b/types/stat.pb.go @@ -1,35 +1,37 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.1 -// protoc v3.12.4 +// Code generated by protoc-gen-gogo. DO NOT EDIT. // source: stat.proto package types import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" + bytes "bytes" + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + io "io" + math "math" + math_bits "math/bits" reflect "reflect" - sync "sync" + strings "strings" ) -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf -type Stat struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type Stat struct { Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` Mode uint32 `protobuf:"varint,2,opt,name=mode,proto3" json:"mode,omitempty"` Uid uint32 `protobuf:"varint,3,opt,name=uid,proto3" json:"uid,omitempty"` Gid uint32 `protobuf:"varint,4,opt,name=gid,proto3" json:"gid,omitempty"` - Size int64 `protobuf:"varint,5,opt,name=size,proto3" json:"size,omitempty"` + Size_ int64 `protobuf:"varint,5,opt,name=size,proto3" json:"size,omitempty"` ModTime int64 `protobuf:"varint,6,opt,name=modTime,proto3" json:"modTime,omitempty"` // int32 typeflag = 7; Linkname string `protobuf:"bytes,7,opt,name=linkname,proto3" json:"linkname,omitempty"` @@ -38,200 +40,890 @@ type Stat struct { Xattrs map[string][]byte `protobuf:"bytes,10,rep,name=xattrs,proto3" json:"xattrs,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } -func (x *Stat) Reset() { - *x = Stat{} - if protoimpl.UnsafeEnabled { - mi := &file_stat_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } +func (m *Stat) Reset() { *m = Stat{} } +func (*Stat) ProtoMessage() {} +func (*Stat) Descriptor() ([]byte, []int) { + return fileDescriptor_01fabdc1b78bd68b, []int{0} } - -func (x *Stat) String() string { - return protoimpl.X.MessageStringOf(x) +func (m *Stat) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } - -func (*Stat) ProtoMessage() {} - -func (x *Stat) ProtoReflect() protoreflect.Message { - mi := &file_stat_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) +func (m *Stat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Stat.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } - return ms + return b[:n], nil } - return mi.MessageOf(x) } - -// Deprecated: Use Stat.ProtoReflect.Descriptor instead. -func (*Stat) Descriptor() ([]byte, []int) { - return file_stat_proto_rawDescGZIP(), []int{0} +func (m *Stat) XXX_Merge(src proto.Message) { + xxx_messageInfo_Stat.Merge(m, src) +} +func (m *Stat) XXX_Size() int { + return m.Size() } +func (m *Stat) XXX_DiscardUnknown() { + xxx_messageInfo_Stat.DiscardUnknown(m) +} + +var xxx_messageInfo_Stat proto.InternalMessageInfo -func (x *Stat) GetPath() string { - if x != nil { - return x.Path +func (m *Stat) GetPath() string { + if m != nil { + return m.Path } return "" } -func (x *Stat) GetMode() uint32 { - if x != nil { - return x.Mode +func (m *Stat) GetMode() uint32 { + if m != nil { + return m.Mode } return 0 } -func (x *Stat) GetUid() uint32 { - if x != nil { - return x.Uid +func (m *Stat) GetUid() uint32 { + if m != nil { + return m.Uid } return 0 } -func (x *Stat) GetGid() uint32 { - if x != nil { - return x.Gid +func (m *Stat) GetGid() uint32 { + if m != nil { + return m.Gid } return 0 } -func (x *Stat) GetSize() int64 { - if x != nil { - return x.Size +func (m *Stat) GetSize_() int64 { + if m != nil { + return m.Size_ } return 0 } -func (x *Stat) GetModTime() int64 { - if x != nil { - return x.ModTime +func (m *Stat) GetModTime() int64 { + if m != nil { + return m.ModTime } return 0 } -func (x *Stat) GetLinkname() string { - if x != nil { - return x.Linkname +func (m *Stat) GetLinkname() string { + if m != nil { + return m.Linkname } return "" } -func (x *Stat) GetDevmajor() int64 { - if x != nil { - return x.Devmajor +func (m *Stat) GetDevmajor() int64 { + if m != nil { + return m.Devmajor } return 0 } -func (x *Stat) GetDevminor() int64 { - if x != nil { - return x.Devminor +func (m *Stat) GetDevminor() int64 { + if m != nil { + return m.Devminor } return 0 } -func (x *Stat) GetXattrs() map[string][]byte { - if x != nil { - return x.Xattrs +func (m *Stat) GetXattrs() map[string][]byte { + if m != nil { + return m.Xattrs } return nil } -var File_stat_proto protoreflect.FileDescriptor - -var file_stat_proto_rawDesc = []byte{ - 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x66, 0x73, - 0x75, 0x74, 0x69, 0x6c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x22, 0xc7, 0x02, 0x0a, 0x04, 0x53, - 0x74, 0x61, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, - 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x10, 0x0a, - 0x03, 0x67, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x67, 0x69, 0x64, 0x12, - 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, - 0x69, 0x7a, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1a, 0x0a, - 0x08, 0x6c, 0x69, 0x6e, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x6c, 0x69, 0x6e, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x76, - 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x76, - 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x76, 0x6d, 0x69, 0x6e, 0x6f, - 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x76, 0x6d, 0x69, 0x6e, 0x6f, - 0x72, 0x12, 0x36, 0x0a, 0x06, 0x78, 0x61, 0x74, 0x74, 0x72, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x1e, 0x2e, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x53, 0x74, 0x61, 0x74, 0x2e, 0x58, 0x61, 0x74, 0x74, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x52, 0x06, 0x78, 0x61, 0x74, 0x74, 0x72, 0x73, 0x1a, 0x39, 0x0a, 0x0b, 0x58, 0x61, 0x74, - 0x74, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x42, 0x24, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x74, 0x6f, 0x6e, 0x69, 0x73, 0x74, 0x69, 0x69, 0x67, 0x69, 0x2f, 0x66, 0x73, - 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, +func init() { + proto.RegisterType((*Stat)(nil), "fsutil.types.Stat") + proto.RegisterMapType((map[string][]byte)(nil), "fsutil.types.Stat.XattrsEntry") } -var ( - file_stat_proto_rawDescOnce sync.Once - file_stat_proto_rawDescData = file_stat_proto_rawDesc -) +func init() { proto.RegisterFile("stat.proto", fileDescriptor_01fabdc1b78bd68b) } + +var fileDescriptor_01fabdc1b78bd68b = []byte{ + // 317 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x91, 0xbd, 0x4e, 0xc3, 0x30, + 0x14, 0x85, 0x73, 0x9b, 0xfe, 0xba, 0x45, 0x42, 0x16, 0x83, 0xd5, 0xe1, 0x2a, 0x62, 0xca, 0x94, + 0x01, 0x24, 0xc4, 0xcf, 0x86, 0xc4, 0x0b, 0x04, 0x06, 0xc4, 0x66, 0x64, 0x53, 0x4c, 0x9b, 0xb8, + 0x4a, 0xdc, 0x8a, 0x32, 0xf1, 0x08, 0x3c, 0x06, 0x6f, 0x02, 0x63, 0xc7, 0x8e, 0xd4, 0x5d, 0x18, + 0xfb, 0x08, 0xc8, 0x4e, 0x5b, 0xba, 0x9d, 0xf3, 0x9d, 0x7b, 0x95, 0x9c, 0x6b, 0x42, 0x4a, 0xc3, + 0x4d, 0x32, 0x2e, 0xb4, 0xd1, 0xb4, 0xf7, 0x54, 0x4e, 0x8c, 0x1a, 0x25, 0x66, 0x36, 0x96, 0xe5, + 0xf1, 0x57, 0x8d, 0xd4, 0x6f, 0x0d, 0x37, 0x94, 0x92, 0xfa, 0x98, 0x9b, 0x67, 0x06, 0x11, 0xc4, + 0x9d, 0xd4, 0x6b, 0xc7, 0x32, 0x2d, 0x24, 0xab, 0x45, 0x10, 0x1f, 0xa4, 0x5e, 0xd3, 0x43, 0x12, + 0x4e, 0x94, 0x60, 0xa1, 0x47, 0x4e, 0x3a, 0x32, 0x50, 0x82, 0xd5, 0x2b, 0x32, 0x50, 0xc2, 0xed, + 0x95, 0xea, 0x4d, 0xb2, 0x46, 0x04, 0x71, 0x98, 0x7a, 0x4d, 0x19, 0x69, 0x65, 0x5a, 0xdc, 0xa9, + 0x4c, 0xb2, 0xa6, 0xc7, 0x5b, 0x4b, 0xfb, 0xa4, 0x3d, 0x52, 0xf9, 0x30, 0xe7, 0x99, 0x64, 0x2d, + 0xff, 0xf5, 0x9d, 0x77, 0x99, 0x90, 0xd3, 0x8c, 0xbf, 0xe8, 0x82, 0xb5, 0xfd, 0xda, 0xce, 0x6f, + 0x33, 0x95, 0xeb, 0x82, 0x75, 0xfe, 0x33, 0xe7, 0xe9, 0x19, 0x69, 0xbe, 0x72, 0x63, 0x8a, 0x92, + 0x91, 0x28, 0x8c, 0xbb, 0x27, 0x98, 0xec, 0xb7, 0x4e, 0x5c, 0xe3, 0xe4, 0xde, 0x0f, 0xdc, 0xe4, + 0xa6, 0x98, 0xa5, 0x9b, 0xe9, 0xfe, 0x05, 0xe9, 0xee, 0x61, 0x57, 0x6d, 0x28, 0x67, 0x9b, 0x9b, + 0x38, 0x49, 0x8f, 0x48, 0x63, 0xca, 0x47, 0x93, 0xea, 0x26, 0xbd, 0xb4, 0x32, 0x97, 0xb5, 0x73, + 0xb8, 0xbe, 0x9a, 0x2f, 0x31, 0x58, 0x2c, 0x31, 0x58, 0x2f, 0x11, 0xde, 0x2d, 0xc2, 0xa7, 0x45, + 0xf8, 0xb6, 0x08, 0x73, 0x8b, 0xf0, 0x63, 0x11, 0x7e, 0x2d, 0x06, 0x6b, 0x8b, 0xf0, 0xb1, 0xc2, + 0x60, 0xbe, 0xc2, 0x60, 0xb1, 0xc2, 0xe0, 0xa1, 0xe1, 0x7f, 0xe8, 0xb1, 0xe9, 0xdf, 0xe6, 0xf4, + 0x2f, 0x00, 0x00, 0xff, 0xff, 0x06, 0x97, 0xf3, 0xd7, 0xa9, 0x01, 0x00, 0x00, +} + +func (this *Stat) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Stat) + if !ok { + that2, ok := that.(Stat) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Path != that1.Path { + return false + } + if this.Mode != that1.Mode { + return false + } + if this.Uid != that1.Uid { + return false + } + if this.Gid != that1.Gid { + return false + } + if this.Size_ != that1.Size_ { + return false + } + if this.ModTime != that1.ModTime { + return false + } + if this.Linkname != that1.Linkname { + return false + } + if this.Devmajor != that1.Devmajor { + return false + } + if this.Devminor != that1.Devminor { + return false + } + if len(this.Xattrs) != len(that1.Xattrs) { + return false + } + for i := range this.Xattrs { + if !bytes.Equal(this.Xattrs[i], that1.Xattrs[i]) { + return false + } + } + return true +} +func (this *Stat) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 14) + s = append(s, "&types.Stat{") + s = append(s, "Path: "+fmt.Sprintf("%#v", this.Path)+",\n") + s = append(s, "Mode: "+fmt.Sprintf("%#v", this.Mode)+",\n") + s = append(s, "Uid: "+fmt.Sprintf("%#v", this.Uid)+",\n") + s = append(s, "Gid: "+fmt.Sprintf("%#v", this.Gid)+",\n") + s = append(s, "Size_: "+fmt.Sprintf("%#v", this.Size_)+",\n") + s = append(s, "ModTime: "+fmt.Sprintf("%#v", this.ModTime)+",\n") + s = append(s, "Linkname: "+fmt.Sprintf("%#v", this.Linkname)+",\n") + s = append(s, "Devmajor: "+fmt.Sprintf("%#v", this.Devmajor)+",\n") + s = append(s, "Devminor: "+fmt.Sprintf("%#v", this.Devminor)+",\n") + keysForXattrs := make([]string, 0, len(this.Xattrs)) + for k, _ := range this.Xattrs { + keysForXattrs = append(keysForXattrs, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForXattrs) + mapStringForXattrs := "map[string][]byte{" + for _, k := range keysForXattrs { + mapStringForXattrs += fmt.Sprintf("%#v: %#v,", k, this.Xattrs[k]) + } + mapStringForXattrs += "}" + if this.Xattrs != nil { + s = append(s, "Xattrs: "+mapStringForXattrs+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringStat(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func (m *Stat) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} -func file_stat_proto_rawDescGZIP() []byte { - file_stat_proto_rawDescOnce.Do(func() { - file_stat_proto_rawDescData = protoimpl.X.CompressGZIP(file_stat_proto_rawDescData) - }) - return file_stat_proto_rawDescData -} - -var file_stat_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_stat_proto_goTypes = []interface{}{ - (*Stat)(nil), // 0: fsutil.types.Stat - nil, // 1: fsutil.types.Stat.XattrsEntry -} -var file_stat_proto_depIdxs = []int32{ - 1, // 0: fsutil.types.Stat.xattrs:type_name -> fsutil.types.Stat.XattrsEntry - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_stat_proto_init() } -func file_stat_proto_init() { - if File_stat_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_stat_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Stat); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil +func (m *Stat) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Stat) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Xattrs) > 0 { + for k := range m.Xattrs { + v := m.Xattrs[k] + baseI := i + if len(v) > 0 { + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintStat(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 } + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintStat(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintStat(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x52 } } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_stat_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_stat_proto_goTypes, - DependencyIndexes: file_stat_proto_depIdxs, - MessageInfos: file_stat_proto_msgTypes, - }.Build() - File_stat_proto = out.File - file_stat_proto_rawDesc = nil - file_stat_proto_goTypes = nil - file_stat_proto_depIdxs = nil + if m.Devminor != 0 { + i = encodeVarintStat(dAtA, i, uint64(m.Devminor)) + i-- + dAtA[i] = 0x48 + } + if m.Devmajor != 0 { + i = encodeVarintStat(dAtA, i, uint64(m.Devmajor)) + i-- + dAtA[i] = 0x40 + } + if len(m.Linkname) > 0 { + i -= len(m.Linkname) + copy(dAtA[i:], m.Linkname) + i = encodeVarintStat(dAtA, i, uint64(len(m.Linkname))) + i-- + dAtA[i] = 0x3a + } + if m.ModTime != 0 { + i = encodeVarintStat(dAtA, i, uint64(m.ModTime)) + i-- + dAtA[i] = 0x30 + } + if m.Size_ != 0 { + i = encodeVarintStat(dAtA, i, uint64(m.Size_)) + i-- + dAtA[i] = 0x28 + } + if m.Gid != 0 { + i = encodeVarintStat(dAtA, i, uint64(m.Gid)) + i-- + dAtA[i] = 0x20 + } + if m.Uid != 0 { + i = encodeVarintStat(dAtA, i, uint64(m.Uid)) + i-- + dAtA[i] = 0x18 + } + if m.Mode != 0 { + i = encodeVarintStat(dAtA, i, uint64(m.Mode)) + i-- + dAtA[i] = 0x10 + } + if len(m.Path) > 0 { + i -= len(m.Path) + copy(dAtA[i:], m.Path) + i = encodeVarintStat(dAtA, i, uint64(len(m.Path))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintStat(dAtA []byte, offset int, v uint64) int { + offset -= sovStat(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base } +func (m *Stat) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Path) + if l > 0 { + n += 1 + l + sovStat(uint64(l)) + } + if m.Mode != 0 { + n += 1 + sovStat(uint64(m.Mode)) + } + if m.Uid != 0 { + n += 1 + sovStat(uint64(m.Uid)) + } + if m.Gid != 0 { + n += 1 + sovStat(uint64(m.Gid)) + } + if m.Size_ != 0 { + n += 1 + sovStat(uint64(m.Size_)) + } + if m.ModTime != 0 { + n += 1 + sovStat(uint64(m.ModTime)) + } + l = len(m.Linkname) + if l > 0 { + n += 1 + l + sovStat(uint64(l)) + } + if m.Devmajor != 0 { + n += 1 + sovStat(uint64(m.Devmajor)) + } + if m.Devminor != 0 { + n += 1 + sovStat(uint64(m.Devminor)) + } + if len(m.Xattrs) > 0 { + for k, v := range m.Xattrs { + _ = k + _ = v + l = 0 + if len(v) > 0 { + l = 1 + len(v) + sovStat(uint64(len(v))) + } + mapEntrySize := 1 + len(k) + sovStat(uint64(len(k))) + l + n += mapEntrySize + 1 + sovStat(uint64(mapEntrySize)) + } + } + return n +} + +func sovStat(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozStat(x uint64) (n int) { + return sovStat(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *Stat) String() string { + if this == nil { + return "nil" + } + keysForXattrs := make([]string, 0, len(this.Xattrs)) + for k, _ := range this.Xattrs { + keysForXattrs = append(keysForXattrs, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForXattrs) + mapStringForXattrs := "map[string][]byte{" + for _, k := range keysForXattrs { + mapStringForXattrs += fmt.Sprintf("%v: %v,", k, this.Xattrs[k]) + } + mapStringForXattrs += "}" + s := strings.Join([]string{`&Stat{`, + `Path:` + fmt.Sprintf("%v", this.Path) + `,`, + `Mode:` + fmt.Sprintf("%v", this.Mode) + `,`, + `Uid:` + fmt.Sprintf("%v", this.Uid) + `,`, + `Gid:` + fmt.Sprintf("%v", this.Gid) + `,`, + `Size_:` + fmt.Sprintf("%v", this.Size_) + `,`, + `ModTime:` + fmt.Sprintf("%v", this.ModTime) + `,`, + `Linkname:` + fmt.Sprintf("%v", this.Linkname) + `,`, + `Devmajor:` + fmt.Sprintf("%v", this.Devmajor) + `,`, + `Devminor:` + fmt.Sprintf("%v", this.Devminor) + `,`, + `Xattrs:` + mapStringForXattrs + `,`, + `}`, + }, "") + return s +} +func valueToStringStat(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *Stat) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Stat: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Stat: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStat + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStat + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Path = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Mode", wireType) + } + m.Mode = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Mode |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Uid", wireType) + } + m.Uid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Uid |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Gid", wireType) + } + m.Gid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Gid |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Size_", wireType) + } + m.Size_ = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Size_ |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ModTime", wireType) + } + m.ModTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ModTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Linkname", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStat + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStat + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Linkname = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Devmajor", wireType) + } + m.Devmajor = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Devmajor |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Devminor", wireType) + } + m.Devminor = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Devminor |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Xattrs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStat + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStat + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Xattrs == nil { + m.Xattrs = make(map[string][]byte) + } + var mapkey string + mapvalue := []byte{} + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthStat + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthStat + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapbyteLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapbyteLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intMapbyteLen := int(mapbyteLen) + if intMapbyteLen < 0 { + return ErrInvalidLengthStat + } + postbytesIndex := iNdEx + intMapbyteLen + if postbytesIndex < 0 { + return ErrInvalidLengthStat + } + if postbytesIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = make([]byte, mapbyteLen) + copy(mapvalue, dAtA[iNdEx:postbytesIndex]) + iNdEx = postbytesIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipStat(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStat + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Xattrs[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStat(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStat + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStat + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipStat(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStat + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStat + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStat + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthStat + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupStat + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthStat + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthStat = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowStat = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupStat = fmt.Errorf("proto: unexpected end of group") +) diff --git a/types/stat.proto b/types/stat.proto index 9b7728c4..4138be69 100644 --- a/types/stat.proto +++ b/types/stat.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package fsutil.types; -option go_package = "github.com/tonistiigi/fsutil/types"; +option go_package = "types"; message Stat { string path = 1; diff --git a/types/wire.pb.go b/types/wire.pb.go index fdf28ef1..9e22269e 100644 --- a/types/wire.pb.go +++ b/types/wire.pb.go @@ -1,242 +1,575 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.1 -// protoc v3.12.4 +// Code generated by protoc-gen-gogo. DO NOT EDIT. // source: wire.proto package types import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" + bytes "bytes" + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" reflect "reflect" - sync "sync" + strconv "strconv" + strings "strings" ) -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Packet_PacketType int32 const ( - Packet_PACKET_STAT Packet_PacketType = 0 - Packet_PACKET_REQ Packet_PacketType = 1 - Packet_PACKET_DATA Packet_PacketType = 2 - Packet_PACKET_FIN Packet_PacketType = 3 - Packet_PACKET_ERR Packet_PacketType = 4 -) - -// Enum value maps for Packet_PacketType. -var ( - Packet_PacketType_name = map[int32]string{ - 0: "PACKET_STAT", - 1: "PACKET_REQ", - 2: "PACKET_DATA", - 3: "PACKET_FIN", - 4: "PACKET_ERR", - } - Packet_PacketType_value = map[string]int32{ - "PACKET_STAT": 0, - "PACKET_REQ": 1, - "PACKET_DATA": 2, - "PACKET_FIN": 3, - "PACKET_ERR": 4, - } + PACKET_STAT Packet_PacketType = 0 + PACKET_REQ Packet_PacketType = 1 + PACKET_DATA Packet_PacketType = 2 + PACKET_FIN Packet_PacketType = 3 + PACKET_ERR Packet_PacketType = 4 ) -func (x Packet_PacketType) Enum() *Packet_PacketType { - p := new(Packet_PacketType) - *p = x - return p +var Packet_PacketType_name = map[int32]string{ + 0: "PACKET_STAT", + 1: "PACKET_REQ", + 2: "PACKET_DATA", + 3: "PACKET_FIN", + 4: "PACKET_ERR", } -func (x Packet_PacketType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +var Packet_PacketType_value = map[string]int32{ + "PACKET_STAT": 0, + "PACKET_REQ": 1, + "PACKET_DATA": 2, + "PACKET_FIN": 3, + "PACKET_ERR": 4, } -func (Packet_PacketType) Descriptor() protoreflect.EnumDescriptor { - return file_wire_proto_enumTypes[0].Descriptor() -} - -func (Packet_PacketType) Type() protoreflect.EnumType { - return &file_wire_proto_enumTypes[0] -} - -func (x Packet_PacketType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Packet_PacketType.Descriptor instead. func (Packet_PacketType) EnumDescriptor() ([]byte, []int) { - return file_wire_proto_rawDescGZIP(), []int{0, 0} + return fileDescriptor_f2dcdddcdf68d8e0, []int{0, 0} } type Packet struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - Type Packet_PacketType `protobuf:"varint,1,opt,name=type,proto3,enum=fsutil.types.Packet_PacketType" json:"type,omitempty"` Stat *Stat `protobuf:"bytes,2,opt,name=stat,proto3" json:"stat,omitempty"` ID uint32 `protobuf:"varint,3,opt,name=ID,proto3" json:"ID,omitempty"` Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` } -func (x *Packet) Reset() { - *x = Packet{} - if protoimpl.UnsafeEnabled { - mi := &file_wire_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +func (m *Packet) Reset() { *m = Packet{} } +func (*Packet) ProtoMessage() {} +func (*Packet) Descriptor() ([]byte, []int) { + return fileDescriptor_f2dcdddcdf68d8e0, []int{0} +} +func (m *Packet) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Packet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Packet.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } } - -func (x *Packet) String() string { - return protoimpl.X.MessageStringOf(x) +func (m *Packet) XXX_Merge(src proto.Message) { + xxx_messageInfo_Packet.Merge(m, src) +} +func (m *Packet) XXX_Size() int { + return m.Size() +} +func (m *Packet) XXX_DiscardUnknown() { + xxx_messageInfo_Packet.DiscardUnknown(m) } -func (*Packet) ProtoMessage() {} +var xxx_messageInfo_Packet proto.InternalMessageInfo -func (x *Packet) ProtoReflect() protoreflect.Message { - mi := &file_wire_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms +func (m *Packet) GetType() Packet_PacketType { + if m != nil { + return m.Type } - return mi.MessageOf(x) + return PACKET_STAT } -// Deprecated: Use Packet.ProtoReflect.Descriptor instead. -func (*Packet) Descriptor() ([]byte, []int) { - return file_wire_proto_rawDescGZIP(), []int{0} +func (m *Packet) GetStat() *Stat { + if m != nil { + return m.Stat + } + return nil } -func (x *Packet) GetType() Packet_PacketType { - if x != nil { - return x.Type +func (m *Packet) GetID() uint32 { + if m != nil { + return m.ID } - return Packet_PACKET_STAT + return 0 } -func (x *Packet) GetStat() *Stat { - if x != nil { - return x.Stat +func (m *Packet) GetData() []byte { + if m != nil { + return m.Data } return nil } -func (x *Packet) GetID() uint32 { - if x != nil { - return x.ID +func init() { + proto.RegisterEnum("fsutil.types.Packet_PacketType", Packet_PacketType_name, Packet_PacketType_value) + proto.RegisterType((*Packet)(nil), "fsutil.types.Packet") +} + +func init() { proto.RegisterFile("wire.proto", fileDescriptor_f2dcdddcdf68d8e0) } + +var fileDescriptor_f2dcdddcdf68d8e0 = []byte{ + // 276 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0xcf, 0x2c, 0x4a, + 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x49, 0x2b, 0x2e, 0x2d, 0xc9, 0xcc, 0xd1, 0x2b, + 0xa9, 0x2c, 0x48, 0x2d, 0x96, 0xe2, 0x2a, 0x2e, 0x49, 0x2c, 0x81, 0xc8, 0x28, 0xbd, 0x64, 0xe4, + 0x62, 0x0b, 0x48, 0x4c, 0xce, 0x4e, 0x2d, 0x11, 0x32, 0xe6, 0x62, 0x01, 0xc9, 0x4b, 0x30, 0x2a, + 0x30, 0x6a, 0xf0, 0x19, 0xc9, 0xeb, 0x21, 0xeb, 0xd1, 0x83, 0xa8, 0x81, 0x52, 0x21, 0x95, 0x05, + 0xa9, 0x41, 0x60, 0xc5, 0x42, 0x6a, 0x5c, 0x2c, 0x20, 0xd3, 0x24, 0x98, 0x14, 0x18, 0x35, 0xb8, + 0x8d, 0x84, 0x50, 0x35, 0x05, 0x97, 0x24, 0x96, 0x04, 0x81, 0xe5, 0x85, 0xf8, 0xb8, 0x98, 0x3c, + 0x5d, 0x24, 0x98, 0x15, 0x18, 0x35, 0x78, 0x83, 0x98, 0x3c, 0x5d, 0x84, 0x84, 0xb8, 0x58, 0x52, + 0x12, 0x4b, 0x12, 0x25, 0x58, 0x14, 0x18, 0x35, 0x78, 0x82, 0xc0, 0x6c, 0xa5, 0x38, 0x2e, 0x2e, + 0x84, 0xf9, 0x42, 0xfc, 0x5c, 0xdc, 0x01, 0x8e, 0xce, 0xde, 0xae, 0x21, 0xf1, 0xc1, 0x21, 0x8e, + 0x21, 0x02, 0x0c, 0x42, 0x7c, 0x5c, 0x5c, 0x50, 0x81, 0x20, 0xd7, 0x40, 0x01, 0x46, 0x24, 0x05, + 0x2e, 0x8e, 0x21, 0x8e, 0x02, 0x4c, 0x48, 0x0a, 0xdc, 0x3c, 0xfd, 0x04, 0x98, 0x91, 0xf8, 0xae, + 0x41, 0x41, 0x02, 0x2c, 0x4e, 0xd6, 0x17, 0x1e, 0xca, 0x31, 0xdc, 0x78, 0x28, 0xc7, 0xf0, 0xe1, + 0xa1, 0x1c, 0x63, 0xc3, 0x23, 0x39, 0xc6, 0x15, 0x8f, 0xe4, 0x18, 0x4f, 0x3c, 0x92, 0x63, 0xbc, + 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x17, 0x8f, 0xe4, 0x18, 0x3e, 0x3c, 0x92, 0x63, + 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x58, 0xc1, + 0x7e, 0x49, 0x62, 0x03, 0x87, 0x97, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x9d, 0xe3, 0x51, + 0x57, 0x01, 0x00, 0x00, +} + +func (x Packet_PacketType) String() string { + s, ok := Packet_PacketType_name[int32(x)] + if ok { + return s } - return 0 + return strconv.Itoa(int(x)) } +func (this *Packet) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (x *Packet) GetData() []byte { - if x != nil { - return x.Data + that1, ok := that.(*Packet) + if !ok { + that2, ok := that.(Packet) + if ok { + that1 = &that2 + } else { + return false + } } - return nil + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Type != that1.Type { + return false + } + if !this.Stat.Equal(that1.Stat) { + return false + } + if this.ID != that1.ID { + return false + } + if !bytes.Equal(this.Data, that1.Data) { + return false + } + return true +} +func (this *Packet) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 8) + s = append(s, "&types.Packet{") + s = append(s, "Type: "+fmt.Sprintf("%#v", this.Type)+",\n") + if this.Stat != nil { + s = append(s, "Stat: "+fmt.Sprintf("%#v", this.Stat)+",\n") + } + s = append(s, "ID: "+fmt.Sprintf("%#v", this.ID)+",\n") + s = append(s, "Data: "+fmt.Sprintf("%#v", this.Data)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringWire(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func (m *Packet) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil } -var File_wire_proto protoreflect.FileDescriptor - -var file_wire_proto_rawDesc = []byte{ - 0x0a, 0x0a, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x66, 0x73, - 0x75, 0x74, 0x69, 0x6c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x1a, 0x0a, 0x73, 0x74, 0x61, 0x74, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe9, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x63, 0x6b, 0x65, - 0x74, 0x12, 0x33, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x1f, 0x2e, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, - 0x61, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, - 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x73, 0x74, 0x61, 0x74, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, 0x04, 0x73, 0x74, 0x61, 0x74, 0x12, 0x0e, - 0x0a, 0x02, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x49, 0x44, 0x12, 0x12, - 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, - 0x74, 0x61, 0x22, 0x5e, 0x0a, 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x0f, 0x0a, 0x0b, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x10, - 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x52, 0x45, 0x51, 0x10, - 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x44, 0x41, 0x54, 0x41, - 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x46, 0x49, 0x4e, - 0x10, 0x03, 0x12, 0x0e, 0x0a, 0x0a, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x45, 0x52, 0x52, - 0x10, 0x04, 0x42, 0x24, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x74, 0x6f, 0x6e, 0x69, 0x73, 0x74, 0x69, 0x69, 0x67, 0x69, 0x2f, 0x66, 0x73, 0x75, 0x74, - 0x69, 0x6c, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +func (m *Packet) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -var ( - file_wire_proto_rawDescOnce sync.Once - file_wire_proto_rawDescData = file_wire_proto_rawDesc -) +func (m *Packet) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintWire(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x22 + } + if m.ID != 0 { + i = encodeVarintWire(dAtA, i, uint64(m.ID)) + i-- + dAtA[i] = 0x18 + } + if m.Stat != nil { + { + size, err := m.Stat.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWire(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Type != 0 { + i = encodeVarintWire(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} -func file_wire_proto_rawDescGZIP() []byte { - file_wire_proto_rawDescOnce.Do(func() { - file_wire_proto_rawDescData = protoimpl.X.CompressGZIP(file_wire_proto_rawDescData) - }) - return file_wire_proto_rawDescData -} - -var file_wire_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_wire_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_wire_proto_goTypes = []interface{}{ - (Packet_PacketType)(0), // 0: fsutil.types.Packet.PacketType - (*Packet)(nil), // 1: fsutil.types.Packet - (*Stat)(nil), // 2: fsutil.types.Stat -} -var file_wire_proto_depIdxs = []int32{ - 0, // 0: fsutil.types.Packet.type:type_name -> fsutil.types.Packet.PacketType - 2, // 1: fsutil.types.Packet.stat:type_name -> fsutil.types.Stat - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_wire_proto_init() } -func file_wire_proto_init() { - if File_wire_proto != nil { - return - } - file_stat_proto_init() - if !protoimpl.UnsafeEnabled { - file_wire_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Packet); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil +func encodeVarintWire(dAtA []byte, offset int, v uint64) int { + offset -= sovWire(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Packet) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Type != 0 { + n += 1 + sovWire(uint64(m.Type)) + } + if m.Stat != nil { + l = m.Stat.Size() + n += 1 + l + sovWire(uint64(l)) + } + if m.ID != 0 { + n += 1 + sovWire(uint64(m.ID)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovWire(uint64(l)) + } + return n +} + +func sovWire(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozWire(x uint64) (n int) { + return sovWire(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *Packet) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Packet{`, + `Type:` + fmt.Sprintf("%v", this.Type) + `,`, + `Stat:` + strings.Replace(fmt.Sprintf("%v", this.Stat), "Stat", "Stat", 1) + `,`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `Data:` + fmt.Sprintf("%v", this.Data) + `,`, + `}`, + }, "") + return s +} +func valueToStringWire(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *Packet) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWire + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Packet: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Packet: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWire + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= Packet_PacketType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stat", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWire + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthWire + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWire + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Stat == nil { + m.Stat = &Stat{} + } + if err := m.Stat.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + m.ID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWire + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ID |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWire + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthWire + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthWire + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipWire(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWire + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthWire + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipWire(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowWire + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break } } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowWire + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowWire + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthWire + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupWire + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthWire + } + if depth == 0 { + return iNdEx, nil + } } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_wire_proto_rawDesc, - NumEnums: 1, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_wire_proto_goTypes, - DependencyIndexes: file_wire_proto_depIdxs, - EnumInfos: file_wire_proto_enumTypes, - MessageInfos: file_wire_proto_msgTypes, - }.Build() - File_wire_proto = out.File - file_wire_proto_rawDesc = nil - file_wire_proto_goTypes = nil - file_wire_proto_depIdxs = nil + return 0, io.ErrUnexpectedEOF } + +var ( + ErrInvalidLengthWire = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowWire = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupWire = fmt.Errorf("proto: unexpected end of group") +) diff --git a/types/wire.proto b/types/wire.proto index a00300b9..3e85000c 100644 --- a/types/wire.proto +++ b/types/wire.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package fsutil.types; -option go_package = "github.com/tonistiigi/fsutil/types"; +option go_package = "types"; import "stat.proto"; From 9193209c73cdbf9e113b00f5a6e0330bb67661d7 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Fri, 5 Jan 2024 14:15:43 +0100 Subject: [PATCH 10/76] chore: run once on vagrant init Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/ci.yml | 6 ++++-- hack/Vagrantfile.freebsd13 | 33 ++++++++++----------------------- 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bdfc06f6..159a34da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,7 +120,9 @@ jobs: ${{ runner.os }}-vagrant- - name: Set up vagrant - run: vagrant up + run: | + vagrant up --no-tty - name: Test - run: vagrant ssh -- "cd /vagrant; go test -buildvcs=false ./..." + run: | + vagrant ssh -- "cd /vagrant; go test -buildvcs=false ./..." diff --git a/hack/Vagrantfile.freebsd13 b/hack/Vagrantfile.freebsd13 index 0014347e..4a4b027d 100644 --- a/hack/Vagrantfile.freebsd13 +++ b/hack/Vagrantfile.freebsd13 @@ -1,31 +1,18 @@ -# This code is taken from the Vagrantfile from libjail-rs -# https://github.com/fubarnetes/libjail-rs/blob/727353bd6565c5e7a9be2664258d0197a1c8bb35/Vagrantfile -# licensed under BSD-3 Clause License: -# BSD 3-Clause License - -# Copyright (c) 2018, Fabian Freyer All rights reserved. - -# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -# * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -# * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -# * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# -*- mode: ruby -*- +# vi: set ft=ruby : Vagrant.configure("2") do |config| - # Stable version - # config.vm.define "fbsd_13_2" do |fbsd_13_2| fbsd_13_2.vm.box = "freebsd/FreeBSD-13.2-STABLE" end - config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__auto: true + config.vm.synced_folder ".", "/vagrant", type: "rsync" + config.ssh.keep_alive = true - config.vm.provision "shell", inline: <<-SHELL - pkg bootstrap - pkg install -y go - SHELL + config.vm.provision "init", type: "shell", run: "once" do |sh| + sh.inline = <<~SHELL + pkg bootstrap + pkg install -y go + SHELL + end end From 152fee1d6339fae4597abfaf37cf053604324a0d Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Fri, 5 Jan 2024 14:16:21 +0100 Subject: [PATCH 11/76] ci: increase vm boot time to 15m Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- hack/Vagrantfile.freebsd13 | 1 + 1 file changed, 1 insertion(+) diff --git a/hack/Vagrantfile.freebsd13 b/hack/Vagrantfile.freebsd13 index 4a4b027d..7885e148 100644 --- a/hack/Vagrantfile.freebsd13 +++ b/hack/Vagrantfile.freebsd13 @@ -6,6 +6,7 @@ Vagrant.configure("2") do |config| fbsd_13_2.vm.box = "freebsd/FreeBSD-13.2-STABLE" end + config.vm.boot_timeout = 900 config.vm.synced_folder ".", "/vagrant", type: "rsync" config.ssh.keep_alive = true From c586cb2b8cdecf0deb24635cf149619ea51c022a Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Fri, 5 Jan 2024 14:18:40 +0100 Subject: [PATCH 12/76] ci: switch to macos-13 runner for freebsd job Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/ci.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 159a34da..ccc3c9e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -102,8 +102,7 @@ jobs: go test ./... test-freebsd-amd64: - runs-on: macos-latest - timeout-minutes: 60 + runs-on: macos-13 env: VAGRANT_VAGRANTFILE: hack/Vagrantfile.freebsd13 steps: @@ -118,6 +117,22 @@ jobs: key: ${{ runner.os }}-vagrant-${{ hashFiles('hack/Vagrantfile.freebsd13') }} restore-keys: | ${{ runner.os }}-vagrant- + - + name: Install Vagrant and VirtualBox + run: | + set -x + brew tap hashicorp/tap + brew install hashicorp/tap/hashicorp-vagrant + brew install --cask virtualbox + env: + HOMEBREW_NO_AUTO_UPDATE: 1 + HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 + - + name: Check versions + run: | + set -x + vagrant --version + VBoxManage -v - name: Set up vagrant run: | From 30180b0c3b453c06fd3e7d47f66767c0bc6cc70e Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Fri, 5 Jan 2024 14:19:27 +0100 Subject: [PATCH 13/76] ci: retry logic for freebsd test step Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ccc3c9e1..fa86cf6e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -139,5 +139,9 @@ jobs: vagrant up --no-tty - name: Test - run: | - vagrant ssh -- "cd /vagrant; go test -buildvcs=false ./..." + uses: nick-fields/retry@14672906e672a08bd6eeb15720e9ed3ce869cdd4 # v2.9.0 + with: + timeout_minutes: 20 + max_attempts: 5 + command: | + vagrant ssh -- "cd /vagrant; go test -buildvcs=false ./..." From 330b1ffbd967055f91c50d0f5817653cad3ebd33 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Wed, 7 Feb 2024 13:19:29 +0100 Subject: [PATCH 14/76] ci: add windows to test matrix Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/ci.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa86cf6e..a8489553 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,11 +79,14 @@ jobs: with: targets: test - test-macos: - runs-on: macos-latest + test-os: + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: + os: + - macos-latest + - windows-latest go: - "1.19" - "1.20" From b843da975eab05a701f9f0682b00f44acbb7b97b Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Wed, 24 Jan 2024 16:45:20 +0100 Subject: [PATCH 15/76] diskwriter: fix test scope Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- diskwriter_test.go | 104 ----------------------------------- diskwriter_unix_test.go | 117 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+), 104 deletions(-) create mode 100644 diskwriter_unix_test.go diff --git a/diskwriter_test.go b/diskwriter_test.go index 4b6edb3b..90f3d525 100644 --- a/diskwriter_test.go +++ b/diskwriter_test.go @@ -7,15 +7,12 @@ import ( "os" "path/filepath" "sync" - "syscall" "testing" "time" "github.com/opencontainers/go-digest" "github.com/pkg/errors" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "golang.org/x/sys/unix" ) // requiresRoot skips tests that require root @@ -163,107 +160,6 @@ file foo2 dt, err := os.ReadFile(filepath.Join(dest, "foo")) assert.NoError(t, err) assert.Equal(t, []byte("mydata"), dt) - -} - -func TestWalkerWriterAsync(t *testing.T) { - d, err := tmpDir(changeStream([]string{ - "ADD foo dir", - "ADD foo/foo1 file data1", - "ADD foo/foo2 file data2", - "ADD foo/foo3 file data3", - "ADD foo/foo4 file >foo/foo3", - "ADD foo5 file data5", - })) - assert.NoError(t, err) - defer os.RemoveAll(d) - - dest := t.TempDir() - - dw, err := NewDiskWriter(context.TODO(), dest, DiskWriterOpt{ - AsyncDataCb: newWriteToFunc(d, 300*time.Millisecond), - }) - assert.NoError(t, err) - - st := time.Now() - - err = Walk(context.Background(), d, nil, readAsAdd(dw.HandleChange)) - assert.NoError(t, err) - - err = dw.Wait(context.TODO()) - assert.NoError(t, err) - - dt, err := os.ReadFile(filepath.Join(dest, "foo/foo3")) - assert.NoError(t, err) - assert.Equal(t, "data3", string(dt)) - - dt, err = os.ReadFile(filepath.Join(dest, "foo/foo4")) - assert.NoError(t, err) - assert.Equal(t, "data3", string(dt)) - - fi1, err := os.Lstat(filepath.Join(dest, "foo/foo3")) - assert.NoError(t, err) - fi2, err := os.Lstat(filepath.Join(dest, "foo/foo4")) - assert.NoError(t, err) - stat1, ok1 := fi1.Sys().(*syscall.Stat_t) - stat2, ok2 := fi2.Sys().(*syscall.Stat_t) - if ok1 && ok2 { - assert.Equal(t, stat1.Ino, stat2.Ino) - } - - dt, err = os.ReadFile(filepath.Join(dest, "foo5")) - assert.NoError(t, err) - assert.Equal(t, "data5", string(dt)) - - duration := time.Since(st) - assert.True(t, duration < 500*time.Millisecond) -} - -func TestWalkerWriterDevices(t *testing.T) { - requiresRoot(t) - - d, err := tmpDir(changeStream([]string{ - "ADD foo dir", - "ADD foo/foo1 file data1", - })) - require.NoError(t, err) - - err = unix.Mknod(filepath.Join(d, "foo/block"), syscall.S_IFBLK|0600, mkdev(2, 3)) - require.NoError(t, err) - - err = unix.Mknod(filepath.Join(d, "foo/char"), syscall.S_IFCHR|0400, mkdev(1, 9)) - require.NoError(t, err) - - dest := t.TempDir() - - dw, err := NewDiskWriter(context.TODO(), dest, DiskWriterOpt{ - SyncDataCb: newWriteToFunc(d, 0), - }) - assert.NoError(t, err) - - err = Walk(context.Background(), d, nil, readAsAdd(dw.HandleChange)) - assert.NoError(t, err) - - err = dw.Wait(context.TODO()) - assert.NoError(t, err) - - fi, err := os.Lstat(filepath.Join(dest, "foo/char")) - require.NoError(t, err) - - stat, ok := fi.Sys().(*syscall.Stat_t) - require.True(t, ok) - - assert.Equal(t, uint64(1), stat.Rdev>>8) - assert.Equal(t, uint64(9), stat.Rdev&0xff) - - fi, err = os.Lstat(filepath.Join(dest, "foo/block")) - require.NoError(t, err) - - stat, ok = fi.Sys().(*syscall.Stat_t) - require.True(t, ok) - - assert.Equal(t, uint64(2), stat.Rdev>>8) - assert.Equal(t, uint64(3), stat.Rdev&0xff) } func readAsAdd(f HandleChangeFn) filepath.WalkFunc { diff --git a/diskwriter_unix_test.go b/diskwriter_unix_test.go new file mode 100644 index 00000000..7cd6eb55 --- /dev/null +++ b/diskwriter_unix_test.go @@ -0,0 +1,117 @@ +//go:build !windows +// +build !windows + +package fsutil + +import ( + "context" + "os" + "path/filepath" + "syscall" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "golang.org/x/sys/unix" +) + +func TestWalkerWriterAsync(t *testing.T) { + d, err := tmpDir(changeStream([]string{ + "ADD foo dir", + "ADD foo/foo1 file data1", + "ADD foo/foo2 file data2", + "ADD foo/foo3 file data3", + "ADD foo/foo4 file >foo/foo3", + "ADD foo5 file data5", + })) + assert.NoError(t, err) + defer os.RemoveAll(d) + + dest := t.TempDir() + + dw, err := NewDiskWriter(context.TODO(), dest, DiskWriterOpt{ + AsyncDataCb: newWriteToFunc(d, 300*time.Millisecond), + }) + assert.NoError(t, err) + + st := time.Now() + + err = Walk(context.Background(), d, nil, readAsAdd(dw.HandleChange)) + assert.NoError(t, err) + + err = dw.Wait(context.TODO()) + assert.NoError(t, err) + + dt, err := os.ReadFile(filepath.Join(dest, "foo/foo3")) + assert.NoError(t, err) + assert.Equal(t, "data3", string(dt)) + + dt, err = os.ReadFile(filepath.Join(dest, "foo/foo4")) + assert.NoError(t, err) + assert.Equal(t, "data3", string(dt)) + + fi1, err := os.Lstat(filepath.Join(dest, "foo/foo3")) + assert.NoError(t, err) + fi2, err := os.Lstat(filepath.Join(dest, "foo/foo4")) + assert.NoError(t, err) + stat1, ok1 := fi1.Sys().(*syscall.Stat_t) + stat2, ok2 := fi2.Sys().(*syscall.Stat_t) + if ok1 && ok2 { + assert.Equal(t, stat1.Ino, stat2.Ino) + } + + dt, err = os.ReadFile(filepath.Join(dest, "foo5")) + assert.NoError(t, err) + assert.Equal(t, "data5", string(dt)) + + duration := time.Since(st) + assert.True(t, duration < 500*time.Millisecond) +} + +func TestWalkerWriterDevices(t *testing.T) { + requiresRoot(t) + + d, err := tmpDir(changeStream([]string{ + "ADD foo dir", + "ADD foo/foo1 file data1", + })) + require.NoError(t, err) + + err = unix.Mknod(filepath.Join(d, "foo/block"), syscall.S_IFBLK|0600, mkdev(2, 3)) + require.NoError(t, err) + + err = unix.Mknod(filepath.Join(d, "foo/char"), syscall.S_IFCHR|0400, mkdev(1, 9)) + require.NoError(t, err) + + dest := t.TempDir() + + dw, err := NewDiskWriter(context.TODO(), dest, DiskWriterOpt{ + SyncDataCb: newWriteToFunc(d, 0), + }) + assert.NoError(t, err) + + err = Walk(context.Background(), d, nil, readAsAdd(dw.HandleChange)) + assert.NoError(t, err) + + err = dw.Wait(context.TODO()) + assert.NoError(t, err) + + fi, err := os.Lstat(filepath.Join(dest, "foo/char")) + require.NoError(t, err) + + stat, ok := fi.Sys().(*syscall.Stat_t) + require.True(t, ok) + + assert.Equal(t, uint64(1), stat.Rdev>>8) + assert.Equal(t, uint64(9), stat.Rdev&0xff) + + fi, err = os.Lstat(filepath.Join(dest, "foo/block")) + require.NoError(t, err) + + stat, ok = fi.Sys().(*syscall.Stat_t) + require.True(t, ok) + + assert.Equal(t, uint64(2), stat.Rdev>>8) + assert.Equal(t, uint64(3), stat.Rdev&0xff) +} From 3d01fa58d7d052226c0021f5c3a03b58455bbf11 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:39:55 +0100 Subject: [PATCH 16/76] fix file path separator Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- diff_containerd.go | 7 +- diskwriter_test.go | 16 ++-- filter.go | 2 +- filter_test.go | 179 ++++++++++++++++++++++++++------------------- followlinks.go | 8 +- fs_test.go | 7 +- receive_test.go | 139 ++++++++++++++++++++++++++--------- stat.go | 2 +- validator.go | 22 +++--- validator_test.go | 3 +- 10 files changed, 239 insertions(+), 146 deletions(-) diff --git a/diff_containerd.go b/diff_containerd.go index d8619abf..84fdc89d 100644 --- a/diff_containerd.go +++ b/diff_containerd.go @@ -5,6 +5,7 @@ import ( "context" "io" "os" + "path/filepath" "strings" "github.com/tonistiigi/fsutil/types" @@ -110,7 +111,7 @@ func doubleWalkDiff(ctx context.Context, changeFn ChangeFunc, a, b walkerFn, fil if filter != nil { filter(f2.path, &statCopy) } - f2copy = ¤tPath{path: f2.path, stat: &statCopy} + f2copy = ¤tPath{path: filepath.FromSlash(f2.path), stat: &statCopy} } k, p := pathChange(f1, f2copy) switch k { @@ -127,7 +128,7 @@ func doubleWalkDiff(ctx context.Context, changeFn ChangeFunc, a, b walkerFn, fil f1 = nil continue } else if rmdir == "" && f1.stat.IsDir() { - rmdir = f1.path + string(os.PathSeparator) + rmdir = f1.path + string(filepath.Separator) } else if rmdir != "" { rmdir = "" } @@ -138,7 +139,7 @@ func doubleWalkDiff(ctx context.Context, changeFn ChangeFunc, a, b walkerFn, fil return err } if f1.stat.IsDir() && !f2copy.stat.IsDir() { - rmdir = f1.path + string(os.PathSeparator) + rmdir = f1.path + string(filepath.Separator) } else if rmdir != "" { rmdir = "" } diff --git a/diskwriter_test.go b/diskwriter_test.go index 90f3d525..ed8e0e7d 100644 --- a/diskwriter_test.go +++ b/diskwriter_test.go @@ -51,12 +51,12 @@ func TestWriterSimple(t *testing.T) { err = Walk(context.Background(), dest, nil, bufWalk(b)) assert.NoError(t, err) - assert.Equal(t, string(b.Bytes()), `dir bar + assert.Equal(t, `dir bar file bar/foo symlink:../foo bar/foo2 file foo file foo2 >foo -`) +`, b.String()) } @@ -88,9 +88,9 @@ func TestWriterFileToDir(t *testing.T) { err = Walk(context.Background(), dest, nil, bufWalk(b)) assert.NoError(t, err) - assert.Equal(t, string(b.Bytes()), `dir foo + assert.Equal(t, `dir foo file foo/bar -`) +`, b.String()) } func TestWriterDirToFile(t *testing.T) { @@ -121,8 +121,8 @@ func TestWriterDirToFile(t *testing.T) { err = Walk(context.Background(), dest, nil, bufWalk(b)) assert.NoError(t, err) - assert.Equal(t, string(b.Bytes()), `file foo -`) + assert.Equal(t, `file foo +`, b.String()) } func TestWalkerWriterSimple(t *testing.T) { @@ -150,12 +150,12 @@ func TestWalkerWriterSimple(t *testing.T) { err = Walk(context.Background(), dest, nil, bufWalk(b)) assert.NoError(t, err) - assert.Equal(t, string(b.Bytes()), `dir bar + assert.Equal(t, filepath.FromSlash(`dir bar file bar/foo symlink:../foo bar/foo2 file foo file foo2 -`) +`), b.String()) dt, err := os.ReadFile(filepath.Join(dest, "foo")) assert.NoError(t, err) diff --git a/filter.go b/filter.go index 6585db4b..5257c285 100644 --- a/filter.go +++ b/filter.go @@ -96,7 +96,7 @@ func NewFilterFS(fs FS, opt *FilterOpt) (FS, error) { } patternChars := "*[]?^" - if os.PathSeparator != '\\' { + if filepath.Separator != '\\' { patternChars += `\` } diff --git a/filter_test.go b/filter_test.go index 5d25ffdd..2e0619be 100644 --- a/filter_test.go +++ b/filter_test.go @@ -30,10 +30,9 @@ func TestWalkerSimple(t *testing.T) { err = Walk(context.Background(), d, nil, bufWalk(b)) assert.NoError(t, err) - assert.Equal(t, string(b.Bytes()), `file foo + assert.Equal(t, `file foo file foo2 -`) - +`, b.String()) } func TestInvalidExcludePatterns(t *testing.T) { @@ -62,9 +61,9 @@ func TestWalkerInclude(t *testing.T) { }, bufWalk(b)) assert.NoError(t, err) - assert.Equal(t, `dir bar + assert.Equal(t, filepath.FromSlash(`dir bar file bar/foo -`, string(b.Bytes())) +`), b.String()) b.Reset() err = Walk(context.Background(), d, &FilterOpt{ @@ -72,9 +71,9 @@ file bar/foo }, bufWalk(b)) assert.NoError(t, err) - assert.Equal(t, `dir bar + assert.Equal(t, filepath.FromSlash(`dir bar file bar/foo -`, string(b.Bytes())) +`), b.String()) b.Reset() err = Walk(context.Background(), d, &FilterOpt{ @@ -82,9 +81,9 @@ file bar/foo }, bufWalk(b)) assert.NoError(t, err) - assert.Equal(t, `dir bar + assert.Equal(t, filepath.FromSlash(`dir bar file bar/foo -`, string(b.Bytes())) +`), b.String()) b.Reset() err = Walk(context.Background(), d, &FilterOpt{ @@ -92,9 +91,9 @@ file bar/foo }, bufWalk(b)) assert.NoError(t, err) - assert.Equal(t, `dir bar + assert.Equal(t, filepath.FromSlash(`dir bar file bar/foo -`, string(b.Bytes())) +`), b.String()) b.Reset() err = Walk(context.Background(), d, &FilterOpt{ @@ -111,7 +110,7 @@ file bar/foo assert.NoError(t, err) assert.Equal(t, `file foo2 -`, string(b.Bytes())) +`, b.String()) b.Reset() err = Walk(context.Background(), d, &FilterOpt{ @@ -119,9 +118,9 @@ file bar/foo }, bufWalk(b)) assert.NoError(t, err) - assert.Equal(t, `dir bar + assert.Equal(t, filepath.FromSlash(`dir bar file bar/foo -`, string(b.Bytes())) +`), b.String()) b.Reset() err = Walk(context.Background(), d, &FilterOpt{ @@ -129,9 +128,9 @@ file bar/foo }, bufWalk(b)) assert.NoError(t, err) - assert.Equal(t, `dir bar + assert.Equal(t, filepath.FromSlash(`dir bar file bar/foo -`, string(b.Bytes())) +`), b.String()) b.Reset() err = Walk(context.Background(), d, &FilterOpt{ @@ -139,9 +138,9 @@ file bar/foo }, bufWalk(b)) assert.NoError(t, err) - assert.Equal(t, `dir bar + assert.Equal(t, filepath.FromSlash(`dir bar file bar/foo -`, string(b.Bytes())) +`), b.String()) } func TestWalkerExclude(t *testing.T) { @@ -159,24 +158,40 @@ func TestWalkerExclude(t *testing.T) { }, bufWalk(b)) assert.NoError(t, err) - assert.Equal(t, `file bar + assert.Equal(t, filepath.FromSlash(`file bar dir foo file foo/bar2 -`, string(b.Bytes())) +`), b.String()) } func TestWalkerFollowLinks(t *testing.T) { - d, err := tmpDir(changeStream([]string{ - "ADD bar file", - "ADD foo dir", - "ADD foo/l1 symlink /baz/one", - "ADD foo/l2 symlink /baz/two", - "ADD baz dir", - "ADD baz/one file", - "ADD baz/two symlink ../bax", - "ADD bax file", - "ADD bay file", // not included - })) + var d string + var err error + if runtime.GOOS == "windows" { + d, err = tmpDir(changeStream([]string{ + "ADD bar file", + "ADD foo dir", + "ADD foo/l1 symlink C:/baz/one", + "ADD foo/l2 symlink C:/baz/two", + "ADD baz dir", + "ADD baz/one file", + "ADD baz/two symlink ../bax", + "ADD bax file", + "ADD bay file", // not included + })) + } else { + d, err = tmpDir(changeStream([]string{ + "ADD bar file", + "ADD foo dir", + "ADD foo/l1 symlink /baz/one", + "ADD foo/l2 symlink /baz/two", + "ADD baz dir", + "ADD baz/one file", + "ADD baz/two symlink ../bax", + "ADD bax file", + "ADD bay file", // not included + })) + } assert.NoError(t, err) defer os.RemoveAll(d) b := &bytes.Buffer{} @@ -185,7 +200,18 @@ func TestWalkerFollowLinks(t *testing.T) { }, bufWalk(b)) assert.NoError(t, err) - assert.Equal(t, `file bar + if runtime.GOOS == "windows" { + assert.Equal(t, filepath.FromSlash(`file bar +file bax +dir baz +file baz/one +symlink:../bax baz/two +dir foo +symlink:C:/baz/one foo/l1 +symlink:C:/baz/two foo/l2 +`), b.String()) + } else { + assert.Equal(t, filepath.FromSlash(`file bar file bax dir baz file baz/one @@ -193,7 +219,8 @@ symlink:../bax baz/two dir foo symlink:/baz/one foo/l1 symlink:/baz/two foo/l2 -`, string(b.Bytes())) +`), b.String()) + } } func TestWalkerFollowLinksToRoot(t *testing.T) { @@ -212,12 +239,12 @@ func TestWalkerFollowLinksToRoot(t *testing.T) { }, bufWalk(b)) assert.NoError(t, err) - assert.Equal(t, `file bar + assert.Equal(t, filepath.FromSlash(`file bar file bax dir bay file bay/baz symlink:. foo -`, string(b.Bytes())) +`), b.String()) } func TestWalkerMap(t *testing.T) { @@ -241,10 +268,10 @@ func TestWalkerMap(t *testing.T) { }, bufWalk(b)) assert.NoError(t, err) - assert.Equal(t, `dir _foo + assert.Equal(t, filepath.FromSlash(`dir _foo file _foo/bar2 file _foo2 -`, string(b.Bytes())) +`), b.String()) } func TestWalkerMapSkipDir(t *testing.T) { @@ -275,10 +302,10 @@ func TestWalkerMapSkipDir(t *testing.T) { }, bufWalk(b)) assert.NoError(t, err) - assert.Equal(t, `dir includeDir + assert.Equal(t, filepath.FromSlash(`dir includeDir file includeDir/a.txt -`, string(b.Bytes())) - assert.Equal(t, []string{"excludeDir", "includeDir", "includeDir/a.txt"}, walked) +`), b.String()) + assert.Equal(t, []string{"excludeDir", "includeDir", filepath.FromSlash("includeDir/a.txt")}, walked) } func TestWalkerPermissionDenied(t *testing.T) { @@ -313,7 +340,7 @@ func TestWalkerPermissionDenied(t *testing.T) { }, bufWalk(b)) assert.NoError(t, err) assert.Equal(t, `dir foo -`, string(b.Bytes())) +`, b.String()) b.Reset() err = Walk(context.Background(), d, &FilterOpt{ @@ -321,7 +348,7 @@ func TestWalkerPermissionDenied(t *testing.T) { }, bufWalk(b)) assert.NoError(t, err) assert.Equal(t, `dir foo -`, string(b.Bytes())) +`, b.String()) b.Reset() err = Walk(context.Background(), d, &FilterOpt{ @@ -337,7 +364,7 @@ func TestWalkerPermissionDenied(t *testing.T) { }, bufWalk(b)) assert.NoError(t, err) assert.Equal(t, `dir foo -`, string(b.Bytes())) +`, b.String()) } func bufWalk(buf *bytes.Buffer) filepath.WalkFunc { @@ -582,7 +609,7 @@ func TestWalkerDoublestarInclude(t *testing.T) { }, bufWalk(b)) assert.NoError(t, err) - trimEqual(t, ` + trimEqual(t, filepath.FromSlash(` dir a dir a/b dir a/b/bar @@ -596,7 +623,7 @@ func TestWalkerDoublestarInclude(t *testing.T) { dir foo/bar file foo/bar/bee file foo2 - `, string(b.Bytes())) + `), b.String()) b.Reset() err = Walk(context.Background(), d, &FilterOpt{ @@ -604,7 +631,7 @@ func TestWalkerDoublestarInclude(t *testing.T) { }, bufWalk(b)) assert.NoError(t, err) - trimEqual(t, ` + trimEqual(t, filepath.FromSlash(` dir a dir a/b dir a/b/bar @@ -615,7 +642,7 @@ func TestWalkerDoublestarInclude(t *testing.T) { dir foo dir foo/bar file foo/bar/bee - `, string(b.Bytes())) + `), b.String()) b.Reset() err = Walk(context.Background(), d, &FilterOpt{ @@ -623,14 +650,14 @@ func TestWalkerDoublestarInclude(t *testing.T) { }, bufWalk(b)) assert.NoError(t, err) - trimEqual(t, ` + trimEqual(t, filepath.FromSlash(` dir a dir a/b dir a/b/bar file a/b/bar/foo dir bar file bar/foo - `, string(b.Bytes())) + `), b.String()) b.Reset() err = Walk(context.Background(), d, &FilterOpt{ @@ -638,7 +665,7 @@ func TestWalkerDoublestarInclude(t *testing.T) { }, bufWalk(b)) assert.NoError(t, err) - trimEqual(t, ` + trimEqual(t, filepath.FromSlash(` dir a dir a/b dir a/b/bar @@ -651,7 +678,7 @@ func TestWalkerDoublestarInclude(t *testing.T) { dir foo dir foo/bar file foo/bar/bee - `, string(b.Bytes())) + `), b.String()) b.Reset() err = Walk(context.Background(), d, &FilterOpt{ @@ -659,7 +686,7 @@ func TestWalkerDoublestarInclude(t *testing.T) { }, bufWalk(b)) assert.NoError(t, err) - trimEqual(t, ` + trimEqual(t, filepath.FromSlash(` dir a dir a/b dir a/b/bar @@ -667,7 +694,7 @@ func TestWalkerDoublestarInclude(t *testing.T) { file a/b/bar/fop dir bar file bar/foo - `, string(b.Bytes())) + `), b.String()) b.Reset() err = Walk(context.Background(), d, &FilterOpt{ @@ -675,7 +702,7 @@ func TestWalkerDoublestarInclude(t *testing.T) { }, bufWalk(b)) assert.NoError(t, err) - trimEqual(t, ``, string(b.Bytes())) + trimEqual(t, ``, b.String()) b.Reset() err = Walk(context.Background(), d, &FilterOpt{ @@ -683,7 +710,7 @@ func TestWalkerDoublestarInclude(t *testing.T) { }, bufWalk(b)) assert.NoError(t, err) - trimEqual(t, ` + trimEqual(t, filepath.FromSlash(` dir a dir a/b dir a/b/bar @@ -695,7 +722,7 @@ func TestWalkerDoublestarInclude(t *testing.T) { dir foo/bar file foo/bar/bee file foo2 - `, string(b.Bytes())) + `), b.String()) b.Reset() err = Walk(context.Background(), d, &FilterOpt{ @@ -703,7 +730,7 @@ func TestWalkerDoublestarInclude(t *testing.T) { }, bufWalk(b)) assert.NoError(t, err) - trimEqual(t, ` + trimEqual(t, filepath.FromSlash(` dir a dir a/b dir a/b/bar @@ -711,7 +738,7 @@ func TestWalkerDoublestarInclude(t *testing.T) { file a/b/bar/fop dir bar file bar/foo - `, string(b.Bytes())) + `), b.String()) b.Reset() err = Walk(context.Background(), d, &FilterOpt{ @@ -719,14 +746,14 @@ func TestWalkerDoublestarInclude(t *testing.T) { }, bufWalk(b)) assert.NoError(t, err) - trimEqual(t, ` + trimEqual(t, filepath.FromSlash(` dir a dir a/b dir a/b/bar file a/b/bar/foo dir bar file bar/foo - `, string(b.Bytes())) + `), b.String()) b.Reset() err = Walk(context.Background(), d, &FilterOpt{ @@ -734,11 +761,11 @@ func TestWalkerDoublestarInclude(t *testing.T) { }, bufWalk(b)) assert.NoError(t, err) - trimEqual(t, ` + trimEqual(t, filepath.FromSlash(` dir foo dir foo/bar file foo/bar/bee - `, string(b.Bytes())) + `), b.String()) b.Reset() err = Walk(context.Background(), d, &FilterOpt{ @@ -746,12 +773,12 @@ func TestWalkerDoublestarInclude(t *testing.T) { }, bufWalk(b)) assert.NoError(t, err) - trimEqual(t, ` + trimEqual(t, filepath.FromSlash(` dir a dir a/b dir a/b/baz dir baz - `, string(b.Bytes())) + `), b.String()) } func TestFSWalk(t *testing.T) { @@ -768,23 +795,23 @@ func TestFSWalk(t *testing.T) { b := &bytes.Buffer{} err = f.Walk(context.Background(), "", bufWalkDir(b)) assert.NoError(t, err) - assert.Equal(t, string(b.Bytes()), `dir bar + assert.Equal(t, filepath.FromSlash(`dir bar file bar/foo2 file foo -`) +`), b.String()) b = &bytes.Buffer{} err = f.Walk(context.Background(), "foo", bufWalkDir(b)) assert.NoError(t, err) - assert.Equal(t, string(b.Bytes()), `file foo -`) + assert.Equal(t, `file foo +`, b.String()) b = &bytes.Buffer{} err = f.Walk(context.Background(), "bar", bufWalkDir(b)) assert.NoError(t, err) - assert.Equal(t, string(b.Bytes()), `dir bar + assert.Equal(t, filepath.FromSlash(`dir bar file bar/foo2 -`) +`), b.String()) } func TestFSWalkNested(t *testing.T) { @@ -804,9 +831,9 @@ func TestFSWalkNested(t *testing.T) { b := &bytes.Buffer{} err = f2.Walk(context.Background(), "", bufWalkDir(b)) assert.NoError(t, err) - assert.Equal(t, string(b.Bytes()), `dir foo + assert.Equal(t, filepath.FromSlash(`dir foo file foo/bar -`) +`), b.String()) f2, err = NewFilterFS(f, &FilterOpt{ ExcludePatterns: []string{"!foo/bar"}, @@ -819,7 +846,7 @@ file foo/bar b = &bytes.Buffer{} err = f2.Walk(context.Background(), "", bufWalkDir(b)) assert.NoError(t, err) - assert.Equal(t, string(b.Bytes()), ``) + assert.Equal(t, ``, b.String()) f2, err = NewFilterFS(f, &FilterOpt{ ExcludePatterns: []string{"foo"}, @@ -832,7 +859,7 @@ file foo/bar b = &bytes.Buffer{} err = f2.Walk(context.Background(), "", bufWalkDir(b)) assert.NoError(t, err) - assert.Equal(t, string(b.Bytes()), ``) + assert.Equal(t, ``, b.String()) } func TestFilteredOpen(t *testing.T) { @@ -853,8 +880,8 @@ func TestFilteredOpen(t *testing.T) { b := &bytes.Buffer{} err = f.Walk(context.Background(), "", bufWalkDir(b)) assert.NoError(t, err) - assert.Equal(t, string(b.Bytes()), `file foo -`) + assert.Equal(t, `file foo +`, b.String()) r, err := f.Open("foo") assert.NoError(t, err) diff --git a/followlinks.go b/followlinks.go index 7a843cb1..559291d7 100644 --- a/followlinks.go +++ b/followlinks.go @@ -137,8 +137,8 @@ func (r *symlinkResolver) readSymlink(p string, allowWildcard bool) ([]string, e func statFile(fs FS, root string) (os.DirEntry, error) { var out os.DirEntry - root = filepath.ToSlash(filepath.Clean(root)) - if root == "/" || root == "." { + root = filepath.FromSlash(filepath.Clean(root)) + if root == string(filepath.Separator) || root == "." { return nil, nil } @@ -168,8 +168,8 @@ func statFile(fs FS, root string) (os.DirEntry, error) { func readDir(fs FS, root string) ([]os.DirEntry, error) { var out []os.DirEntry - root = filepath.ToSlash(filepath.Clean(root)) - if root == "/" || root == "." { + root = filepath.FromSlash(filepath.Clean(root)) + if root == string(filepath.Separator) || root == "." { root = "." out = make([]gofs.DirEntry, 0) } diff --git a/fs_test.go b/fs_test.go index 54e7653b..fc60c1f7 100644 --- a/fs_test.go +++ b/fs_test.go @@ -4,6 +4,7 @@ import ( "context" gofs "io/fs" "os" + "path/filepath" "testing" "github.com/containerd/continuity/fs/fstest" @@ -32,7 +33,7 @@ func TestWalk(t *testing.T) { }) require.NoError(t, err) - require.Equal(t, paths, []string{"dir", "dir/foo"}) + require.Equal(t, []string{"dir", filepath.FromSlash("dir/foo")}, paths) require.Len(t, files, 2) require.Equal(t, "dir", files[0].Name()) require.Equal(t, "foo", files[1].Name()) @@ -49,7 +50,7 @@ func TestWalk(t *testing.T) { require.Equal(t, len("contents"), int(fis[1].Size())) require.Equal(t, "dir", fis[0].(*StatInfo).Path) - require.Equal(t, "dir/foo", fis[1].(*StatInfo).Path) + require.Equal(t, filepath.FromSlash("dir/foo"), fis[1].(*StatInfo).Path) } func TestWalkDir(t *testing.T) { @@ -98,7 +99,7 @@ func TestWalkDir(t *testing.T) { }) require.NoError(t, err) - require.Equal(t, paths, []string{"1", "1/dir", "1/dir/foo", "2", "2/dir", "2/dir/bar"}) + require.Equal(t, []string{"1", filepath.FromSlash("1/dir"), filepath.FromSlash("1/dir/foo"), "2", filepath.FromSlash("2/dir"), filepath.FromSlash("2/dir/bar")}, paths) require.Equal(t, "1", files[0].Name()) require.Equal(t, "dir", files[1].Name()) require.Equal(t, "foo", files[2].Name()) diff --git a/receive_test.go b/receive_test.go index a36d5013..7fc90bbb 100644 --- a/receive_test.go +++ b/receive_test.go @@ -9,6 +9,7 @@ import ( gofs "io/fs" "os" "path/filepath" + "runtime" "sync" "testing" "time" @@ -144,10 +145,10 @@ func TestCopySwitchDirToFile(t *testing.T) { dest, err := tmpDir(changeStream([]string{ "ADD foo dir", - "ADD foo/bar dile data2", + "ADD foo/bar file data2", })) assert.NoError(t, err) - defer os.RemoveAll(d) + defer os.RemoveAll(dest) copy := func(src, dest string) (*changes, error) { ts := newNotificationBuffer() @@ -180,8 +181,13 @@ func TestCopySwitchDirToFile(t *testing.T) { NotifyHashed: chs.HandleChange, ContentHasher: simpleSHA256Hasher, Filter: func(_ string, s *types.Stat) bool { - s.Uid = uint32(os.Getuid()) - s.Gid = uint32(os.Getgid()) + if runtime.GOOS != "windows" { + // On Windows, Getuid() and Getgid() always return -1 + // See: https://pkg.go.dev/os#Getgid + // See: https://pkg.go.dev/os#Geteuid + s.Uid = uint32(os.Getuid()) + s.Gid = uint32(os.Getgid()) + } return true }, }) @@ -206,8 +212,8 @@ func TestCopySwitchDirToFile(t *testing.T) { err = Walk(context.Background(), dest, nil, bufWalk(b)) assert.NoError(t, err) - assert.Equal(t, string(b.Bytes()), `file foo -`) + assert.Equal(t, `file foo +`, b.String()) } func TestCopySimple(t *testing.T) { @@ -253,8 +259,13 @@ func TestCopySimple(t *testing.T) { NotifyHashed: chs.HandleChange, ContentHasher: simpleSHA256Hasher, Filter: func(p string, s *types.Stat) bool { - s.Uid = uint32(os.Getuid()) - s.Gid = uint32(os.Getgid()) + if runtime.GOOS != "windows" { + // On Windows, Getuid() and Getgid() always return -1 + // See: https://pkg.go.dev/os#Getgid + // See: https://pkg.go.dev/os#Geteuid + s.Uid = uint32(os.Getuid()) + s.Gid = uint32(os.Getgid()) + } s.ModTime = tm.UnixNano() return true }, @@ -267,7 +278,18 @@ func TestCopySimple(t *testing.T) { err = Walk(context.Background(), dest, nil, bufWalk(b)) assert.NoError(t, err) - assert.Equal(t, string(b.Bytes()), `file foo + if runtime.GOOS == "windows" { + assert.Equal(t, `file foo +file foo2 +dir zzz +file zzz\aa +dir zzz\bb +dir zzz\bb\cc +symlink:..\..\ zzz\bb\cc\dd +file zzz.aa +`, b.String()) + } else { + assert.Equal(t, `file foo file foo2 dir zzz file zzz/aa @@ -275,7 +297,8 @@ dir zzz/bb dir zzz/bb/cc symlink:../../ zzz/bb/cc/dd file zzz.aa -`) +`, b.String()) + } dt, err := os.ReadFile(filepath.Join(dest, "zzz/aa")) assert.NoError(t, err) @@ -286,24 +309,36 @@ file zzz.aa assert.Equal(t, "dat2", string(dt)) fi, err := os.Stat(filepath.Join(dest, "foo2")) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, tm, fi.ModTime()) - h, ok := ts.Hash("zzz/aa") + h, ok := ts.Hash(filepath.FromSlash("zzz/aa")) assert.True(t, ok) - assert.Equal(t, digest.Digest("sha256:99b6ef96ee0572b5b3a4eb28f00b715d820bfd73836e59cc1565e241f4d1bb2f"), h) + if runtime.GOOS == "windows" { + assert.Equal(t, digest.Digest("sha256:5da6b6a222dca8d9260384da15378d4389f7e16943e812e08c39759b8514b456"), h) + } else { + assert.Equal(t, digest.Digest("sha256:99b6ef96ee0572b5b3a4eb28f00b715d820bfd73836e59cc1565e241f4d1bb2f"), h) + } h, ok = ts.Hash("foo2") assert.True(t, ok) - assert.Equal(t, digest.Digest("sha256:dd2529f7749ba45ea55de3b2e10086d6494cc45a94e57650c2882a6a14b4ff32"), h) + if runtime.GOOS == "windows" { + assert.Equal(t, digest.Digest("sha256:cd83620e5308f6ddb9953a82b2c7450832eac78521dbf067d2882318cabc1311"), h) + } else { + assert.Equal(t, digest.Digest("sha256:dd2529f7749ba45ea55de3b2e10086d6494cc45a94e57650c2882a6a14b4ff32"), h) + } - h, ok = ts.Hash("zzz/bb/cc/dd") + h, ok = ts.Hash(filepath.FromSlash("zzz/bb/cc/dd")) assert.True(t, ok) - assert.Equal(t, digest.Digest("sha256:eca07e8f2d09bd574ea2496312e6de1685ef15b8e6a49a534ed9e722bcac8adc"), h) + if runtime.GOOS == "windows" { + assert.Equal(t, digest.Digest("sha256:47dc68d117ae85dc688103d6ba2cee54caabbbcf606e54ca62fda6a3d9deae19"), h) + } else { + assert.Equal(t, digest.Digest("sha256:eca07e8f2d09bd574ea2496312e6de1685ef15b8e6a49a534ed9e722bcac8adc"), h) + } - k, ok := chs.c["zzz/aa"] - assert.Equal(t, ok, true) - assert.Equal(t, k, ChangeKindAdd) + k, ok := chs.c[filepath.FromSlash("zzz/aa")] + assert.Equal(t, true, ok) + assert.Equal(t, ChangeKindAdd, k) err = os.WriteFile(filepath.Join(d, "zzz/bb/cc/foo"), []byte("data5"), 0600) assert.NoError(t, err) @@ -325,8 +360,13 @@ file zzz.aa NotifyHashed: chs.HandleChange, ContentHasher: simpleSHA256Hasher, Filter: func(_ string, s *types.Stat) bool { - s.Uid = uint32(os.Getuid()) - s.Gid = uint32(os.Getgid()) + if runtime.GOOS != "windows" { + // On Windows, Getuid() and Getgid() always return -1 + // See: https://pkg.go.dev/os#Getgid + // See: https://pkg.go.dev/os#Geteuid + s.Uid = uint32(os.Getuid()) + s.Gid = uint32(os.Getgid()) + } s.ModTime = tm.UnixNano() return true }, @@ -339,7 +379,18 @@ file zzz.aa err = Walk(context.Background(), dest, nil, bufWalk(b)) assert.NoError(t, err) - assert.Equal(t, string(b.Bytes()), `file foo + if runtime.GOOS == "windows" { + assert.Equal(t, `file foo +dir zzz +file zzz\aa +dir zzz\bb +dir zzz\bb\cc +symlink:..\..\ zzz\bb\cc\dd +file zzz\bb\cc\foo +file zzz.aa +`, b.String()) + } else { + assert.Equal(t, `file foo dir zzz file zzz/aa dir zzz/bb @@ -347,36 +398,45 @@ dir zzz/bb/cc symlink:../../ zzz/bb/cc/dd file zzz/bb/cc/foo file zzz.aa -`) +`, b.String()) + } dt, err = os.ReadFile(filepath.Join(dest, "zzz/bb/cc/foo")) assert.NoError(t, err) assert.Equal(t, "data5", string(dt)) - h, ok = ts.Hash("zzz/bb/cc/dd") + h, ok = ts.Hash(filepath.FromSlash("zzz/bb/cc/dd")) assert.True(t, ok) - assert.Equal(t, digest.Digest("sha256:eca07e8f2d09bd574ea2496312e6de1685ef15b8e6a49a534ed9e722bcac8adc"), h) + if runtime.GOOS == "windows" { + assert.Equal(t, digest.Digest("sha256:47dc68d117ae85dc688103d6ba2cee54caabbbcf606e54ca62fda6a3d9deae19"), h) + } else { + assert.Equal(t, digest.Digest("sha256:eca07e8f2d09bd574ea2496312e6de1685ef15b8e6a49a534ed9e722bcac8adc"), h) + } - h, ok = ts.Hash("zzz/bb/cc/foo") + h, ok = ts.Hash(filepath.FromSlash("zzz/bb/cc/foo")) assert.True(t, ok) - assert.Equal(t, digest.Digest("sha256:cd14a931fc2e123ded338093f2864b173eecdee578bba6ec24d0724272326c3a"), h) + if runtime.GOOS == "windows" { + assert.Equal(t, digest.Digest("sha256:9184a7db8d056ee43838613279db9a7ab02272e50d5e20d253393521bb34aa46"), h) + } else { + assert.Equal(t, digest.Digest("sha256:cd14a931fc2e123ded338093f2864b173eecdee578bba6ec24d0724272326c3a"), h) + } _, ok = ts.Hash("foo2") assert.False(t, ok) k, ok = chs.c["foo2"] - assert.Equal(t, ok, true) - assert.Equal(t, k, ChangeKindDelete) + assert.Equal(t, true, ok) + assert.Equal(t, ChangeKindDelete, k) - k, ok = chs.c["zzz/bb/cc/foo"] - assert.Equal(t, ok, true) - assert.Equal(t, k, ChangeKindAdd) + k, ok = chs.c[filepath.FromSlash("zzz/bb/cc/foo")] + assert.Equal(t, true, ok) + assert.Equal(t, ChangeKindAdd, k) - _, ok = chs.c["zzz/aa"] - assert.Equal(t, ok, false) + _, ok = chs.c[filepath.FromSlash("zzz/aa")] + assert.Equal(t, false, ok) _, ok = chs.c["zzz.aa"] - assert.Equal(t, ok, false) + assert.Equal(t, false, ok) } func sockPairProto(ctx context.Context) (Stream, Stream) { @@ -498,8 +558,15 @@ func simpleSHA256Hasher(s *types.Stat) (hash.Hash, error) { // Unlike Linux, on FreeBSD's stat() call returns -1 in st_rdev for regular files ss.Devminor = 0 ss.Devmajor = 0 + if runtime.GOOS == "windows" { + // On Windows, Getuid() and Getgid() always return -1 + // See: https://pkg.go.dev/os#Getgid + // See: https://pkg.go.dev/os#Geteuid + ss.Uid = 0 + ss.Gid = 0 + } - if os.FileMode(ss.Mode)&os.ModeSymlink != 0 { + if os.FileMode(ss.Mode)&os.ModeSymlink != 0 && runtime.GOOS != "windows" { ss.Mode = ss.Mode | 0777 } diff --git a/stat.go b/stat.go index 2ab8da11..44441cb6 100644 --- a/stat.go +++ b/stat.go @@ -19,7 +19,7 @@ func mkstat(path, relpath string, fi os.FileInfo, inodemap map[uint64]string) (* relpath = filepath.ToSlash(relpath) stat := &types.Stat{ - Path: relpath, + Path: filepath.FromSlash(relpath), Mode: uint32(fi.Mode()), ModTime: fi.ModTime().UnixNano(), } diff --git a/validator.go b/validator.go index 9bd7d94d..8b0dd91e 100644 --- a/validator.go +++ b/validator.go @@ -2,8 +2,7 @@ package fsutil import ( "os" - "path" - "runtime" + "path/filepath" "sort" "strings" "syscall" @@ -28,21 +27,18 @@ func (v *Validator) HandleChange(kind ChangeKind, p string, fi os.FileInfo, err if v.parentDirs == nil { v.parentDirs = make([]parent, 1, 10) } - if runtime.GOOS == "windows" { - p = strings.Replace(p, "\\", "", -1) - } - if p != path.Clean(p) { + if p != filepath.Clean(p) { return errors.WithStack(&os.PathError{Path: p, Err: syscall.EINVAL, Op: "unclean path"}) } - if path.IsAbs(p) { + if filepath.IsAbs(p) { return errors.WithStack(&os.PathError{Path: p, Err: syscall.EINVAL, Op: "absolute path"}) } - dir := path.Dir(p) - base := path.Base(p) + dir := filepath.Dir(p) + base := filepath.Base(p) if dir == "." { dir = "" } - if dir == ".." || strings.HasPrefix(p, "../") { + if dir == ".." || strings.HasPrefix(p, filepath.FromSlash("../")) { return errors.WithStack(&os.PathError{Path: p, Err: syscall.EINVAL, Op: "escape check"}) } @@ -56,12 +52,12 @@ func (v *Validator) HandleChange(kind ChangeKind, p string, fi os.FileInfo, err } if dir != v.parentDirs[len(v.parentDirs)-1].dir || v.parentDirs[i].last >= base { - return errors.Errorf("changes out of order: %q %q", p, path.Join(v.parentDirs[i].dir, v.parentDirs[i].last)) + return errors.Errorf("changes out of order: %q %q", p, filepath.Join(v.parentDirs[i].dir, v.parentDirs[i].last)) } v.parentDirs[i].last = base if kind != ChangeKindDelete && fi.IsDir() { v.parentDirs = append(v.parentDirs, parent{ - dir: path.Join(dir, base), + dir: filepath.Join(dir, base), last: "", }) } @@ -76,7 +72,7 @@ func ComparePath(p1, p2 string) int { switch { case p1[i] == p2[i]: continue - case p2[i] != '/' && p1[i] < p2[i] || p1[i] == '/': + case p2[i] != filepath.Separator && p1[i] < p2[i] || p1[i] == filepath.Separator: return -1 default: return 1 diff --git a/validator_test.go b/validator_test.go index aabb0732..b3acf688 100644 --- a/validator_test.go +++ b/validator_test.go @@ -3,6 +3,7 @@ package fsutil import ( "fmt" "os" + "path/filepath" "strings" "testing" @@ -210,7 +211,7 @@ func parseChange(str string) *change { default: panic(errStr) } - c.path = f[1] + c.path = filepath.FromSlash(f[1]) st := &types.Stat{} switch f[2] { case "file": From 3e13e95f2b94dec4bc7c632d5bcb31ff3010b14b Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Wed, 7 Feb 2024 13:25:23 +0100 Subject: [PATCH 17/76] test with coverage and send to codecov Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/ci.yml | 39 ++++++++++++++++++++++++++++++++++----- .gitignore | 6 +----- Dockerfile | 10 ++++++++-- docker-bake.hcl | 10 ++++++++-- 4 files changed, 51 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa86cf6e..e576defe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,9 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +env: + DESTDIR: ./bin + on: schedule: - cron: '0 8 */6 * *' # every 6 days @@ -61,11 +64,14 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go_version: + go: - "1.19" - "1.20" + mode: + - "root" + - "noroot" env: - GO_VERSION: ${{ matrix.go_version }} + GO_VERSION: ${{ matrix.go }} steps: - name: Checkout @@ -77,7 +83,13 @@ jobs: name: Test uses: docker/bake-action@v3 with: - targets: test + targets: test-${{ matrix.mode }} + - + name: Upload coverage + uses: codecov/codecov-action@v4 + with: + directory: ${{ env.DESTDIR }}/coverage + flags: unit,${{ matrix.mode }},go-${{ matrix.go }} test-macos: runs-on: macos-latest @@ -99,7 +111,16 @@ jobs: - name: Test run: | - go test ./... + go test -coverprofile=coverage.txt -covermode=atomic ./... + go tool cover -func=coverage.txt + - + name: Upload coverage + if: always() + uses: codecov/codecov-action@v4 + with: + file: ./coverage.txt + env_vars: RUNNER_OS + flags: unit,go-${{ matrix.go }} test-freebsd-amd64: runs-on: macos-13 @@ -144,4 +165,12 @@ jobs: timeout_minutes: 20 max_attempts: 5 command: | - vagrant ssh -- "cd /vagrant; go test -buildvcs=false ./..." + vagrant ssh -- "cd /vagrant; go test -buildvcs=false -coverprofile=coverage.txt -covermode=atomic ./..." + vagrant ssh -c "sudo cat /vagrant/coverage.txt" > coverage.txt + - + name: Upload coverage + if: always() + uses: codecov/codecov-action@v4 + with: + file: ./coverage.txt + flags: unit,freebsd diff --git a/.gitignore b/.gitignore index 51b9602c..e5c343e2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,5 @@ # if you want to ignore files created by your editor/tools, consider using a # global .gitignore or .git/info/exclude see https://help.github.com/articles/ignoring-files -.* -!.github -!.gitignore -!.travis.yml -*.prof +bin/ # support running go modules in vendor mode for local development vendor/ diff --git a/Dockerfile b/Dockerfile index 9584648d..5fd39502 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,13 +18,19 @@ FROM base AS test ARG TESTFLAGS RUN --mount=target=. --mount=target=/go/pkg/mod,type=cache \ --mount=target=/root/.cache,type=cache \ - CGO_ENABLED=0 xx-go test -test.v ${TESTFLAGS} ./... + CGO_ENABLED=0 xx-go test -v -coverprofile=/tmp/coverage.txt -covermode=atomic ${TESTFLAGS} ./... FROM base AS test-noroot RUN mkdir /go/pkg && chmod 0777 /go/pkg USER 1000:1000 RUN --mount=target=. \ --mount=target=/tmp/.cache,type=cache \ - CGO_ENABLED=0 GOCACHE=/tmp/gocache xx-go test -test.v ./... + CGO_ENABLED=0 GOCACHE=/tmp/gocache xx-go test -v -coverprofile=/tmp/coverage.txt -covermode=atomic ./... + +FROM scratch AS test-coverage +COPY --from=test /tmp/coverage.txt /coverage-root.txt + +FROM scratch AS test-noroot-coverage +COPY --from=test-noroot /tmp/coverage.txt /coverage-noroot.txt FROM build diff --git a/docker-bake.hcl b/docker-bake.hcl index 6ba3c867..7df6d209 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -2,6 +2,10 @@ variable "GO_VERSION" { default = "1.20" } +variable "DESTDIR" { + default = "./bin" +} + group "default" { targets = ["build"] } @@ -18,12 +22,14 @@ group "test" { target "test-root" { inherits = ["build"] - target = "test" + target = "test-coverage" + output = ["${DESTDIR}/coverage"] } target "test-noroot" { inherits = ["build"] - target = "test-noroot" + target = "test-noroot-coverage" + output = ["${DESTDIR}/coverage"] } target "lint" { From e5c2801fc5869a3b54b0e03b3a084b8a9a9df83c Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Mon, 29 Jan 2024 09:35:17 +0100 Subject: [PATCH 18/76] ci: align events Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e576defe..1161cb3c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,10 +13,7 @@ on: push: branches: - master - - gh_test_ci pull_request: - branches: - - master jobs: validate: From 5bc23465dd69d75e2a44751e74a773e9b8ce60ea Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Mon, 29 Jan 2024 09:32:38 +0100 Subject: [PATCH 19/76] readme badges Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- readme.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/readme.md b/readme.md index 5ce685b7..c4171688 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,8 @@ +[![PkgGoDev](https://img.shields.io/badge/go.dev-docs-007d9c?style=flat-square&logo=go&logoColor=white)](https://pkg.go.dev/github.com/tonistiigi/fsutil) +[![CI Status](https://img.shields.io/github/actions/workflow/status/tonistiigi/fsutil/ci.yml?label=ci&logo=github&style=flat-square)](https://github.com/tonistiigi/fsutil/actions?query=workflow%3Aci) +[![Go Report Card](https://goreportcard.com/badge/github.com/tonistiigi/fsutil?style=flat-square)](https://goreportcard.com/report/github.com/tonistiigi/fsutil) +[![Codecov](https://img.shields.io/codecov/c/github/tonistiigi/fsutil?logo=codecov&style=flat-square)](https://codecov.io/gh/tonistiigi/fsutil) + Incremental file directory sync tools in golang. ``` From bf5b720f9d7ca4081234bcffe8645bcc511f8aff Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Thu, 8 Feb 2024 19:20:05 +0100 Subject: [PATCH 20/76] ci: fix test step for windows Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d4280659..9cc301ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -111,8 +111,8 @@ jobs: - name: Test run: | - go test -coverprofile=coverage.txt -covermode=atomic ./... - go tool cover -func=coverage.txt + go test -coverprofile="coverage.txt" -covermode="atomic" ./... + go tool cover -func="coverage.txt" - name: Upload coverage if: always() From fb90e5f3085034f83d84dd315c7bbfe7ec34dbcd Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Mon, 12 Feb 2024 09:51:41 +0100 Subject: [PATCH 21/76] ci: bump actions to latest stable Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/ci.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9cc301ef..49bf7fc7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,13 +27,13 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Run - uses: docker/bake-action@v3 + uses: docker/bake-action@v4 with: targets: ${{ matrix.target }} @@ -47,13 +47,13 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Run - uses: docker/bake-action@v3 + uses: docker/bake-action@v4 with: targets: ${{ matrix.target }} @@ -72,13 +72,13 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Test - uses: docker/bake-action@v3 + uses: docker/bake-action@v4 with: targets: test-${{ matrix.mode }} - @@ -102,10 +102,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} - @@ -129,10 +129,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Cache Vagrant boxes - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.vagrant.d/boxes key: ${{ runner.os }}-vagrant-${{ hashFiles('hack/Vagrantfile.freebsd13') }} @@ -160,7 +160,7 @@ jobs: vagrant up --no-tty - name: Test - uses: nick-fields/retry@14672906e672a08bd6eeb15720e9ed3ce869cdd4 # v2.9.0 + uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0 with: timeout_minutes: 20 max_attempts: 5 From 7f115c28d7f19c9332777087688fdb760352d82c Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Mon, 12 Feb 2024 09:52:01 +0100 Subject: [PATCH 22/76] chore: dependabot to keep gha up to date Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/dependabot.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..8d77e584 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + open-pull-requests-limit: 10 + directory: "/" + schedule: + interval: "daily" + labels: + - "dependencies" + - "bot" From cb7e6e613e8f25020d4a97cf3d2428dbbc40dd08 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Mon, 12 Feb 2024 09:38:32 +0100 Subject: [PATCH 23/76] update to go 1.21 Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/ci.yml | 4 ++-- Dockerfile | 5 +++-- bench/go.mod | 2 +- docker-bake.hcl | 2 +- go.mod | 2 +- hack/Vagrantfile.freebsd13 | 3 ++- hack/dockerfiles/gomod.Dockerfile | 3 ++- hack/dockerfiles/lint.Dockerfile | 3 ++- 8 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9cc301ef..b239d2c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,7 +62,7 @@ jobs: strategy: matrix: go: - - "1.19" + - "1.21" - "1.20" mode: - "root" @@ -97,7 +97,7 @@ jobs: - macos-latest - windows-latest go: - - "1.19" + - "1.21" - "1.20" steps: - diff --git a/Dockerfile b/Dockerfile index 5fd39502..b7eecd20 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ -#syntax=docker/dockerfile:1 -ARG GO_VERSION=1.20 +# syntax=docker/dockerfile:1 + +ARG GO_VERSION=1.21 FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.1.0 AS xx diff --git a/bench/go.mod b/bench/go.mod index 6ca11879..805f3a38 100644 --- a/bench/go.mod +++ b/bench/go.mod @@ -1,6 +1,6 @@ module github.com/tonistiigi/fsutil/bench -go 1.19 +go 1.20 require ( github.com/containerd/continuity v0.4.1 diff --git a/docker-bake.hcl b/docker-bake.hcl index 7df6d209..48127d4f 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -1,5 +1,5 @@ variable "GO_VERSION" { - default = "1.20" + default = null } variable "DESTDIR" { diff --git a/go.mod b/go.mod index 3dceea97..93977f05 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/tonistiigi/fsutil -go 1.19 +go 1.20 require ( github.com/Microsoft/go-winio v0.5.2 diff --git a/hack/Vagrantfile.freebsd13 b/hack/Vagrantfile.freebsd13 index 7885e148..9cd7e062 100644 --- a/hack/Vagrantfile.freebsd13 +++ b/hack/Vagrantfile.freebsd13 @@ -13,7 +13,8 @@ Vagrant.configure("2") do |config| config.vm.provision "init", type: "shell", run: "once" do |sh| sh.inline = <<~SHELL pkg bootstrap - pkg install -y go + pkg install -y go121 + ln -s /usr/local/bin/go121 /usr/local/bin/go SHELL end end diff --git a/hack/dockerfiles/gomod.Dockerfile b/hack/dockerfiles/gomod.Dockerfile index a7c5101c..d9f1d6d9 100644 --- a/hack/dockerfiles/gomod.Dockerfile +++ b/hack/dockerfiles/gomod.Dockerfile @@ -1,5 +1,6 @@ # syntax=docker/dockerfile:1 -ARG GO_VERSION=1.20 + +ARG GO_VERSION=1.21 FROM golang:${GO_VERSION}-alpine AS gomod RUN apk add --no-cache git diff --git a/hack/dockerfiles/lint.Dockerfile b/hack/dockerfiles/lint.Dockerfile index 2561db30..74acfb44 100644 --- a/hack/dockerfiles/lint.Dockerfile +++ b/hack/dockerfiles/lint.Dockerfile @@ -1,5 +1,6 @@ # syntax=docker/dockerfile:1 -ARG GO_VERSION=1.20 + +ARG GO_VERSION=1.21 FROM golang:${GO_VERSION}-alpine RUN apk add --no-cache git gcc musl-dev From 59183f0692f27fe2b30bc8aec517f2911ebdb343 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Mon, 12 Feb 2024 09:41:28 +0100 Subject: [PATCH 24/76] update golangci-lint to 1.54.2 also update config to show all issues at once and set linter setting for io/ioutil. Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .golangci.yml | 14 ++++++++++++++ hack/dockerfiles/lint.Dockerfile | 11 ++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 2a8b86ae..7300a0e5 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -14,3 +14,17 @@ linters: - staticcheck - typecheck disable-all: true + +linters-settings: + depguard: + rules: + main: + deny: + # The io/ioutil package has been deprecated. + # https://go.dev/doc/go1.16#ioutil + - pkg: "io/ioutil" + desc: The io/ioutil package has been deprecated. + +# show all +max-issues-per-linter: 0 +max-same-issues: 0 diff --git a/hack/dockerfiles/lint.Dockerfile b/hack/dockerfiles/lint.Dockerfile index 74acfb44..d6d173dc 100644 --- a/hack/dockerfiles/lint.Dockerfile +++ b/hack/dockerfiles/lint.Dockerfile @@ -1,10 +1,15 @@ # syntax=docker/dockerfile:1 ARG GO_VERSION=1.21 +ARG GOLANGCI_LINT_VERSION=1.54.2 FROM golang:${GO_VERSION}-alpine RUN apk add --no-cache git gcc musl-dev -RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.53.3 +ENV GOFLAGS="-buildvcs=false" +ARG GOLANGCI_LINT_VERSION +RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v${GOLANGCI_LINT_VERSION} WORKDIR /go/src/github.com/tonistiigi/fsutil -RUN --mount=target=/go/src/github.com/tonistiigi/fsutil --mount=target=/root/.cache,type=cache --mount=target=/go/pkg/mod,type=cache \ - golangci-lint run +RUN --mount=target=. \ + --mount=target=/root/.cache,type=cache \ + --mount=target=/go/pkg/mod,type=cache \ + golangci-lint run From ca0190e3595a6a79a23ac3c78ef1ac6431feb5e3 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Mon, 12 Feb 2024 09:45:24 +0100 Subject: [PATCH 25/76] dockerfile: update xx to 1.4.0 Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b7eecd20..21c1f39f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,9 @@ # syntax=docker/dockerfile:1 ARG GO_VERSION=1.21 +ARG XX_VERSION=1.4.0 -FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.1.0 AS xx +FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS base RUN apk add --no-cache git From ab7803b639a56f5ac412021489215886fc54f5b6 Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Mon, 19 Feb 2024 13:58:50 +0000 Subject: [PATCH 26/76] filter: allow SkipDir return with lazy parents When using include/exclude options in a file walk, we lazily store the parents, and only later call the target function with them when we find a file inside. This handles the case where `**/*.go` should only walk directories that contain `.go` files, and not every directory in the tree. However, when storing lazy parents, we weren't appropriately handling the `SkipDir` value that could be returned. We were making two incorrect assumptions: 1. An error value from `fn()` was always an error case - this isn't true, since we have control error values like `SkipDir`. Because of this, we need to ensure that `calledFn` is *always* set to true when calling `fn` (even in an error case). 2. We can return `SkipDir` to skip this parent directory. This isn't *quite* right, since returning `SkipDir` would return it only for the child directory - we need to make sure it's called everytime for each child directory of this parent directory, by storing it as a boolean `skipFn` field. With these changes, the new test passes, and we don't end up with duplicate parent calls, as was happening before: Error: Not equal: expected: []string{"foo"} actual : []string{"foo", "foo"} Signed-off-by: Justin Chadwell --- filter.go | 11 +++++++++-- filter_test.go | 24 ++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/filter.go b/filter.go index 5257c285..989dd178 100644 --- a/filter.go +++ b/filter.go @@ -176,6 +176,7 @@ func (fs *filterFS) Walk(ctx context.Context, target string, fn gofs.WalkDirFunc includeMatchInfo patternmatcher.MatchInfo excludeMatchInfo patternmatcher.MatchInfo calledFn bool + skipFn bool } // used only for include/exclude handling @@ -333,6 +334,9 @@ func (fs *filterFS) Walk(ctx context.Context, target string, fn gofs.WalkDirFunc } } for i, parentDir := range parentDirs { + if parentDir.skipFn { + return filepath.SkipDir + } if parentDir.calledFn { continue } @@ -357,10 +361,13 @@ func (fs *filterFS) Walk(ctx context.Context, target string, fn gofs.WalkDirFunc } } - if err := fn(parentStat.Path, &DirEntryInfo{Stat: parentStat}, nil); err != nil { + parentDirs[i].calledFn = true + if err := fn(parentStat.Path, &DirEntryInfo{Stat: parentStat}, nil); err == filepath.SkipDir { + parentDirs[i].skipFn = true + return filepath.SkipDir + } else if err != nil { return err } - parentDirs[i].calledFn = true } if err := fn(stat.Path, &DirEntryInfo{Stat: stat}, nil); err != nil { return err diff --git a/filter_test.go b/filter_test.go index 2e0619be..d3231675 100644 --- a/filter_test.go +++ b/filter_test.go @@ -143,6 +143,30 @@ file bar/foo `), b.String()) } +func TestWalkerIncludeReturnSkipDir(t *testing.T) { + d, err := tmpDir(changeStream([]string{ + "ADD foo dir", + "ADD foo/x dir", + "ADD foo/y dir", + "ADD foo/x/a.txt file", + "ADD foo/y/b.txt file", + })) + assert.NoError(t, err) + defer os.RemoveAll(d) + + found := []string{} + + err = Walk(context.Background(), d, &FilterOpt{ + IncludePatterns: []string{"**/*.txt"}, + }, func(path string, info gofs.FileInfo, err error) error { + found = append(found, path) + return filepath.SkipDir + }) + assert.NoError(t, err) + + assert.Equal(t, []string{"foo"}, found) +} + func TestWalkerExclude(t *testing.T) { d, err := tmpDir(changeStream([]string{ "ADD bar file", From d9cfebb97482769495b38d8e14920a4b79b17c95 Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Mon, 19 Feb 2024 14:12:50 +0000 Subject: [PATCH 27/76] filter: ensure MapResult is followed for parent directories Similar to the previous commit, we weren't properly respecting MapResult return values for parent directories. To resolve this, we just store into `skipFn` just like previously, and return `SkipDir` instead of `continue`ing on. After these changes, the new test passes, and we don't end up including entries that were in excluded directories, as was happening before: Error: Not equal: expected: "dir y\nfile y/b.txt\n" actual : "file x/a.txt\ndir y\nfile y/b.txt\n" Signed-off-by: Justin Chadwell --- filter.go | 5 ++++- filter_test.go | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/filter.go b/filter.go index 989dd178..9cee8ad2 100644 --- a/filter.go +++ b/filter.go @@ -356,8 +356,11 @@ func (fs *filterFS) Walk(ctx context.Context, target string, fn gofs.WalkDirFunc } if fs.mapFn != nil { result := fs.mapFn(parentStat.Path, parentStat) - if result == MapResultSkipDir || result == MapResultExclude { + if result == MapResultExclude { continue + } else if result == MapResultSkipDir { + parentDirs[i].skipFn = true + return filepath.SkipDir } } diff --git a/filter_test.go b/filter_test.go index d3231675..406425da 100644 --- a/filter_test.go +++ b/filter_test.go @@ -332,6 +332,33 @@ file includeDir/a.txt assert.Equal(t, []string{"excludeDir", "includeDir", filepath.FromSlash("includeDir/a.txt")}, walked) } +func TestWalkerMapSkipDirWithPattern(t *testing.T) { + d, err := tmpDir(changeStream([]string{ + "ADD x dir", + "ADD x/a.txt file", + "ADD y dir", + "ADD y/b.txt file", + })) + assert.NoError(t, err) + defer os.RemoveAll(d) + + b := &bytes.Buffer{} + err = Walk(context.Background(), d, &FilterOpt{ + IncludePatterns: []string{"**/*.txt"}, + Map: func(_ string, s *types.Stat) MapResult { + if filepath.Base(s.Path) == "x" { + return MapResultSkipDir + } + return MapResultKeep + }, + }, bufWalk(b)) + assert.NoError(t, err) + + assert.Equal(t, filepath.FromSlash(`dir y +file y/b.txt +`), b.String()) +} + func TestWalkerPermissionDenied(t *testing.T) { if runtime.GOOS == "windows" { t.Skip("os.Chmod not fully supported on Windows") From b98da8a0b4f2b621dde34d246bd768b8e051c80e Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Tue, 20 Feb 2024 15:12:15 +0100 Subject: [PATCH 28/76] chore: codecov config Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- codecov.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 codecov.yml diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..f5f9e02c --- /dev/null +++ b/codecov.yml @@ -0,0 +1,12 @@ +comment: false + +coverage: + status: + project: # settings affecting project coverage + default: + target: auto # auto % coverage target + threshold: 1% # allow for 1% reduction of coverage without failing + patch: off + +github_checks: + annotations: false From 34ca0de8fac74238a2922904292e86f98888739c Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Tue, 20 Feb 2024 15:13:31 +0100 Subject: [PATCH 29/76] ci: set codecov token Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b239d2c1..850b7e95 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,6 +87,7 @@ jobs: with: directory: ${{ env.DESTDIR }}/coverage flags: unit,${{ matrix.mode }},go-${{ matrix.go }} + token: ${{ secrets.CODECOV_TOKEN }} test-os: runs-on: ${{ matrix.os }} @@ -121,6 +122,7 @@ jobs: file: ./coverage.txt env_vars: RUNNER_OS flags: unit,go-${{ matrix.go }} + token: ${{ secrets.CODECOV_TOKEN }} test-freebsd-amd64: runs-on: macos-13 @@ -174,3 +176,4 @@ jobs: with: file: ./coverage.txt flags: unit,freebsd + token: ${{ secrets.CODECOV_TOKEN }} From 757927127c1bf10348e3c4264e09e858c66da236 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Fri, 23 Feb 2024 17:23:09 +0100 Subject: [PATCH 30/76] ci: set workflow_dispatch event this is for manual testing from a fork Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b239d2c1..3477ee56 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,7 @@ env: DESTDIR: ./bin on: + workflow_dispatch: schedule: - cron: '0 8 */6 * *' # every 6 days push: From 3092598e76277544baa64f8d501a8b475e88a6ba Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Fri, 23 Feb 2024 19:11:28 +0100 Subject: [PATCH 31/76] send: ensure file path to unix form when sending files Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- send.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/send.go b/send.go index a044d04d..6a935ed0 100644 --- a/send.go +++ b/send.go @@ -4,6 +4,7 @@ import ( "context" "io" "os" + "path/filepath" "sync" "syscall" @@ -156,7 +157,7 @@ func (s *sender) walk(ctx context.Context) error { if !ok { return errors.WithStack(&os.PathError{Path: path, Err: syscall.EBADMSG, Op: "fileinfo without stat info"}) } - + stat.Path = filepath.ToSlash(stat.Path) p := &types.Packet{ Type: types.PACKET_STAT, Stat: stat, From 216a08f9487cab4ba35e1c1c598ac3852f6ad3b4 Mon Sep 17 00:00:00 2001 From: Alex Couture-Beil Date: Mon, 10 Jul 2023 16:16:06 -0700 Subject: [PATCH 32/76] fix data race in progressCb Fixes a silly data race where progressCurrent is incremented (and later accessed) by 1 of 4 threads. Signed-off-by: Alex Couture-Beil --- receive_test.go | 8 +++++++- send.go | 17 ++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/receive_test.go b/receive_test.go index 7fc90bbb..fdd69a14 100644 --- a/receive_test.go +++ b/receive_test.go @@ -250,9 +250,14 @@ func TestCopySimple(t *testing.T) { tm := time.Now().Truncate(time.Hour) + var processCbWasCalled bool + progressCb := func(size int, last bool) { + processCbWasCalled = true + } + eg.Go(func() error { defer s1.(*fakeConnProto).closeSend() - return Send(ctx, s1, fs, nil) + return Send(ctx, s1, fs, progressCb) }) eg.Go(func() error { return Receive(ctx, s2, dest, ReceiveOpt{ @@ -273,6 +278,7 @@ func TestCopySimple(t *testing.T) { }) assert.NoError(t, eg.Wait()) + assert.True(t, processCbWasCalled) b := &bytes.Buffer{} err = Walk(context.Background(), dest, nil, bufWalk(b)) diff --git a/send.go b/send.go index 6a935ed0..ba97ef7a 100644 --- a/send.go +++ b/send.go @@ -43,13 +43,14 @@ type sendHandle struct { } type sender struct { - conn Stream - fs FS - files map[uint32]string - mu sync.RWMutex - progressCb func(int, bool) - progressCurrent int - sendpipeline chan *sendHandle + conn Stream + fs FS + files map[uint32]string + mu sync.RWMutex + progressCb func(int, bool) + progressCurrent int + progressCurrentMu sync.Mutex + sendpipeline chan *sendHandle } func (s *sender) run(ctx context.Context) error { @@ -112,6 +113,8 @@ func (s *sender) run(ctx context.Context) error { func (s *sender) updateProgress(size int, last bool) { if s.progressCb != nil { + s.progressCurrentMu.Lock() + defer s.progressCurrentMu.Unlock() s.progressCurrent += size s.progressCb(s.progressCurrent, last) } From 78f10b41c9aa8a5a90858c47a44d3c73818df28f Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Wed, 3 Apr 2024 15:22:22 +0100 Subject: [PATCH 33/76] receive: ensure callback errors are propagated Previously, it was possible for errors returned by an asyncronous callback function to not be propagated, and to instead return "context canceled" from `Receive`. This could happen based on this specific sequence of events: - An asyncronous callback is called from `HandleChange`, and returns an error, completing the async errorgroup context with an error state. - Another call to `HandleChange` completes, and uses the context syncronously, returning `context.Canceled`. - This in turn propagates to `doubleWalkDiff`, which returns the canceled error, instead of calling `Wait` which would contain the actual error group error. This behavior is racy, based on exactly how and when the asyncronous callback is called. The fix to this is relatively straightforward: we just need to make sure that syncronous and asyncronous function calls are kept separate, and don't reuse the same context. This means that a failure in an async callback, doesn't cause later sync ones to fail. Signed-off-by: Justin Chadwell --- diskwriter.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/diskwriter.go b/diskwriter.go index 10b60851..86ecb489 100644 --- a/diskwriter.go +++ b/diskwriter.go @@ -37,6 +37,7 @@ type DiskWriter struct { ctx context.Context cancel func() eg *errgroup.Group + egCtx context.Context filter FilterFunc dirModTimes map[string]int64 } @@ -50,13 +51,14 @@ func NewDiskWriter(ctx context.Context, dest string, opt DiskWriterOpt) (*DiskWr } ctx, cancel := context.WithCancel(ctx) - eg, ctx := errgroup.WithContext(ctx) + eg, egCtx := errgroup.WithContext(ctx) return &DiskWriter{ opt: opt, dest: dest, eg: eg, ctx: ctx, + egCtx: egCtx, cancel: cancel, filter: opt.Filter, dirModTimes: map[string]int64{}, @@ -188,7 +190,7 @@ func (dw *DiskWriter) HandleChange(kind ChangeKind, p string, fi os.FileInfo, er return errors.Wrapf(err, "failed to create %s", newPath) } if dw.opt.SyncDataCb != nil { - if err := dw.processChange(ChangeKindAdd, p, fi, file); err != nil { + if err := dw.processChange(dw.ctx, ChangeKindAdd, p, fi, file); err != nil { file.Close() return err } @@ -219,7 +221,7 @@ func (dw *DiskWriter) HandleChange(kind ChangeKind, p string, fi os.FileInfo, er dw.requestAsyncFileData(p, destPath, fi, &statCopy) } } else { - return dw.processChange(kind, p, fi, nil) + return dw.processChange(dw.ctx, kind, p, fi, nil) } return nil @@ -228,7 +230,7 @@ func (dw *DiskWriter) HandleChange(kind ChangeKind, p string, fi os.FileInfo, er func (dw *DiskWriter) requestAsyncFileData(p, dest string, fi os.FileInfo, st *types.Stat) { // todo: limit worker threads dw.eg.Go(func() error { - if err := dw.processChange(ChangeKindAdd, p, fi, &lazyFileWriter{ + if err := dw.processChange(dw.egCtx, ChangeKindAdd, p, fi, &lazyFileWriter{ dest: dest, }); err != nil { return err @@ -237,7 +239,7 @@ func (dw *DiskWriter) requestAsyncFileData(p, dest string, fi os.FileInfo, st *t }) } -func (dw *DiskWriter) processChange(kind ChangeKind, p string, fi os.FileInfo, w io.WriteCloser) error { +func (dw *DiskWriter) processChange(ctx context.Context, kind ChangeKind, p string, fi os.FileInfo, w io.WriteCloser) error { origw := w var hw *hashedWriter if dw.opt.NotifyCb != nil { @@ -252,7 +254,7 @@ func (dw *DiskWriter) processChange(kind ChangeKind, p string, fi os.FileInfo, w if fn == nil && dw.opt.AsyncDataCb != nil { fn = dw.opt.AsyncDataCb } - if err := fn(dw.ctx, p, w); err != nil { + if err := fn(ctx, p, w); err != nil { return err } } else { From e71925329f0fefc13ca47b0feab2b668b85bc6ff Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Mon, 15 Apr 2024 16:12:01 +0100 Subject: [PATCH 34/76] receive: translate unix-paths off the wire to native Then, inside all our validations, and our double walking, we don't have to worry about translating between different path formats. Additionally, we ensure that all received paths can be represented on the target host system. A path like `foo/bar\baz` can only be stored on linux (a dir with `foo`, containing a file `bar\baz`). On windows, this would later be interpreted to be `foo\bar\baz` (a dir with `foo`, containing a dir `bar`, containing a file `baz`). Signed-off-by: Justin Chadwell --- diff_containerd.go | 2 +- diskwriter.go | 2 +- receive.go | 14 +++++++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/diff_containerd.go b/diff_containerd.go index 84fdc89d..86d64602 100644 --- a/diff_containerd.go +++ b/diff_containerd.go @@ -111,7 +111,7 @@ func doubleWalkDiff(ctx context.Context, changeFn ChangeFunc, a, b walkerFn, fil if filter != nil { filter(f2.path, &statCopy) } - f2copy = ¤tPath{path: filepath.FromSlash(f2.path), stat: &statCopy} + f2copy = ¤tPath{path: f2.path, stat: &statCopy} } k, p := pathChange(f1, f2copy) switch k { diff --git a/diskwriter.go b/diskwriter.go index 10b60851..36155725 100644 --- a/diskwriter.go +++ b/diskwriter.go @@ -98,7 +98,7 @@ func (dw *DiskWriter) HandleChange(kind ChangeKind, p string, fi os.FileInfo, er } }() - destPath := filepath.Join(dw.dest, filepath.FromSlash(p)) + destPath := filepath.Join(dw.dest, p) if kind == ChangeKindDelete { if dw.filter != nil { diff --git a/receive.go b/receive.go index 209d1d2f..3a42dfc0 100644 --- a/receive.go +++ b/receive.go @@ -4,7 +4,9 @@ import ( "context" "io" "os" + "path/filepath" "sync" + "syscall" "github.com/pkg/errors" "github.com/tonistiigi/fsutil/types" @@ -184,13 +186,23 @@ func (r *receiver) run(ctx context.Context) error { } break } + + // normalize unix wire-specific paths to platform-specific paths + path := filepath.FromSlash(p.Stat.Path) + if filepath.ToSlash(path) != p.Stat.Path { + // e.g. a linux path foo/bar\baz cannot be represented on windows + return errors.WithStack(&os.PathError{Path: p.Stat.Path, Err: syscall.EINVAL, Op: "unrepresentable path"}) + } + p.Stat.Path = path + if fileCanRequestData(os.FileMode(p.Stat.Mode)) { r.mu.Lock() r.files[p.Stat.Path] = i r.mu.Unlock() } i++ - cp := ¤tPath{path: p.Stat.Path, stat: p.Stat} + + cp := ¤tPath{path: path, stat: p.Stat} if err := r.orderValidator.HandleChange(ChangeKindAdd, cp.path, &StatInfo{cp.stat}, nil); err != nil { return err } From 86c9caf572e59c50eaaf9c1dc085378a8901340d Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Mon, 15 Apr 2024 16:17:37 +0100 Subject: [PATCH 35/76] chore: remove old windows todo comments Signed-off-by: Justin Chadwell --- diskwriter.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/diskwriter.go b/diskwriter.go index 36155725..6e9710ac 100644 --- a/diskwriter.go +++ b/diskwriter.go @@ -183,7 +183,7 @@ func (dw *DiskWriter) HandleChange(kind ChangeKind, p string, fi os.FileInfo, er } default: isRegularFile = true - file, err := os.OpenFile(newPath, os.O_CREATE|os.O_WRONLY, fi.Mode()) //todo: windows + file, err := os.OpenFile(newPath, os.O_CREATE|os.O_WRONLY, fi.Mode()) if err != nil { return errors.Wrapf(err, "failed to create %s", newPath) } @@ -313,7 +313,7 @@ type lazyFileWriter struct { func (lfw *lazyFileWriter) Write(dt []byte) (int, error) { if lfw.f == nil { - file, err := os.OpenFile(lfw.dest, os.O_WRONLY, 0) //todo: windows + file, err := os.OpenFile(lfw.dest, os.O_WRONLY, 0) if os.IsPermission(err) { // retry after chmod fi, er := os.Stat(lfw.dest) From 423880fb4055585a0f71731fbed2f1e38fba11c5 Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Tue, 16 Apr 2024 12:21:32 +0100 Subject: [PATCH 36/76] chore: add fsutil protocol description Signed-off-by: Justin Chadwell --- receive.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/receive.go b/receive.go index 3a42dfc0..2be245d7 100644 --- a/receive.go +++ b/receive.go @@ -1,3 +1,33 @@ +// send.go and receive.go describe the fsutil file-transfer protocol, which +// allows transferring file trees across a network connection. +// +// The protocol operates as follows: +// - The client (the receiver) connects to the server (the sender). +// - The sender walks the target tree lexicographically and sends a series of +// STAT packets that describe each file (an empty stat indicates EOF). +// - The receiver sends a REQ packet for each file it requires the contents for, +// using the ID for the file (determined as its index in the STAT sequence). +// - The sender sends a DATA packet with byte arrays for the contents of the +// file, associated with an ID (an empty array indicates EOF). +// - Once the receiver has received all files it wants, it sends a FIN packet, +// and the file transfer is complete. +// If an error is encountered on either side, an ERR packet is sent containing +// a human-readable error. +// +// All paths transferred over the protocol are normalized to unix-style paths, +// regardless of which platforms are present on either side. These path +// conversions are performed right before sending a STAT packet (for the +// sender) or right after receiving the corresponding STAT packet (for the +// receiver); this abstraction doesn't leak into the rest of fsutil, which +// operates on native platform-specific paths. +// +// Note that in the case of cross-platform file transfers, the transfer is +// best-effort. Some filenames that are valid on a unix sender would not be +// valid on a windows receiver, so these paths are rejected as they are +// received. Additionally, file metadata, like user/group owners and xattrs do +// not have an exact correspondence on windows, and so would be discarded by +// a windows receiver. + package fsutil import ( From 0c628a73427a72c903a9c616f87a48b56ee715ad Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Thu, 18 Apr 2024 17:01:18 +0100 Subject: [PATCH 37/76] recv: translate linkname to wire format Signed-off-by: Justin Chadwell --- receive.go | 1 + send.go | 1 + 2 files changed, 2 insertions(+) diff --git a/receive.go b/receive.go index 2be245d7..6a82d205 100644 --- a/receive.go +++ b/receive.go @@ -224,6 +224,7 @@ func (r *receiver) run(ctx context.Context) error { return errors.WithStack(&os.PathError{Path: p.Stat.Path, Err: syscall.EINVAL, Op: "unrepresentable path"}) } p.Stat.Path = path + p.Stat.Linkname = filepath.FromSlash(p.Stat.Linkname) if fileCanRequestData(os.FileMode(p.Stat.Mode)) { r.mu.Lock() diff --git a/send.go b/send.go index ba97ef7a..43bf1717 100644 --- a/send.go +++ b/send.go @@ -161,6 +161,7 @@ func (s *sender) walk(ctx context.Context) error { return errors.WithStack(&os.PathError{Path: path, Err: syscall.EBADMSG, Op: "fileinfo without stat info"}) } stat.Path = filepath.ToSlash(stat.Path) + stat.Linkname = filepath.ToSlash(stat.Linkname) p := &types.Packet{ Type: types.PACKET_STAT, Stat: stat, From 16fccd4daeb2a041a8729e72637e3483f349d91b Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Fri, 19 Apr 2024 16:25:41 -0700 Subject: [PATCH 38/76] fix hardlink filter regression With the refactor to FilterFS the hardlink handling was changed so that the hardlink detection is in a separate FS instance and then FilterFS is layered on top of it. This means that the file that was the source for the hardlink could be filtered out, but the Stat pointing to that link is still sent as is. New function validates if source files are not present in FS anymore and correct the linking. It could be better if all the FS implementation did this automatically, but there is quite a lot of layering going on atm. with multiple layers of FilterFS that would all need to keep own hardlink memory, so atm. the new function is only called before send. Signed-off-by: Tonis Tiigi --- hardlinks.go | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ receive_test.go | 66 +++++++++++++++++++++++++++++++++++++++++++++++ send.go | 2 +- 3 files changed, 135 insertions(+), 1 deletion(-) diff --git a/hardlinks.go b/hardlinks.go index ef8bbfb5..d9bf2fc1 100644 --- a/hardlinks.go +++ b/hardlinks.go @@ -1,6 +1,9 @@ package fsutil import ( + "context" + "io" + gofs "io/fs" "os" "syscall" @@ -46,3 +49,68 @@ func (v *Hardlinks) HandleChange(kind ChangeKind, p string, fi os.FileInfo, err return nil } + +// WithHardlinkReset returns a FS that fixes hardlinks for FS that has been filtered +// so that original hardlink sources might be missing +func WithHardlinkReset(fs FS) FS { + return &hardlinkFilter{fs: fs} +} + +type hardlinkFilter struct { + fs FS +} + +var _ FS = &hardlinkFilter{} + +func (r *hardlinkFilter) Walk(ctx context.Context, target string, fn gofs.WalkDirFunc) error { + seenFiles := make(map[string]string) + return r.fs.Walk(ctx, target, func(path string, entry gofs.DirEntry, err error) error { + if err != nil { + return err + } + + fi, err := entry.Info() + if err != nil { + return err + } + + if fi.IsDir() || fi.Mode()&os.ModeSymlink != 0 { + return fn(path, entry, nil) + } + + stat, ok := fi.Sys().(*types.Stat) + if !ok { + return errors.WithStack(&os.PathError{Path: path, Err: syscall.EBADMSG, Op: "fileinfo without stat info"}) + } + + if stat.Linkname != "" { + if v, ok := seenFiles[stat.Linkname]; !ok { + seenFiles[stat.Linkname] = stat.Path + stat.Linkname = "" + entry = &dirEntryWithStat{DirEntry: entry, stat: stat} + } else { + if v != stat.Path { + stat.Linkname = v + entry = &dirEntryWithStat{DirEntry: entry, stat: stat} + } + } + } + + seenFiles[path] = stat.Path + + return fn(path, entry, nil) + }) +} + +func (r *hardlinkFilter) Open(p string) (io.ReadCloser, error) { + return r.fs.Open(p) +} + +type dirEntryWithStat struct { + gofs.DirEntry + stat *types.Stat +} + +func (d *dirEntryWithStat) Info() (gofs.FileInfo, error) { + return &StatInfo{d.stat}, nil +} diff --git a/receive_test.go b/receive_test.go index fdd69a14..d6988d81 100644 --- a/receive_test.go +++ b/receive_test.go @@ -216,6 +216,72 @@ func TestCopySwitchDirToFile(t *testing.T) { `, b.String()) } +func TestHardlinkFilter(t *testing.T) { + d, err := tmpDir(changeStream([]string{ + "ADD bar file data1", + "ADD foo file >bar", + "ADD foo2 file >bar", + })) + assert.NoError(t, err) + defer os.RemoveAll(d) + + assert.NoError(t, err) + defer os.RemoveAll(d) + fs, err := NewFS(d) + assert.NoError(t, err) + fs, err = NewFilterFS(fs, &FilterOpt{}) + assert.NoError(t, err) + fs, err = NewFilterFS(fs, &FilterOpt{ + IncludePatterns: []string{"foo*"}, + Map: func(_ string, s *types.Stat) MapResult { + s.Uid = 0 + s.Gid = 0 + return MapResultKeep + }, + }) + assert.NoError(t, err) + + dest := t.TempDir() + + eg, ctx := errgroup.WithContext(context.Background()) + s1, s2 := sockPairProto(ctx) + + eg.Go(func() error { + defer s1.(*fakeConnProto).closeSend() + return Send(ctx, s1, fs, nil) + }) + eg.Go(func() error { + return Receive(ctx, s2, dest, ReceiveOpt{ + Filter: func(p string, s *types.Stat) bool { + if p == "foo2" { + require.Equal(t, "foo", s.Linkname) + } + if runtime.GOOS != "windows" { + // On Windows, Getuid() and Getgid() always return -1 + // See: https://pkg.go.dev/os#Getgid + // See: https://pkg.go.dev/os#Geteuid + s.Uid = uint32(os.Getuid()) + s.Gid = uint32(os.Getgid()) + } + return true + }, + }) + }) + assert.NoError(t, eg.Wait()) + + dt, err := os.ReadFile(filepath.Join(dest, "foo")) + assert.NoError(t, err) + assert.Equal(t, "data1", string(dt)) + + st1, err := os.Stat(filepath.Join(dest, "foo")) + assert.NoError(t, err) + + st2, err := os.Stat(filepath.Join(dest, "foo2")) + assert.NoError(t, err) + + assert.True(t, os.SameFile(st1, st2)) +} + func TestCopySimple(t *testing.T) { d, err := tmpDir(changeStream([]string{ "ADD foo file data1", diff --git a/send.go b/send.go index 43bf1717..e4a31563 100644 --- a/send.go +++ b/send.go @@ -29,7 +29,7 @@ type Stream interface { func Send(ctx context.Context, conn Stream, fs FS, progressCb func(int, bool)) error { s := &sender{ conn: &syncStream{Stream: conn}, - fs: fs, + fs: WithHardlinkReset(fs), files: make(map[uint32]string), progressCb: progressCb, sendpipeline: make(chan *sendHandle, 128), From e89f52ec18a3adb25ba253c884dae64e1dc8c52d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Jun 2024 00:02:59 +0000 Subject: [PATCH 39/76] chore(deps): Bump docker/bake-action from 4 to 5 Bumps [docker/bake-action](https://github.com/docker/bake-action) from 4 to 5. - [Release notes](https://github.com/docker/bake-action/releases) - [Commits](https://github.com/docker/bake-action/compare/v4...v5) --- updated-dependencies: - dependency-name: docker/bake-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f7895f0..a16907a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Run - uses: docker/bake-action@v4 + uses: docker/bake-action@v5 with: targets: ${{ matrix.target }} @@ -54,7 +54,7 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Run - uses: docker/bake-action@v4 + uses: docker/bake-action@v5 with: targets: ${{ matrix.target }} @@ -79,7 +79,7 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Test - uses: docker/bake-action@v4 + uses: docker/bake-action@v5 with: targets: test-${{ matrix.mode }} - From a6d502a5c1271a478af412af9c7c1d70d326da85 Mon Sep 17 00:00:00 2001 From: Nilesh Patra Date: Sun, 18 Aug 2024 22:57:42 +0530 Subject: [PATCH 40/76] Fixup fallout with new FS changed API --- bench/diffcopy.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bench/diffcopy.go b/bench/diffcopy.go index b9de12cd..ea1011d6 100644 --- a/bench/diffcopy.go +++ b/bench/diffcopy.go @@ -21,7 +21,11 @@ func diffCopy(proto bool, src, dest string) error { } eg.Go(func() error { - return fsutil.Send(ctx, s1, fsutil.NewFS(src, nil), nil) + fs, err := fsutil.NewFS(src) + if err != nil { + panic(err) + } + return fsutil.Send(ctx, s1, fs, nil) }) eg.Go(func() error { return fsutil.Receive(ctx, s2, dest, fsutil.ReceiveOpt{}) From 43c756668f9c269522e732934e173ccb324dbdda Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Tue, 24 Sep 2024 12:53:09 +0200 Subject: [PATCH 41/76] ci: switch to ubuntu runner for freebsd job Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/ci.yml | 25 +++++++------------ ...rantfile.freebsd13 => Vagrantfile.freebsd} | 5 +--- 2 files changed, 10 insertions(+), 20 deletions(-) rename hack/{Vagrantfile.freebsd13 => Vagrantfile.freebsd} (79%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a16907a5..507429ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -126,9 +126,7 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} test-freebsd-amd64: - runs-on: macos-13 - env: - VAGRANT_VAGRANTFILE: hack/Vagrantfile.freebsd13 + runs-on: ubuntu-22.04 steps: - name: Checkout @@ -138,28 +136,23 @@ jobs: uses: actions/cache@v4 with: path: ~/.vagrant.d/boxes - key: ${{ runner.os }}-vagrant-${{ hashFiles('hack/Vagrantfile.freebsd13') }} + key: ${{ runner.os }}-vagrant-${{ hashFiles('hack/Vagrantfile.freebsd') }} restore-keys: | ${{ runner.os }}-vagrant- - - name: Install Vagrant and VirtualBox - run: | - set -x - brew tap hashicorp/tap - brew install hashicorp/tap/hashicorp-vagrant - brew install --cask virtualbox - env: - HOMEBREW_NO_AUTO_UPDATE: 1 - HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 - - - name: Check versions + name: Install vagrant run: | set -x + sudo apt-get update + sudo apt-get install -y libvirt-daemon libvirt-daemon-system vagrant vagrant-libvirt ruby-libvirt + sudo systemctl enable --now libvirtd + sudo chmod a+rw /var/run/libvirt/libvirt-sock + vagrant plugin install vagrant-libvirt vagrant --version - VBoxManage -v - name: Set up vagrant run: | + ln -sf hack/Vagrantfile.freebsd Vagrantfile vagrant up --no-tty - name: Test diff --git a/hack/Vagrantfile.freebsd13 b/hack/Vagrantfile.freebsd similarity index 79% rename from hack/Vagrantfile.freebsd13 rename to hack/Vagrantfile.freebsd index 9cd7e062..2d81a719 100644 --- a/hack/Vagrantfile.freebsd13 +++ b/hack/Vagrantfile.freebsd @@ -2,10 +2,7 @@ # vi: set ft=ruby : Vagrant.configure("2") do |config| - config.vm.define "fbsd_13_2" do |fbsd_13_2| - fbsd_13_2.vm.box = "freebsd/FreeBSD-13.2-STABLE" - end - + config.vm.box = "generic/freebsd14" config.vm.boot_timeout = 900 config.vm.synced_folder ".", "/vagrant", type: "rsync" config.ssh.keep_alive = true From a3400686ae501e617919e607f0d0b55be806a1ae Mon Sep 17 00:00:00 2001 From: "Jonathan A. Sternberg" Date: Wed, 25 Sep 2024 16:59:03 -0500 Subject: [PATCH 42/76] deps: remove deprecated gogo proto This removes the deprecated gogo proto in favor of the standard implementation. Signed-off-by: Jonathan A. Sternberg --- .github/workflows/ci.yml | 1 + bench/go.mod | 4 +- bench/go.sum | 8 +- diff_containerd.go | 8 +- diskwriter.go | 18 +- docker-bake.hcl | 18 + fs.go | 25 +- fs_test.go | 4 +- go.mod | 6 +- go.sum | 37 +- hack/dockerfiles/generated-files.Dockerfile | 56 + hack/dockerfiles/gomod.Dockerfile | 15 +- hack/lint | 11 +- hack/shfmt | 8 +- hack/update-generated-files | 5 + hack/update-gomod | 8 +- hack/validate-generated-files | 5 + hack/validate-gomod | 33 +- receive_test.go | 47 +- stat.go | 2 +- stat_test.go | 6 +- stat_unix.go | 2 +- tools/tools.go | 7 + types/generate.go | 3 - types/stat.go | 20 +- types/stat.pb.go | 1018 +++---------------- types/stat.proto | 4 +- types/wire.go | 23 + types/wire.pb.go | 708 ++++--------- types/wire.proto | 4 +- 30 files changed, 558 insertions(+), 1556 deletions(-) create mode 100644 hack/dockerfiles/generated-files.Dockerfile create mode 100755 hack/update-generated-files create mode 100755 hack/validate-generated-files create mode 100644 tools/tools.go delete mode 100644 types/generate.go create mode 100644 types/wire.go diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 507429ec..e709e6de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,7 @@ jobs: matrix: target: - lint + - validate-generated-files - validate-gomod - validate-shfmt steps: diff --git a/bench/go.mod b/bench/go.mod index 805f3a38..d6eebcaf 100644 --- a/bench/go.mod +++ b/bench/go.mod @@ -26,8 +26,8 @@ require ( github.com/opencontainers/runc v1.0.0-rc93 // indirect github.com/sirupsen/logrus v1.8.1 // indirect go.opencensus.io v0.22.3 // indirect - golang.org/x/sys v0.1.0 // indirect - google.golang.org/protobuf v1.26.0 // indirect + golang.org/x/sys v0.11.0 // indirect + google.golang.org/protobuf v1.31.0 // indirect ) replace github.com/tonistiigi/fsutil => ../ diff --git a/bench/go.sum b/bench/go.sum index 4af8e696..b94c40cf 100644 --- a/bench/go.sum +++ b/bench/go.sum @@ -739,8 +739,8 @@ golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201202213521-69691e467435/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -859,8 +859,8 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/diff_containerd.go b/diff_containerd.go index 86d64602..a52b23f9 100644 --- a/diff_containerd.go +++ b/diff_containerd.go @@ -107,11 +107,11 @@ func doubleWalkDiff(ctx context.Context, changeFn ChangeFunc, a, b walkerFn, fil var f *types.Stat var f2copy *currentPath if f2 != nil { - statCopy := *f2.stat + statCopy := f2.stat.Clone() if filter != nil { - filter(f2.path, &statCopy) + filter(f2.path, statCopy) } - f2copy = ¤tPath{path: f2.path, stat: &statCopy} + f2copy = ¤tPath{path: f2.path, stat: statCopy} } k, p := pathChange(f1, f2copy) switch k { @@ -189,7 +189,7 @@ func sameFile(f1, f2 *currentPath, differ DiffType) (same bool, retErr error) { } // If not a directory also check size, modtime, and content if !f1.stat.IsDir() { - if f1.stat.Size_ != f2.stat.Size_ { + if f1.stat.Size != f2.stat.Size { return false, nil } diff --git a/diskwriter.go b/diskwriter.go index a62c6b0c..83389262 100644 --- a/diskwriter.go +++ b/diskwriter.go @@ -126,10 +126,10 @@ func (dw *DiskWriter) HandleChange(kind ChangeKind, p string, fi os.FileInfo, er return errors.WithStack(&os.PathError{Path: p, Err: syscall.EBADMSG, Op: "change without stat info"}) } - statCopy := *stat + statCopy := stat.Clone() if dw.filter != nil { - if ok := dw.filter(p, &statCopy); !ok { + if ok := dw.filter(p, statCopy); !ok { return nil } } @@ -148,7 +148,7 @@ func (dw *DiskWriter) HandleChange(kind ChangeKind, p string, fi os.FileInfo, er } if oldFi != nil && fi.IsDir() && oldFi.IsDir() { - if err := rewriteMetadata(destPath, &statCopy); err != nil { + if err := rewriteMetadata(destPath, statCopy); err != nil { return errors.Wrapf(err, "error setting dir metadata for %s", destPath) } return nil @@ -172,7 +172,7 @@ func (dw *DiskWriter) HandleChange(kind ChangeKind, p string, fi os.FileInfo, er } dw.dirModTimes[destPath] = statCopy.ModTime case fi.Mode()&os.ModeDevice != 0 || fi.Mode()&os.ModeNamedPipe != 0: - if err := handleTarTypeBlockCharFifo(newPath, &statCopy); err != nil { + if err := handleTarTypeBlockCharFifo(newPath, statCopy); err != nil { return errors.Wrapf(err, "failed to create device %s", newPath) } case fi.Mode()&os.ModeSymlink != 0: @@ -200,7 +200,7 @@ func (dw *DiskWriter) HandleChange(kind ChangeKind, p string, fi os.FileInfo, er } } - if err := rewriteMetadata(newPath, &statCopy); err != nil { + if err := rewriteMetadata(newPath, statCopy); err != nil { return errors.Wrapf(err, "error setting metadata for %s", newPath) } @@ -218,7 +218,7 @@ func (dw *DiskWriter) HandleChange(kind ChangeKind, p string, fi os.FileInfo, er if isRegularFile { if dw.opt.AsyncDataCb != nil { - dw.requestAsyncFileData(p, destPath, fi, &statCopy) + dw.requestAsyncFileData(p, destPath, fi, statCopy) } } else { return dw.processChange(dw.ctx, kind, p, fi, nil) @@ -351,8 +351,10 @@ func (lfw *lazyFileWriter) Close() error { // We generate random temporary file names so that there's a good // chance the file doesn't exist yet - keeps the number of tries in // TempFile to a minimum. -var rand uint32 -var randmu sync.Mutex +var ( + rand uint32 + randmu sync.Mutex +) func reseed() uint32 { return uint32(time.Now().UnixNano() + int64(os.Getpid())) diff --git a/docker-bake.hcl b/docker-bake.hcl index 48127d4f..a18986bc 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -34,13 +34,30 @@ target "test-noroot" { target "lint" { dockerfile = "./hack/dockerfiles/lint.Dockerfile" + output = ["type=cacheonly"] args = { GO_VERSION = "${GO_VERSION}" } } +target "validate-generated-files" { + dockerfile = "./hack/dockerfiles/generated-files.Dockerfile" + output = ["type=cacheonly"] + target = "validate" + args = { + GO_VERSION = "${GO_VERSION}" + } +} + +target "generated-files" { + inherits = ["validate-generated-files"] + output = ["."] + target = "update" +} + target "validate-gomod" { dockerfile = "./hack/dockerfiles/gomod.Dockerfile" + output = ["type=cacheonly"] target = "validate" args = { # go mod may produce different results between go versions, @@ -58,6 +75,7 @@ target "gomod" { target "validate-shfmt" { dockerfile = "./hack/dockerfiles/shfmt.Dockerfile" + output = ["type=cacheonly"] target = "validate" } diff --git a/fs.go b/fs.go index fe370194..d990ea5a 100644 --- a/fs.go +++ b/fs.go @@ -91,7 +91,7 @@ func (fs *fs) Open(p string) (io.ReadCloser, error) { } type Dir struct { - Stat types.Stat + Stat *types.Stat FS FS } @@ -125,12 +125,12 @@ func (fs *subDirFS) Walk(ctx context.Context, target string, fn gofs.WalkDirFunc continue } - fi := &StatInfo{&d.Stat} + fi := &StatInfo{d.Stat.Clone()} if !fi.IsDir() { return errors.WithStack(&os.PathError{Path: d.Stat.Path, Err: syscall.ENOTDIR, Op: "walk subdir"}) } - dStat := d.Stat - if err := fn(d.Stat.Path, &DirEntryInfo{Stat: &dStat}, nil); err != nil { + dStat := d.Stat.Clone() + if err := fn(d.Stat.Path, &DirEntryInfo{Stat: dStat}, nil); err != nil { return err } if err := d.FS.Walk(ctx, rest, func(p string, entry gofs.DirEntry, err error) error { @@ -176,8 +176,7 @@ func (fs *subDirFS) Open(p string) (io.ReadCloser, error) { return d.FS.Open(parts[1]) } -type emptyReader struct { -} +type emptyReader struct{} func (*emptyReader) Read([]byte) (int, error) { return 0, io.EOF @@ -190,18 +189,23 @@ type StatInfo struct { func (s *StatInfo) Name() string { return filepath.Base(s.Stat.Path) } + func (s *StatInfo) Size() int64 { - return s.Stat.Size_ + return s.Stat.Size } + func (s *StatInfo) Mode() os.FileMode { return os.FileMode(s.Stat.Mode) } + func (s *StatInfo) ModTime() time.Time { return time.Unix(s.Stat.ModTime/1e9, s.Stat.ModTime%1e9) } + func (s *StatInfo) IsDir() bool { return s.Mode().IsDir() } + func (s *StatInfo) Sys() interface{} { return s.Stat } @@ -221,18 +225,21 @@ func (s *DirEntryInfo) Name() string { } return s.entry.Name() } + func (s *DirEntryInfo) IsDir() bool { if s.Stat != nil { return s.Stat.IsDir() } return s.entry.IsDir() } + func (s *DirEntryInfo) Type() gofs.FileMode { if s.Stat != nil { return gofs.FileMode(s.Stat.Mode) } return s.entry.Type() } + func (s *DirEntryInfo) Info() (gofs.FileInfo, error) { if s.Stat == nil { fi, err := s.entry.Info() @@ -246,6 +253,6 @@ func (s *DirEntryInfo) Info() (gofs.FileInfo, error) { s.Stat = stat } - st := *s.Stat - return &StatInfo{&st}, nil + st := s.Stat.Clone() + return &StatInfo{st}, nil } diff --git a/fs_test.go b/fs_test.go index fc60c1f7..5243eff0 100644 --- a/fs_test.go +++ b/fs_test.go @@ -74,14 +74,14 @@ func TestWalkDir(t *testing.T) { f, err := SubDirFS([]Dir{ { - Stat: types.Stat{ + Stat: &types.Stat{ Mode: uint32(os.ModeDir | 0755), Path: "1", }, FS: tmpfs, }, { - Stat: types.Stat{ + Stat: &types.Stat{ Mode: uint32(os.ModeDir | 0755), Path: "2", }, diff --git a/go.mod b/go.mod index 93977f05..4aeae36d 100644 --- a/go.mod +++ b/go.mod @@ -5,13 +5,13 @@ go 1.20 require ( github.com/Microsoft/go-winio v0.5.2 github.com/containerd/continuity v0.4.1 - github.com/gogo/protobuf v1.3.2 github.com/moby/patternmatcher v0.5.0 github.com/opencontainers/go-digest v1.0.0 github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.8.4 golang.org/x/sync v0.1.0 - golang.org/x/sys v0.1.0 + golang.org/x/sys v0.11.0 + google.golang.org/protobuf v1.31.0 ) require ( @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/sirupsen/logrus v1.8.1 // indirect - google.golang.org/protobuf v1.26.0 // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 46c6359f..488fbeab 100644 --- a/go.sum +++ b/go.sum @@ -4,13 +4,9 @@ github.com/containerd/continuity v0.4.1 h1:wQnVrjIyQ8vhU2sgOiL5T07jo+ouqc2bnKsv5 github.com/containerd/continuity v0.4.1/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -30,43 +26,18 @@ github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/hack/dockerfiles/generated-files.Dockerfile b/hack/dockerfiles/generated-files.Dockerfile new file mode 100644 index 00000000..32f4fced --- /dev/null +++ b/hack/dockerfiles/generated-files.Dockerfile @@ -0,0 +1,56 @@ +# syntax=docker/dockerfile:1 + +ARG GO_VERSION=1.21 +ARG PROTOC_VERSION=3.11.4 + +FROM golang:${GO_VERSION} AS base + +FROM base AS protoc +RUN apt-get update && apt-get --no-install-recommends install -y unzip +ARG PROTOC_VERSION +ARG TARGETOS +ARG TARGETARCH +RUN </dev/null) + if [ -n "$diff" ]; then + echo >&2 'ERROR: The result of "./hack/validate-generated-files" differs. Please update with "./hack/update-generated-files".' + echo "$diff" + exit 1 + fi +EOT diff --git a/hack/dockerfiles/gomod.Dockerfile b/hack/dockerfiles/gomod.Dockerfile index d9f1d6d9..0e98d1bb 100644 --- a/hack/dockerfiles/gomod.Dockerfile +++ b/hack/dockerfiles/gomod.Dockerfile @@ -16,7 +16,14 @@ FROM scratch AS update COPY --from=gomod /out / FROM gomod AS validate -RUN --mount=target=.,rw \ - git add -A && \ - cp -rf /out/* . && \ - ./hack/validate-gomod check +RUN --mount=target=.,rw </dev/null) + if [ -n "$diff" ]; then + echo >&2 'ERROR: The result of "./hack/validate-gomod" differs. Please update with "./hack/update-gomod".' + echo "$diff" + exit 1 + fi +EOT diff --git a/hack/lint b/hack/lint index 30b8e294..adf67762 100755 --- a/hack/lint +++ b/hack/lint @@ -2,13 +2,4 @@ set -eu -o pipefail -x -: ${CONTINUOUS_INTEGRATION=} - -progressFlag="" -if [ "$CONTINUOUS_INTEGRATION" == "true" ]; then progressFlag="--progress=plain"; fi - -cacheOnlyFlag="" -if ! docker build --help 2>&1 | grep buildx >/dev/null; then cacheOnlyFlag="-o type=cacheonly"; fi - -export DOCKER_BUILDKIT=1 -docker build $progressFlag $cacheOnlyFlag -f ./hack/dockerfiles/lint.Dockerfile . +docker buildx bake lint diff --git a/hack/shfmt b/hack/shfmt index 1859e2c0..5f8971de 100755 --- a/hack/shfmt +++ b/hack/shfmt @@ -2,10 +2,4 @@ set -eu -o pipefail -x -: ${CONTINUOUS_INTEGRATION=} - -progressFlag="" -if [ "$CONTINUOUS_INTEGRATION" == "true" ]; then progressFlag="--progress=plain"; fi - -export DOCKER_BUILDKIT=1 -docker build $progressFlag -f ./hack/dockerfiles/shfmt.Dockerfile --target update -o . . +docker buildx bake shfmt diff --git a/hack/update-generated-files b/hack/update-generated-files new file mode 100755 index 00000000..aa0fa170 --- /dev/null +++ b/hack/update-generated-files @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -eu -o pipefail -x + +docker buildx bake generated-files diff --git a/hack/update-gomod b/hack/update-gomod index 1615ee6e..d0664d42 100755 --- a/hack/update-gomod +++ b/hack/update-gomod @@ -2,10 +2,4 @@ set -eu -o pipefail -x -: ${CONTINUOUS_INTEGRATION=} - -progressFlag="" -if [ "$CONTINUOUS_INTEGRATION" == "true" ]; then progressFlag="--progress=plain"; fi - -export DOCKER_BUILDKIT=1 -docker build $progressFlag -f ./hack/dockerfiles/gomod.Dockerfile --target update -o . . +docker buildx bake gomod diff --git a/hack/validate-generated-files b/hack/validate-generated-files new file mode 100755 index 00000000..c884c62d --- /dev/null +++ b/hack/validate-generated-files @@ -0,0 +1,5 @@ +#!/usr/bin/env sh + +set -eu + +docker buildx bake validate-generated-files diff --git a/hack/validate-gomod b/hack/validate-gomod index e9340c9f..88c94eb2 100755 --- a/hack/validate-gomod +++ b/hack/validate-gomod @@ -2,35 +2,4 @@ set -eu -: ${CONTINUOUS_INTEGRATION=} -: ${DOCKER_BUILDKIT=} - -progressFlag="" -if [ "$CONTINUOUS_INTEGRATION" = "true" ]; then progressFlag="--progress=plain"; fi - -cacheOnlyFlag="" -if ! docker build --help 2>&1 | grep buildx >/dev/null; then cacheOnlyFlag="-o type=cacheonly"; fi - -case ${1:-} in - '') - export DOCKER_BUILDKIT=1 - docker build $progressFlag $cacheOnlyFlag -f ./hack/dockerfiles/gomod.Dockerfile --target validate . || exit 1 - ;; - check) - status="$(git status --porcelain -- go.mod go.sum bench/go.mod bench/go.sum 2>/dev/null)" - diffs=$(echo "$status" | grep -v '^[RAD] ' || true) - if [ "$diffs" ]; then - { - set +x - echo 'The result of "./hack/validate-gomod" differs' - echo - echo "$diffs" - echo - echo 'Please vendor your package with "./hack/update-gomod"' - echo - } >&2 - exit 1 - fi - echo 'Congratulations! go.mod is done the right way.' - ;; -esac +docker buildx bake validate-gomod diff --git a/receive_test.go b/receive_test.go index d6988d81..5fc1ff8e 100644 --- a/receive_test.go +++ b/receive_test.go @@ -80,7 +80,7 @@ func TestCopyWithSubDir(t *testing.T) { eg.Go(func() error { defer s1.(*fakeConnProto).closeSend() - subdir, err := SubDirFS([]Dir{{FS: fs, Stat: types.Stat{Path: "sub", Mode: uint32(os.ModeDir | 0755)}}}) + subdir, err := SubDirFS([]Dir{{FS: fs, Stat: &types.Stat{Path: "sub", Mode: uint32(os.ModeDir | 0755)}}}) if err != nil { return err } @@ -517,49 +517,6 @@ func sockPairProto(ctx context.Context) (Stream, Stream) { return &fakeConnProto{ctx, c1, c2}, &fakeConnProto{ctx, c2, c1} } -//nolint:unused -type fakeConn struct { - ctx context.Context - recvChan chan *types.Packet - sendChan chan *types.Packet -} - -//nolint:unused -func (fc *fakeConn) Context() context.Context { - return fc.ctx -} - -//nolint:unused -func (fc *fakeConn) RecvMsg(m interface{}) error { - p, ok := m.(*types.Packet) - if !ok { - return errors.Errorf("invalid msg: %#v", m) - } - select { - case <-fc.ctx.Done(): - return fc.ctx.Err() - case p2 := <-fc.recvChan: - *p = *p2 - return nil - } -} - -//nolint:unused -func (fc *fakeConn) SendMsg(m interface{}) error { - p, ok := m.(*types.Packet) - if !ok { - return errors.Errorf("invalid msg: %#v", m) - } - p2 := *p - p2.Data = append([]byte{}, p2.Data...) - select { - case <-fc.ctx.Done(): - return fc.ctx.Err() - case fc.sendChan <- &p2: - return nil - } -} - type fakeConnProto struct { ctx context.Context recvChan chan []byte @@ -625,7 +582,7 @@ func (c *changes) HandleChange(kind ChangeKind, p string, fi os.FileInfo, err er func simpleSHA256Hasher(s *types.Stat) (hash.Hash, error) { h := sha256.New() - ss := *s + ss := s.Clone() ss.ModTime = 0 // Unlike Linux, on FreeBSD's stat() call returns -1 in st_rdev for regular files ss.Devminor = 0 diff --git a/stat.go b/stat.go index 44441cb6..919fafa0 100644 --- a/stat.go +++ b/stat.go @@ -27,7 +27,7 @@ func mkstat(path, relpath string, fi os.FileInfo, inodemap map[uint64]string) (* setUnixOpt(fi, stat, relpath, inodemap) if !fi.IsDir() { - stat.Size_ = fi.Size() + stat.Size = fi.Size() if fi.Mode()&os.ModeSymlink != 0 { link, err := os.Readlink(path) if err != nil { diff --git a/stat_test.go b/stat_test.go index 0678a850..05eb0af6 100644 --- a/stat_test.go +++ b/stat_test.go @@ -28,7 +28,7 @@ func TestStat(t *testing.T) { assert.NoError(t, err) assert.NotZero(t, st.ModTime) st.ModTime = 0 - assert.Equal(t, &types.Stat{Path: "foo", Mode: 0644, Size_: 5}, st) + assert.Equal(t, &types.Stat{Path: "foo", Mode: 0644, Size: 5}, st) st, err = Stat(filepath.Join(d, "zzz")) assert.NoError(t, err) @@ -40,13 +40,13 @@ func TestStat(t *testing.T) { assert.NoError(t, err) assert.NotZero(t, st.ModTime) st.ModTime = 0 - assert.Equal(t, &types.Stat{Path: "aa", Mode: 0644, Size_: 5}, st) + assert.Equal(t, &types.Stat{Path: "aa", Mode: 0644, Size: 5}, st) st, err = Stat(filepath.Join(d, "zzz/bb/cc/dd")) assert.NoError(t, err) assert.NotZero(t, st.ModTime) st.ModTime = 0 - assert.Equal(t, &types.Stat{Path: "dd", Mode: uint32(os.ModeSymlink | 0777), Size_: 6, Linkname: "../../"}, st) + assert.Equal(t, &types.Stat{Path: "dd", Mode: uint32(os.ModeSymlink | 0777), Size: 6, Linkname: "../../"}, st) st, err = Stat(filepath.Join(d, "sock")) assert.NoError(t, err) diff --git a/stat_unix.go b/stat_unix.go index 5923aefe..def901e3 100644 --- a/stat_unix.go +++ b/stat_unix.go @@ -52,7 +52,7 @@ func setUnixOpt(fi os.FileInfo, stat *types.Stat, path string, seenFiles map[uin if s.Nlink > 1 { if oldpath, ok := seenFiles[ino]; ok { stat.Linkname = oldpath - stat.Size_ = 0 + stat.Size = 0 linked = true } } diff --git a/tools/tools.go b/tools/tools.go new file mode 100644 index 00000000..770c67cc --- /dev/null +++ b/tools/tools.go @@ -0,0 +1,7 @@ +//go:build tools + +package tools + +import ( + _ "google.golang.org/protobuf/cmd/protoc-gen-go" +) diff --git a/types/generate.go b/types/generate.go deleted file mode 100644 index 5c03178f..00000000 --- a/types/generate.go +++ /dev/null @@ -1,3 +0,0 @@ -package types - -//go:generate protoc --gogoslick_out=. stat.proto wire.proto diff --git a/types/stat.go b/types/stat.go index b79fd2bd..9a5ae09e 100644 --- a/types/stat.go +++ b/types/stat.go @@ -1,7 +1,23 @@ package types -import "os" +import ( + "os" -func (s Stat) IsDir() bool { + "google.golang.org/protobuf/proto" +) + +func (s *Stat) IsDir() bool { return os.FileMode(s.Mode).IsDir() } + +func (s *Stat) Marshal() ([]byte, error) { + return proto.MarshalOptions{Deterministic: true}.Marshal(s) +} + +func (s *Stat) Unmarshal(dAtA []byte) error { + return proto.UnmarshalOptions{Merge: true}.Unmarshal(dAtA, s) +} + +func (s *Stat) Clone() *Stat { + return proto.Clone(s).(*Stat) +} diff --git a/types/stat.pb.go b/types/stat.pb.go index 91200fb7..5dde6f41 100644 --- a/types/stat.pb.go +++ b/types/stat.pb.go @@ -1,37 +1,35 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: stat.proto +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc v3.11.4 +// source: github.com/tonistiigi/fsutil/types/stat.proto package types import ( - bytes "bytes" - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" - strings "strings" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type Stat struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` Mode uint32 `protobuf:"varint,2,opt,name=mode,proto3" json:"mode,omitempty"` Uid uint32 `protobuf:"varint,3,opt,name=uid,proto3" json:"uid,omitempty"` Gid uint32 `protobuf:"varint,4,opt,name=gid,proto3" json:"gid,omitempty"` - Size_ int64 `protobuf:"varint,5,opt,name=size,proto3" json:"size,omitempty"` + Size int64 `protobuf:"varint,5,opt,name=size,proto3" json:"size,omitempty"` ModTime int64 `protobuf:"varint,6,opt,name=modTime,proto3" json:"modTime,omitempty"` // int32 typeflag = 7; Linkname string `protobuf:"bytes,7,opt,name=linkname,proto3" json:"linkname,omitempty"` @@ -40,890 +38,202 @@ type Stat struct { Xattrs map[string][]byte `protobuf:"bytes,10,rep,name=xattrs,proto3" json:"xattrs,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } -func (m *Stat) Reset() { *m = Stat{} } -func (*Stat) ProtoMessage() {} -func (*Stat) Descriptor() ([]byte, []int) { - return fileDescriptor_01fabdc1b78bd68b, []int{0} +func (x *Stat) Reset() { + *x = Stat{} + if protoimpl.UnsafeEnabled { + mi := &file_github_com_tonistiigi_fsutil_types_stat_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Stat) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (x *Stat) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Stat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Stat.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + +func (*Stat) ProtoMessage() {} + +func (x *Stat) ProtoReflect() protoreflect.Message { + mi := &file_github_com_tonistiigi_fsutil_types_stat_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) } - return b[:n], nil + return ms } -} -func (m *Stat) XXX_Merge(src proto.Message) { - xxx_messageInfo_Stat.Merge(m, src) -} -func (m *Stat) XXX_Size() int { - return m.Size() -} -func (m *Stat) XXX_DiscardUnknown() { - xxx_messageInfo_Stat.DiscardUnknown(m) + return mi.MessageOf(x) } -var xxx_messageInfo_Stat proto.InternalMessageInfo +// Deprecated: Use Stat.ProtoReflect.Descriptor instead. +func (*Stat) Descriptor() ([]byte, []int) { + return file_github_com_tonistiigi_fsutil_types_stat_proto_rawDescGZIP(), []int{0} +} -func (m *Stat) GetPath() string { - if m != nil { - return m.Path +func (x *Stat) GetPath() string { + if x != nil { + return x.Path } return "" } -func (m *Stat) GetMode() uint32 { - if m != nil { - return m.Mode +func (x *Stat) GetMode() uint32 { + if x != nil { + return x.Mode } return 0 } -func (m *Stat) GetUid() uint32 { - if m != nil { - return m.Uid +func (x *Stat) GetUid() uint32 { + if x != nil { + return x.Uid } return 0 } -func (m *Stat) GetGid() uint32 { - if m != nil { - return m.Gid +func (x *Stat) GetGid() uint32 { + if x != nil { + return x.Gid } return 0 } -func (m *Stat) GetSize_() int64 { - if m != nil { - return m.Size_ +func (x *Stat) GetSize() int64 { + if x != nil { + return x.Size } return 0 } -func (m *Stat) GetModTime() int64 { - if m != nil { - return m.ModTime +func (x *Stat) GetModTime() int64 { + if x != nil { + return x.ModTime } return 0 } -func (m *Stat) GetLinkname() string { - if m != nil { - return m.Linkname +func (x *Stat) GetLinkname() string { + if x != nil { + return x.Linkname } return "" } -func (m *Stat) GetDevmajor() int64 { - if m != nil { - return m.Devmajor +func (x *Stat) GetDevmajor() int64 { + if x != nil { + return x.Devmajor } return 0 } -func (m *Stat) GetDevminor() int64 { - if m != nil { - return m.Devminor +func (x *Stat) GetDevminor() int64 { + if x != nil { + return x.Devminor } return 0 } -func (m *Stat) GetXattrs() map[string][]byte { - if m != nil { - return m.Xattrs +func (x *Stat) GetXattrs() map[string][]byte { + if x != nil { + return x.Xattrs } return nil } -func init() { - proto.RegisterType((*Stat)(nil), "fsutil.types.Stat") - proto.RegisterMapType((map[string][]byte)(nil), "fsutil.types.Stat.XattrsEntry") -} - -func init() { proto.RegisterFile("stat.proto", fileDescriptor_01fabdc1b78bd68b) } - -var fileDescriptor_01fabdc1b78bd68b = []byte{ - // 317 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x91, 0xbd, 0x4e, 0xc3, 0x30, - 0x14, 0x85, 0x73, 0x9b, 0xfe, 0xba, 0x45, 0x42, 0x16, 0x83, 0xd5, 0xe1, 0x2a, 0x62, 0xca, 0x94, - 0x01, 0x24, 0xc4, 0xcf, 0x86, 0xc4, 0x0b, 0x04, 0x06, 0xc4, 0x66, 0x64, 0x53, 0x4c, 0x9b, 0xb8, - 0x4a, 0xdc, 0x8a, 0x32, 0xf1, 0x08, 0x3c, 0x06, 0x6f, 0x02, 0x63, 0xc7, 0x8e, 0xd4, 0x5d, 0x18, - 0xfb, 0x08, 0xc8, 0x4e, 0x5b, 0xba, 0x9d, 0xf3, 0x9d, 0x7b, 0x95, 0x9c, 0x6b, 0x42, 0x4a, 0xc3, - 0x4d, 0x32, 0x2e, 0xb4, 0xd1, 0xb4, 0xf7, 0x54, 0x4e, 0x8c, 0x1a, 0x25, 0x66, 0x36, 0x96, 0xe5, - 0xf1, 0x57, 0x8d, 0xd4, 0x6f, 0x0d, 0x37, 0x94, 0x92, 0xfa, 0x98, 0x9b, 0x67, 0x06, 0x11, 0xc4, - 0x9d, 0xd4, 0x6b, 0xc7, 0x32, 0x2d, 0x24, 0xab, 0x45, 0x10, 0x1f, 0xa4, 0x5e, 0xd3, 0x43, 0x12, - 0x4e, 0x94, 0x60, 0xa1, 0x47, 0x4e, 0x3a, 0x32, 0x50, 0x82, 0xd5, 0x2b, 0x32, 0x50, 0xc2, 0xed, - 0x95, 0xea, 0x4d, 0xb2, 0x46, 0x04, 0x71, 0x98, 0x7a, 0x4d, 0x19, 0x69, 0x65, 0x5a, 0xdc, 0xa9, - 0x4c, 0xb2, 0xa6, 0xc7, 0x5b, 0x4b, 0xfb, 0xa4, 0x3d, 0x52, 0xf9, 0x30, 0xe7, 0x99, 0x64, 0x2d, - 0xff, 0xf5, 0x9d, 0x77, 0x99, 0x90, 0xd3, 0x8c, 0xbf, 0xe8, 0x82, 0xb5, 0xfd, 0xda, 0xce, 0x6f, - 0x33, 0x95, 0xeb, 0x82, 0x75, 0xfe, 0x33, 0xe7, 0xe9, 0x19, 0x69, 0xbe, 0x72, 0x63, 0x8a, 0x92, - 0x91, 0x28, 0x8c, 0xbb, 0x27, 0x98, 0xec, 0xb7, 0x4e, 0x5c, 0xe3, 0xe4, 0xde, 0x0f, 0xdc, 0xe4, - 0xa6, 0x98, 0xa5, 0x9b, 0xe9, 0xfe, 0x05, 0xe9, 0xee, 0x61, 0x57, 0x6d, 0x28, 0x67, 0x9b, 0x9b, - 0x38, 0x49, 0x8f, 0x48, 0x63, 0xca, 0x47, 0x93, 0xea, 0x26, 0xbd, 0xb4, 0x32, 0x97, 0xb5, 0x73, - 0xb8, 0xbe, 0x9a, 0x2f, 0x31, 0x58, 0x2c, 0x31, 0x58, 0x2f, 0x11, 0xde, 0x2d, 0xc2, 0xa7, 0x45, - 0xf8, 0xb6, 0x08, 0x73, 0x8b, 0xf0, 0x63, 0x11, 0x7e, 0x2d, 0x06, 0x6b, 0x8b, 0xf0, 0xb1, 0xc2, - 0x60, 0xbe, 0xc2, 0x60, 0xb1, 0xc2, 0xe0, 0xa1, 0xe1, 0x7f, 0xe8, 0xb1, 0xe9, 0xdf, 0xe6, 0xf4, - 0x2f, 0x00, 0x00, 0xff, 0xff, 0x06, 0x97, 0xf3, 0xd7, 0xa9, 0x01, 0x00, 0x00, -} - -func (this *Stat) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Stat) - if !ok { - that2, ok := that.(Stat) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Path != that1.Path { - return false - } - if this.Mode != that1.Mode { - return false - } - if this.Uid != that1.Uid { - return false - } - if this.Gid != that1.Gid { - return false - } - if this.Size_ != that1.Size_ { - return false - } - if this.ModTime != that1.ModTime { - return false - } - if this.Linkname != that1.Linkname { - return false - } - if this.Devmajor != that1.Devmajor { - return false - } - if this.Devminor != that1.Devminor { - return false - } - if len(this.Xattrs) != len(that1.Xattrs) { - return false - } - for i := range this.Xattrs { - if !bytes.Equal(this.Xattrs[i], that1.Xattrs[i]) { - return false - } - } - return true -} -func (this *Stat) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 14) - s = append(s, "&types.Stat{") - s = append(s, "Path: "+fmt.Sprintf("%#v", this.Path)+",\n") - s = append(s, "Mode: "+fmt.Sprintf("%#v", this.Mode)+",\n") - s = append(s, "Uid: "+fmt.Sprintf("%#v", this.Uid)+",\n") - s = append(s, "Gid: "+fmt.Sprintf("%#v", this.Gid)+",\n") - s = append(s, "Size_: "+fmt.Sprintf("%#v", this.Size_)+",\n") - s = append(s, "ModTime: "+fmt.Sprintf("%#v", this.ModTime)+",\n") - s = append(s, "Linkname: "+fmt.Sprintf("%#v", this.Linkname)+",\n") - s = append(s, "Devmajor: "+fmt.Sprintf("%#v", this.Devmajor)+",\n") - s = append(s, "Devminor: "+fmt.Sprintf("%#v", this.Devminor)+",\n") - keysForXattrs := make([]string, 0, len(this.Xattrs)) - for k, _ := range this.Xattrs { - keysForXattrs = append(keysForXattrs, k) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForXattrs) - mapStringForXattrs := "map[string][]byte{" - for _, k := range keysForXattrs { - mapStringForXattrs += fmt.Sprintf("%#v: %#v,", k, this.Xattrs[k]) - } - mapStringForXattrs += "}" - if this.Xattrs != nil { - s = append(s, "Xattrs: "+mapStringForXattrs+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringStat(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func (m *Stat) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Stat) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +var File_github_com_tonistiigi_fsutil_types_stat_proto protoreflect.FileDescriptor + +var file_github_com_tonistiigi_fsutil_types_stat_proto_rawDesc = []byte{ + 0x0a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x6f, 0x6e, + 0x69, 0x73, 0x74, 0x69, 0x69, 0x67, 0x69, 0x2f, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x0c, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x22, 0xc7, 0x02, + 0x0a, 0x04, 0x53, 0x74, 0x61, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x6f, + 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x12, 0x10, + 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x75, 0x69, 0x64, + 0x12, 0x10, 0x0a, 0x03, 0x67, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x67, + 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x64, 0x54, 0x69, 0x6d, + 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x54, 0x69, 0x6d, 0x65, + 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x69, 0x6e, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x6c, 0x69, 0x6e, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, + 0x64, 0x65, 0x76, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, + 0x64, 0x65, 0x76, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x76, 0x6d, + 0x69, 0x6e, 0x6f, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x76, 0x6d, + 0x69, 0x6e, 0x6f, 0x72, 0x12, 0x36, 0x0a, 0x06, 0x78, 0x61, 0x74, 0x74, 0x72, 0x73, 0x18, 0x0a, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2e, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x2e, 0x58, 0x61, 0x74, 0x74, 0x72, 0x73, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x78, 0x61, 0x74, 0x74, 0x72, 0x73, 0x1a, 0x39, 0x0a, 0x0b, + 0x58, 0x61, 0x74, 0x74, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x24, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x6f, 0x6e, 0x69, 0x73, 0x74, 0x69, 0x69, 0x67, 0x69, + 0x2f, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } -func (m *Stat) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Xattrs) > 0 { - for k := range m.Xattrs { - v := m.Xattrs[k] - baseI := i - if len(v) > 0 { - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarintStat(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - } - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarintStat(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarintStat(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x52 - } - } - if m.Devminor != 0 { - i = encodeVarintStat(dAtA, i, uint64(m.Devminor)) - i-- - dAtA[i] = 0x48 - } - if m.Devmajor != 0 { - i = encodeVarintStat(dAtA, i, uint64(m.Devmajor)) - i-- - dAtA[i] = 0x40 - } - if len(m.Linkname) > 0 { - i -= len(m.Linkname) - copy(dAtA[i:], m.Linkname) - i = encodeVarintStat(dAtA, i, uint64(len(m.Linkname))) - i-- - dAtA[i] = 0x3a - } - if m.ModTime != 0 { - i = encodeVarintStat(dAtA, i, uint64(m.ModTime)) - i-- - dAtA[i] = 0x30 - } - if m.Size_ != 0 { - i = encodeVarintStat(dAtA, i, uint64(m.Size_)) - i-- - dAtA[i] = 0x28 - } - if m.Gid != 0 { - i = encodeVarintStat(dAtA, i, uint64(m.Gid)) - i-- - dAtA[i] = 0x20 - } - if m.Uid != 0 { - i = encodeVarintStat(dAtA, i, uint64(m.Uid)) - i-- - dAtA[i] = 0x18 - } - if m.Mode != 0 { - i = encodeVarintStat(dAtA, i, uint64(m.Mode)) - i-- - dAtA[i] = 0x10 - } - if len(m.Path) > 0 { - i -= len(m.Path) - copy(dAtA[i:], m.Path) - i = encodeVarintStat(dAtA, i, uint64(len(m.Path))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintStat(dAtA []byte, offset int, v uint64) int { - offset -= sovStat(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Stat) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Path) - if l > 0 { - n += 1 + l + sovStat(uint64(l)) - } - if m.Mode != 0 { - n += 1 + sovStat(uint64(m.Mode)) - } - if m.Uid != 0 { - n += 1 + sovStat(uint64(m.Uid)) - } - if m.Gid != 0 { - n += 1 + sovStat(uint64(m.Gid)) - } - if m.Size_ != 0 { - n += 1 + sovStat(uint64(m.Size_)) - } - if m.ModTime != 0 { - n += 1 + sovStat(uint64(m.ModTime)) - } - l = len(m.Linkname) - if l > 0 { - n += 1 + l + sovStat(uint64(l)) - } - if m.Devmajor != 0 { - n += 1 + sovStat(uint64(m.Devmajor)) - } - if m.Devminor != 0 { - n += 1 + sovStat(uint64(m.Devminor)) - } - if len(m.Xattrs) > 0 { - for k, v := range m.Xattrs { - _ = k - _ = v - l = 0 - if len(v) > 0 { - l = 1 + len(v) + sovStat(uint64(len(v))) - } - mapEntrySize := 1 + len(k) + sovStat(uint64(len(k))) + l - n += mapEntrySize + 1 + sovStat(uint64(mapEntrySize)) - } - } - return n -} - -func sovStat(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozStat(x uint64) (n int) { - return sovStat(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *Stat) String() string { - if this == nil { - return "nil" - } - keysForXattrs := make([]string, 0, len(this.Xattrs)) - for k, _ := range this.Xattrs { - keysForXattrs = append(keysForXattrs, k) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForXattrs) - mapStringForXattrs := "map[string][]byte{" - for _, k := range keysForXattrs { - mapStringForXattrs += fmt.Sprintf("%v: %v,", k, this.Xattrs[k]) - } - mapStringForXattrs += "}" - s := strings.Join([]string{`&Stat{`, - `Path:` + fmt.Sprintf("%v", this.Path) + `,`, - `Mode:` + fmt.Sprintf("%v", this.Mode) + `,`, - `Uid:` + fmt.Sprintf("%v", this.Uid) + `,`, - `Gid:` + fmt.Sprintf("%v", this.Gid) + `,`, - `Size_:` + fmt.Sprintf("%v", this.Size_) + `,`, - `ModTime:` + fmt.Sprintf("%v", this.ModTime) + `,`, - `Linkname:` + fmt.Sprintf("%v", this.Linkname) + `,`, - `Devmajor:` + fmt.Sprintf("%v", this.Devmajor) + `,`, - `Devminor:` + fmt.Sprintf("%v", this.Devminor) + `,`, - `Xattrs:` + mapStringForXattrs + `,`, - `}`, - }, "") - return s -} -func valueToStringStat(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *Stat) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Stat: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Stat: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthStat - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStat - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Path = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Mode", wireType) - } - m.Mode = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Mode |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Uid", wireType) - } - m.Uid = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Uid |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Gid", wireType) - } - m.Gid = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Gid |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Size_", wireType) - } - m.Size_ = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Size_ |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ModTime", wireType) - } - m.ModTime = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ModTime |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Linkname", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthStat - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStat - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Linkname = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Devmajor", wireType) - } - m.Devmajor = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Devmajor |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Devminor", wireType) - } - m.Devminor = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Devminor |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Xattrs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStat - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStat - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Xattrs == nil { - m.Xattrs = make(map[string][]byte) - } - var mapkey string - mapvalue := []byte{} - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthStat - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthStat - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapbyteLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapbyteLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intMapbyteLen := int(mapbyteLen) - if intMapbyteLen < 0 { - return ErrInvalidLengthStat - } - postbytesIndex := iNdEx + intMapbyteLen - if postbytesIndex < 0 { - return ErrInvalidLengthStat - } - if postbytesIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = make([]byte, mapbyteLen) - copy(mapvalue, dAtA[iNdEx:postbytesIndex]) - iNdEx = postbytesIndex - } else { - iNdEx = entryPreIndex - skippy, err := skipStat(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStat - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Xattrs[mapkey] = mapvalue - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStat(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStat - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthStat - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } +var ( + file_github_com_tonistiigi_fsutil_types_stat_proto_rawDescOnce sync.Once + file_github_com_tonistiigi_fsutil_types_stat_proto_rawDescData = file_github_com_tonistiigi_fsutil_types_stat_proto_rawDesc +) - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipStat(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowStat - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowStat - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowStat - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthStat +func file_github_com_tonistiigi_fsutil_types_stat_proto_rawDescGZIP() []byte { + file_github_com_tonistiigi_fsutil_types_stat_proto_rawDescOnce.Do(func() { + file_github_com_tonistiigi_fsutil_types_stat_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_tonistiigi_fsutil_types_stat_proto_rawDescData) + }) + return file_github_com_tonistiigi_fsutil_types_stat_proto_rawDescData +} + +var file_github_com_tonistiigi_fsutil_types_stat_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_github_com_tonistiigi_fsutil_types_stat_proto_goTypes = []interface{}{ + (*Stat)(nil), // 0: fsutil.types.Stat + nil, // 1: fsutil.types.Stat.XattrsEntry +} +var file_github_com_tonistiigi_fsutil_types_stat_proto_depIdxs = []int32{ + 1, // 0: fsutil.types.Stat.xattrs:type_name -> fsutil.types.Stat.XattrsEntry + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_github_com_tonistiigi_fsutil_types_stat_proto_init() } +func file_github_com_tonistiigi_fsutil_types_stat_proto_init() { + if File_github_com_tonistiigi_fsutil_types_stat_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_github_com_tonistiigi_fsutil_types_stat_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Stat); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupStat - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthStat - } - if depth == 0 { - return iNdEx, nil } } - return 0, io.ErrUnexpectedEOF + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_github_com_tonistiigi_fsutil_types_stat_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_github_com_tonistiigi_fsutil_types_stat_proto_goTypes, + DependencyIndexes: file_github_com_tonistiigi_fsutil_types_stat_proto_depIdxs, + MessageInfos: file_github_com_tonistiigi_fsutil_types_stat_proto_msgTypes, + }.Build() + File_github_com_tonistiigi_fsutil_types_stat_proto = out.File + file_github_com_tonistiigi_fsutil_types_stat_proto_rawDesc = nil + file_github_com_tonistiigi_fsutil_types_stat_proto_goTypes = nil + file_github_com_tonistiigi_fsutil_types_stat_proto_depIdxs = nil } - -var ( - ErrInvalidLengthStat = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowStat = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupStat = fmt.Errorf("proto: unexpected end of group") -) diff --git a/types/stat.proto b/types/stat.proto index 4138be69..26e2ff65 100644 --- a/types/stat.proto +++ b/types/stat.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package fsutil.types; -option go_package = "types"; +option go_package = "github.com/tonistiigi/fsutil/types"; message Stat { string path = 1; @@ -16,4 +16,4 @@ message Stat { int64 devmajor = 8; int64 devminor = 9; map xattrs = 10; -} \ No newline at end of file +} diff --git a/types/wire.go b/types/wire.go new file mode 100644 index 00000000..541667ef --- /dev/null +++ b/types/wire.go @@ -0,0 +1,23 @@ +package types + +import "google.golang.org/protobuf/proto" + +const ( + PACKET_STAT = Packet_PACKET_STAT + PACKET_REQ = Packet_PACKET_REQ + PACKET_DATA = Packet_PACKET_DATA + PACKET_FIN = Packet_PACKET_FIN + PACKET_ERR = Packet_PACKET_ERR +) + +func (p *Packet) Marshal() ([]byte, error) { + return proto.MarshalOptions{Deterministic: true}.Marshal(p) +} + +func (p *Packet) Unmarshal(dAtA []byte) error { + return proto.UnmarshalOptions{Merge: true}.Unmarshal(dAtA, p) +} + +func (p *Packet) Size() int { + return proto.Size(p) +} diff --git a/types/wire.pb.go b/types/wire.pb.go index 9e22269e..38953329 100644 --- a/types/wire.pb.go +++ b/types/wire.pb.go @@ -1,575 +1,247 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: wire.proto +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc v3.11.4 +// source: github.com/tonistiigi/fsutil/types/wire.proto package types import ( - bytes "bytes" - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" - strconv "strconv" - strings "strings" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type Packet_PacketType int32 const ( - PACKET_STAT Packet_PacketType = 0 - PACKET_REQ Packet_PacketType = 1 - PACKET_DATA Packet_PacketType = 2 - PACKET_FIN Packet_PacketType = 3 - PACKET_ERR Packet_PacketType = 4 + Packet_PACKET_STAT Packet_PacketType = 0 + Packet_PACKET_REQ Packet_PacketType = 1 + Packet_PACKET_DATA Packet_PacketType = 2 + Packet_PACKET_FIN Packet_PacketType = 3 + Packet_PACKET_ERR Packet_PacketType = 4 +) + +// Enum value maps for Packet_PacketType. +var ( + Packet_PacketType_name = map[int32]string{ + 0: "PACKET_STAT", + 1: "PACKET_REQ", + 2: "PACKET_DATA", + 3: "PACKET_FIN", + 4: "PACKET_ERR", + } + Packet_PacketType_value = map[string]int32{ + "PACKET_STAT": 0, + "PACKET_REQ": 1, + "PACKET_DATA": 2, + "PACKET_FIN": 3, + "PACKET_ERR": 4, + } ) -var Packet_PacketType_name = map[int32]string{ - 0: "PACKET_STAT", - 1: "PACKET_REQ", - 2: "PACKET_DATA", - 3: "PACKET_FIN", - 4: "PACKET_ERR", +func (x Packet_PacketType) Enum() *Packet_PacketType { + p := new(Packet_PacketType) + *p = x + return p } -var Packet_PacketType_value = map[string]int32{ - "PACKET_STAT": 0, - "PACKET_REQ": 1, - "PACKET_DATA": 2, - "PACKET_FIN": 3, - "PACKET_ERR": 4, +func (x Packet_PacketType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } +func (Packet_PacketType) Descriptor() protoreflect.EnumDescriptor { + return file_github_com_tonistiigi_fsutil_types_wire_proto_enumTypes[0].Descriptor() +} + +func (Packet_PacketType) Type() protoreflect.EnumType { + return &file_github_com_tonistiigi_fsutil_types_wire_proto_enumTypes[0] +} + +func (x Packet_PacketType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Packet_PacketType.Descriptor instead. func (Packet_PacketType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_f2dcdddcdf68d8e0, []int{0, 0} + return file_github_com_tonistiigi_fsutil_types_wire_proto_rawDescGZIP(), []int{0, 0} } type Packet struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + Type Packet_PacketType `protobuf:"varint,1,opt,name=type,proto3,enum=fsutil.types.Packet_PacketType" json:"type,omitempty"` Stat *Stat `protobuf:"bytes,2,opt,name=stat,proto3" json:"stat,omitempty"` ID uint32 `protobuf:"varint,3,opt,name=ID,proto3" json:"ID,omitempty"` Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` } -func (m *Packet) Reset() { *m = Packet{} } -func (*Packet) ProtoMessage() {} -func (*Packet) Descriptor() ([]byte, []int) { - return fileDescriptor_f2dcdddcdf68d8e0, []int{0} -} -func (m *Packet) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Packet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Packet.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (x *Packet) Reset() { + *x = Packet{} + if protoimpl.UnsafeEnabled { + mi := &file_github_com_tonistiigi_fsutil_types_wire_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } } -func (m *Packet) XXX_Merge(src proto.Message) { - xxx_messageInfo_Packet.Merge(m, src) -} -func (m *Packet) XXX_Size() int { - return m.Size() -} -func (m *Packet) XXX_DiscardUnknown() { - xxx_messageInfo_Packet.DiscardUnknown(m) + +func (x *Packet) String() string { + return protoimpl.X.MessageStringOf(x) } -var xxx_messageInfo_Packet proto.InternalMessageInfo +func (*Packet) ProtoMessage() {} -func (m *Packet) GetType() Packet_PacketType { - if m != nil { - return m.Type +func (x *Packet) ProtoReflect() protoreflect.Message { + mi := &file_github_com_tonistiigi_fsutil_types_wire_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return PACKET_STAT + return mi.MessageOf(x) } -func (m *Packet) GetStat() *Stat { - if m != nil { - return m.Stat - } - return nil +// Deprecated: Use Packet.ProtoReflect.Descriptor instead. +func (*Packet) Descriptor() ([]byte, []int) { + return file_github_com_tonistiigi_fsutil_types_wire_proto_rawDescGZIP(), []int{0} } -func (m *Packet) GetID() uint32 { - if m != nil { - return m.ID +func (x *Packet) GetType() Packet_PacketType { + if x != nil { + return x.Type } - return 0 + return Packet_PACKET_STAT } -func (m *Packet) GetData() []byte { - if m != nil { - return m.Data +func (x *Packet) GetStat() *Stat { + if x != nil { + return x.Stat } return nil } -func init() { - proto.RegisterEnum("fsutil.types.Packet_PacketType", Packet_PacketType_name, Packet_PacketType_value) - proto.RegisterType((*Packet)(nil), "fsutil.types.Packet") -} - -func init() { proto.RegisterFile("wire.proto", fileDescriptor_f2dcdddcdf68d8e0) } - -var fileDescriptor_f2dcdddcdf68d8e0 = []byte{ - // 276 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0xcf, 0x2c, 0x4a, - 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x49, 0x2b, 0x2e, 0x2d, 0xc9, 0xcc, 0xd1, 0x2b, - 0xa9, 0x2c, 0x48, 0x2d, 0x96, 0xe2, 0x2a, 0x2e, 0x49, 0x2c, 0x81, 0xc8, 0x28, 0xbd, 0x64, 0xe4, - 0x62, 0x0b, 0x48, 0x4c, 0xce, 0x4e, 0x2d, 0x11, 0x32, 0xe6, 0x62, 0x01, 0xc9, 0x4b, 0x30, 0x2a, - 0x30, 0x6a, 0xf0, 0x19, 0xc9, 0xeb, 0x21, 0xeb, 0xd1, 0x83, 0xa8, 0x81, 0x52, 0x21, 0x95, 0x05, - 0xa9, 0x41, 0x60, 0xc5, 0x42, 0x6a, 0x5c, 0x2c, 0x20, 0xd3, 0x24, 0x98, 0x14, 0x18, 0x35, 0xb8, - 0x8d, 0x84, 0x50, 0x35, 0x05, 0x97, 0x24, 0x96, 0x04, 0x81, 0xe5, 0x85, 0xf8, 0xb8, 0x98, 0x3c, - 0x5d, 0x24, 0x98, 0x15, 0x18, 0x35, 0x78, 0x83, 0x98, 0x3c, 0x5d, 0x84, 0x84, 0xb8, 0x58, 0x52, - 0x12, 0x4b, 0x12, 0x25, 0x58, 0x14, 0x18, 0x35, 0x78, 0x82, 0xc0, 0x6c, 0xa5, 0x38, 0x2e, 0x2e, - 0x84, 0xf9, 0x42, 0xfc, 0x5c, 0xdc, 0x01, 0x8e, 0xce, 0xde, 0xae, 0x21, 0xf1, 0xc1, 0x21, 0x8e, - 0x21, 0x02, 0x0c, 0x42, 0x7c, 0x5c, 0x5c, 0x50, 0x81, 0x20, 0xd7, 0x40, 0x01, 0x46, 0x24, 0x05, - 0x2e, 0x8e, 0x21, 0x8e, 0x02, 0x4c, 0x48, 0x0a, 0xdc, 0x3c, 0xfd, 0x04, 0x98, 0x91, 0xf8, 0xae, - 0x41, 0x41, 0x02, 0x2c, 0x4e, 0xd6, 0x17, 0x1e, 0xca, 0x31, 0xdc, 0x78, 0x28, 0xc7, 0xf0, 0xe1, - 0xa1, 0x1c, 0x63, 0xc3, 0x23, 0x39, 0xc6, 0x15, 0x8f, 0xe4, 0x18, 0x4f, 0x3c, 0x92, 0x63, 0xbc, - 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x17, 0x8f, 0xe4, 0x18, 0x3e, 0x3c, 0x92, 0x63, - 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x58, 0xc1, - 0x7e, 0x49, 0x62, 0x03, 0x87, 0x97, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x9d, 0xe3, 0x51, - 0x57, 0x01, 0x00, 0x00, -} - -func (x Packet_PacketType) String() string { - s, ok := Packet_PacketType_name[int32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} -func (this *Packet) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Packet) - if !ok { - that2, ok := that.(Packet) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Type != that1.Type { - return false - } - if !this.Stat.Equal(that1.Stat) { - return false - } - if this.ID != that1.ID { - return false - } - if !bytes.Equal(this.Data, that1.Data) { - return false +func (x *Packet) GetID() uint32 { + if x != nil { + return x.ID } - return true -} -func (this *Packet) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 8) - s = append(s, "&types.Packet{") - s = append(s, "Type: "+fmt.Sprintf("%#v", this.Type)+",\n") - if this.Stat != nil { - s = append(s, "Stat: "+fmt.Sprintf("%#v", this.Stat)+",\n") - } - s = append(s, "ID: "+fmt.Sprintf("%#v", this.ID)+",\n") - s = append(s, "Data: "+fmt.Sprintf("%#v", this.Data)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringWire(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func (m *Packet) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Packet) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return 0 } -func (m *Packet) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintWire(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0x22 - } - if m.ID != 0 { - i = encodeVarintWire(dAtA, i, uint64(m.ID)) - i-- - dAtA[i] = 0x18 - } - if m.Stat != nil { - { - size, err := m.Stat.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintWire(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Type != 0 { - i = encodeVarintWire(dAtA, i, uint64(m.Type)) - i-- - dAtA[i] = 0x8 +func (x *Packet) GetData() []byte { + if x != nil { + return x.Data } - return len(dAtA) - i, nil + return nil } -func encodeVarintWire(dAtA []byte, offset int, v uint64) int { - offset -= sovWire(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Packet) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Type != 0 { - n += 1 + sovWire(uint64(m.Type)) - } - if m.Stat != nil { - l = m.Stat.Size() - n += 1 + l + sovWire(uint64(l)) - } - if m.ID != 0 { - n += 1 + sovWire(uint64(m.ID)) - } - l = len(m.Data) - if l > 0 { - n += 1 + l + sovWire(uint64(l)) - } - return n +var File_github_com_tonistiigi_fsutil_types_wire_proto protoreflect.FileDescriptor + +var file_github_com_tonistiigi_fsutil_types_wire_proto_rawDesc = []byte{ + 0x0a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x6f, 0x6e, + 0x69, 0x73, 0x74, 0x69, 0x69, 0x67, 0x69, 0x2f, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x0c, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x1a, 0x2d, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x6f, 0x6e, 0x69, 0x73, 0x74, + 0x69, 0x69, 0x67, 0x69, 0x2f, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe9, 0x01, 0x0a, + 0x06, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x33, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x50, 0x61, 0x63, 0x6b, + 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x26, 0x0a, 0x04, + 0x73, 0x74, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x66, 0x73, 0x75, + 0x74, 0x69, 0x6c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, 0x04, + 0x73, 0x74, 0x61, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x02, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x5e, 0x0a, 0x0a, 0x50, 0x61, 0x63, 0x6b, + 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, + 0x5f, 0x53, 0x54, 0x41, 0x54, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x50, 0x41, 0x43, 0x4b, 0x45, + 0x54, 0x5f, 0x52, 0x45, 0x51, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x50, 0x41, 0x43, 0x4b, 0x45, + 0x54, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x50, 0x41, 0x43, 0x4b, + 0x45, 0x54, 0x5f, 0x46, 0x49, 0x4e, 0x10, 0x03, 0x12, 0x0e, 0x0a, 0x0a, 0x50, 0x41, 0x43, 0x4b, + 0x45, 0x54, 0x5f, 0x45, 0x52, 0x52, 0x10, 0x04, 0x42, 0x24, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x6f, 0x6e, 0x69, 0x73, 0x74, 0x69, 0x69, 0x67, + 0x69, 0x2f, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -func sovWire(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozWire(x uint64) (n int) { - return sovWire(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *Packet) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Packet{`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `Stat:` + strings.Replace(fmt.Sprintf("%v", this.Stat), "Stat", "Stat", 1) + `,`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, - `Data:` + fmt.Sprintf("%v", this.Data) + `,`, - `}`, - }, "") - return s -} -func valueToStringWire(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *Packet) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWire - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Packet: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Packet: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWire - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= Packet_PacketType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Stat", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWire - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthWire - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthWire - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Stat == nil { - m.Stat = &Stat{} - } - if err := m.Stat.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - m.ID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWire - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ID |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWire - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWire - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthWire - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipWire(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthWire - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthWire - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } +var ( + file_github_com_tonistiigi_fsutil_types_wire_proto_rawDescOnce sync.Once + file_github_com_tonistiigi_fsutil_types_wire_proto_rawDescData = file_github_com_tonistiigi_fsutil_types_wire_proto_rawDesc +) - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipWire(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowWire - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break +func file_github_com_tonistiigi_fsutil_types_wire_proto_rawDescGZIP() []byte { + file_github_com_tonistiigi_fsutil_types_wire_proto_rawDescOnce.Do(func() { + file_github_com_tonistiigi_fsutil_types_wire_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_tonistiigi_fsutil_types_wire_proto_rawDescData) + }) + return file_github_com_tonistiigi_fsutil_types_wire_proto_rawDescData +} + +var file_github_com_tonistiigi_fsutil_types_wire_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_github_com_tonistiigi_fsutil_types_wire_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_github_com_tonistiigi_fsutil_types_wire_proto_goTypes = []interface{}{ + (Packet_PacketType)(0), // 0: fsutil.types.Packet.PacketType + (*Packet)(nil), // 1: fsutil.types.Packet + (*Stat)(nil), // 2: fsutil.types.Stat +} +var file_github_com_tonistiigi_fsutil_types_wire_proto_depIdxs = []int32{ + 0, // 0: fsutil.types.Packet.type:type_name -> fsutil.types.Packet.PacketType + 2, // 1: fsutil.types.Packet.stat:type_name -> fsutil.types.Stat + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_github_com_tonistiigi_fsutil_types_wire_proto_init() } +func file_github_com_tonistiigi_fsutil_types_wire_proto_init() { + if File_github_com_tonistiigi_fsutil_types_wire_proto != nil { + return + } + file_github_com_tonistiigi_fsutil_types_stat_proto_init() + if !protoimpl.UnsafeEnabled { + file_github_com_tonistiigi_fsutil_types_wire_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Packet); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil } } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowWire - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowWire - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthWire - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupWire - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthWire - } - if depth == 0 { - return iNdEx, nil - } } - return 0, io.ErrUnexpectedEOF + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_github_com_tonistiigi_fsutil_types_wire_proto_rawDesc, + NumEnums: 1, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_github_com_tonistiigi_fsutil_types_wire_proto_goTypes, + DependencyIndexes: file_github_com_tonistiigi_fsutil_types_wire_proto_depIdxs, + EnumInfos: file_github_com_tonistiigi_fsutil_types_wire_proto_enumTypes, + MessageInfos: file_github_com_tonistiigi_fsutil_types_wire_proto_msgTypes, + }.Build() + File_github_com_tonistiigi_fsutil_types_wire_proto = out.File + file_github_com_tonistiigi_fsutil_types_wire_proto_rawDesc = nil + file_github_com_tonistiigi_fsutil_types_wire_proto_goTypes = nil + file_github_com_tonistiigi_fsutil_types_wire_proto_depIdxs = nil } - -var ( - ErrInvalidLengthWire = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowWire = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupWire = fmt.Errorf("proto: unexpected end of group") -) diff --git a/types/wire.proto b/types/wire.proto index 3e85000c..ae2edb15 100644 --- a/types/wire.proto +++ b/types/wire.proto @@ -2,9 +2,9 @@ syntax = "proto3"; package fsutil.types; -option go_package = "types"; +option go_package = "github.com/tonistiigi/fsutil/types"; -import "stat.proto"; +import "github.com/tonistiigi/fsutil/types/stat.proto"; message Packet { enum PacketType { From 069baf6a66f5c63a82fb679ff2319ed2ee970fbd Mon Sep 17 00:00:00 2001 From: "Jonathan A. Sternberg" Date: Thu, 26 Sep 2024 11:11:00 -0500 Subject: [PATCH 43/76] types: stat clone drops hidden proto fields The stat clone returned by protobuf returns a version of `types.Stat` that isn't compatible with some tests in buildkit. This changes clone to create a new type without cloning the hidden protobuf types. Signed-off-by: Jonathan A. Sternberg --- types/stat.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/types/stat.go b/types/stat.go index 9a5ae09e..466c8f85 100644 --- a/types/stat.go +++ b/types/stat.go @@ -19,5 +19,22 @@ func (s *Stat) Unmarshal(dAtA []byte) error { } func (s *Stat) Clone() *Stat { - return proto.Clone(s).(*Stat) + clone := &Stat{ + Path: s.Path, + Mode: s.Mode, + Uid: s.Uid, + Gid: s.Gid, + Size: s.Size, + ModTime: s.ModTime, + Linkname: s.Linkname, + Devmajor: s.Devmajor, + Devminor: s.Devminor, + } + if s.Xattrs != nil { + s.Xattrs = make(map[string][]byte, len(s.Xattrs)) + for k, v := range s.Xattrs { + clone.Xattrs[k] = v + } + } + return clone } From 1876fbf717936bda246e6bac993d667e3b11abac Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Fri, 27 Sep 2024 18:43:55 -0700 Subject: [PATCH 44/76] update Go to 1.23 Signed-off-by: Tonis Tiigi --- .github/workflows/ci.yml | 6 ++++-- Dockerfile | 2 +- hack/dockerfiles/generated-files.Dockerfile | 2 +- hack/dockerfiles/gomod.Dockerfile | 2 +- hack/dockerfiles/lint.Dockerfile | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e709e6de..e2d075d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,8 +64,9 @@ jobs: strategy: matrix: go: + - "1.23" + - "1.22" - "1.21" - - "1.20" mode: - "root" - "noroot" @@ -100,8 +101,9 @@ jobs: - macos-latest - windows-latest go: + - "1.23" + - "1.22" - "1.21" - - "1.20" steps: - name: Checkout diff --git a/Dockerfile b/Dockerfile index 21c1f39f..d5f22283 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -ARG GO_VERSION=1.21 +ARG GO_VERSION=1.23 ARG XX_VERSION=1.4.0 FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx diff --git a/hack/dockerfiles/generated-files.Dockerfile b/hack/dockerfiles/generated-files.Dockerfile index 32f4fced..1b777ab0 100644 --- a/hack/dockerfiles/generated-files.Dockerfile +++ b/hack/dockerfiles/generated-files.Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -ARG GO_VERSION=1.21 +ARG GO_VERSION=1.23 ARG PROTOC_VERSION=3.11.4 FROM golang:${GO_VERSION} AS base diff --git a/hack/dockerfiles/gomod.Dockerfile b/hack/dockerfiles/gomod.Dockerfile index 0e98d1bb..bbaeef75 100644 --- a/hack/dockerfiles/gomod.Dockerfile +++ b/hack/dockerfiles/gomod.Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -ARG GO_VERSION=1.21 +ARG GO_VERSION=1.23 FROM golang:${GO_VERSION}-alpine AS gomod RUN apk add --no-cache git diff --git a/hack/dockerfiles/lint.Dockerfile b/hack/dockerfiles/lint.Dockerfile index d6d173dc..cbc24a66 100644 --- a/hack/dockerfiles/lint.Dockerfile +++ b/hack/dockerfiles/lint.Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -ARG GO_VERSION=1.21 +ARG GO_VERSION=1.23 ARG GOLANGCI_LINT_VERSION=1.54.2 FROM golang:${GO_VERSION}-alpine From 556fa96046c9f8580f9a36c559328c1d64443d13 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Fri, 27 Sep 2024 18:49:20 -0700 Subject: [PATCH 45/76] update golangci-lint to 1.61.0 Signed-off-by: Tonis Tiigi --- hack/dockerfiles/lint.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hack/dockerfiles/lint.Dockerfile b/hack/dockerfiles/lint.Dockerfile index cbc24a66..50b8ce07 100644 --- a/hack/dockerfiles/lint.Dockerfile +++ b/hack/dockerfiles/lint.Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 ARG GO_VERSION=1.23 -ARG GOLANGCI_LINT_VERSION=1.54.2 +ARG GOLANGCI_LINT_VERSION=1.61.0 FROM golang:${GO_VERSION}-alpine RUN apk add --no-cache git gcc musl-dev From dca3d5b112d629b411cfd3b4b3bffe3e63e8d51f Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Fri, 27 Sep 2024 19:05:41 -0700 Subject: [PATCH 46/76] update xx to v1.5.0 Signed-off-by: Tonis Tiigi --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d5f22283..3a76d341 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 ARG GO_VERSION=1.23 -ARG XX_VERSION=1.4.0 +ARG XX_VERSION=1.5.0 FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx From 3a8c87e7db2fdc5d82035f1fc50e6af4e5fb705a Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Fri, 27 Sep 2024 17:57:05 -0700 Subject: [PATCH 47/76] add support for non-octal mode setting Signed-off-by: Tonis Tiigi --- bench/go.mod | 2 +- bench/go.sum | 2 ++ copy/copy.go | 26 ++++++++++++---- copy/copy_linux.go | 4 ++- copy/copy_unix.go | 4 ++- copy/copy_unix_test.go | 68 ++++++++++++++++++++++++++++++++++++++++++ copy/copy_windows.go | 4 +++ go.mod | 3 +- go.sum | 2 ++ 9 files changed, 105 insertions(+), 10 deletions(-) diff --git a/bench/go.mod b/bench/go.mod index d6eebcaf..0b0fbc08 100644 --- a/bench/go.mod +++ b/bench/go.mod @@ -1,6 +1,6 @@ module github.com/tonistiigi/fsutil/bench -go 1.20 +go 1.21 require ( github.com/containerd/continuity v0.4.1 diff --git a/bench/go.sum b/bench/go.sum index b94c40cf..a26a4fb0 100644 --- a/bench/go.sum +++ b/bench/go.sum @@ -544,6 +544,7 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= @@ -888,6 +889,7 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= diff --git a/copy/copy.go b/copy/copy.go index f8cc0a43..c2b1ab97 100644 --- a/copy/copy.go +++ b/copy/copy.go @@ -13,6 +13,7 @@ import ( "github.com/containerd/continuity/fs" "github.com/moby/patternmatcher" "github.com/pkg/errors" + mode "github.com/tonistiigi/dchapes-mode" "github.com/tonistiigi/fsutil" ) @@ -83,12 +84,21 @@ func Copy(ctx context.Context, srcRoot, src, dstRoot, dst string, opts ...Opt) e } } + var modeSet *mode.Set + if ci.ModeStr != "" { + ms, err := mode.ParseWithUmask(ci.ModeStr, 0) + if err != nil { + return err + } + modeSet = &ms + } + dst, err := fs.RootPath(dstRoot, filepath.Clean(dst)) if err != nil { return err } - c, err := newCopier(dstRoot, ci.Chown, ci.Utime, ci.Mode, ci.XAttrErrorHandler, ci.IncludePatterns, ci.ExcludePatterns, ci.AlwaysReplaceExistingDestPaths, ci.ChangeFunc) + c, err := newCopier(dstRoot, ci.Chown, ci.Utime, ci.Mode, modeSet, ci.XAttrErrorHandler, ci.IncludePatterns, ci.ExcludePatterns, ci.AlwaysReplaceExistingDestPaths, ci.ChangeFunc) if err != nil { return err } @@ -161,10 +171,12 @@ type Chowner func(*User) (*User, error) type XAttrErrorHandler func(dst, src, xattrKey string, err error) error type CopyInfo struct { - Chown Chowner - Utime *time.Time - AllowWildcards bool - Mode *int + Chown Chowner + Utime *time.Time + AllowWildcards bool + Mode *int + // ModeStr is mode in non-octal format. Overrides Mode if non-empty. + ModeStr string XAttrErrorHandler XAttrErrorHandler CopyDirContents bool FollowLinks bool @@ -234,6 +246,7 @@ type copier struct { chown Chowner utime *time.Time mode *int + modeSet *mode.Set inodes map[uint64]string xattrErrorHandler XAttrErrorHandler includePatternMatcher *patternmatcher.PatternMatcher @@ -250,7 +263,7 @@ type parentDir struct { copied bool } -func newCopier(root string, chown Chowner, tm *time.Time, mode *int, xeh XAttrErrorHandler, includePatterns, excludePatterns []string, alwaysReplaceExistingDestPaths bool, changeFunc fsutil.ChangeFunc) (*copier, error) { +func newCopier(root string, chown Chowner, tm *time.Time, mode *int, modeSet *mode.Set, xeh XAttrErrorHandler, includePatterns, excludePatterns []string, alwaysReplaceExistingDestPaths bool, changeFunc fsutil.ChangeFunc) (*copier, error) { if xeh == nil { xeh = func(dst, src, key string, err error) error { return err @@ -282,6 +295,7 @@ func newCopier(root string, chown Chowner, tm *time.Time, mode *int, xeh XAttrEr utime: tm, xattrErrorHandler: xeh, mode: mode, + modeSet: modeSet, includePatternMatcher: includePatternMatcher, excludePatternMatcher: excludePatternMatcher, changefn: changeFunc, diff --git a/copy/copy_linux.go b/copy/copy_linux.go index 6d9b490c..9b046c53 100644 --- a/copy/copy_linux.go +++ b/copy/copy_linux.go @@ -29,7 +29,9 @@ func (c *copier) copyFileInfo(fi os.FileInfo, src, name string) error { } m := fi.Mode() - if c.mode != nil { + if c.modeSet != nil { + m = c.modeSet.Apply(m) + } else if c.mode != nil { m = os.FileMode(*c.mode).Perm() if *c.mode&syscall.S_ISGID != 0 { m |= os.ModeSetgid diff --git a/copy/copy_unix.go b/copy/copy_unix.go index 4a7d0c86..e90a41d3 100644 --- a/copy/copy_unix.go +++ b/copy/copy_unix.go @@ -30,7 +30,9 @@ func (c *copier) copyFileInfo(fi os.FileInfo, src, name string) error { } m := fi.Mode() - if c.mode != nil { + if c.modeSet != nil { + m = c.modeSet.Apply(m) + } else if c.mode != nil { m = os.FileMode(*c.mode).Perm() if *c.mode&syscall.S_ISGID != 0 { m |= os.ModeSetgid diff --git a/copy/copy_unix_test.go b/copy/copy_unix_test.go index 405f757c..55f40817 100644 --- a/copy/copy_unix_test.go +++ b/copy/copy_unix_test.go @@ -93,3 +93,71 @@ func TestCopySetuid(t *testing.T) { assert.Equal(t, os.FileMode(0), fi.Mode()&os.ModeSetgid) assert.Equal(t, os.FileMode(0), fi.Mode()&os.ModeSticky) } + +func TestCopyModeTextFormat(t *testing.T) { + t1 := t.TempDir() + + err := os.WriteFile(filepath.Join(t1, "file"), []byte("hello"), 0644) + require.NoError(t, err) + + err = os.WriteFile(filepath.Join(t1, "executable_file"), []byte("world"), 0755) + require.NoError(t, err) + + err = os.Mkdir(filepath.Join(t1, "dir"), 0750) + require.NoError(t, err) + + err = os.Mkdir(filepath.Join(t1, "restricted_dir"), 0700) + require.NoError(t, err) + + testCases := []struct { + name string + modeStr string + expectedFilePerm os.FileMode + expectedExecPerm os.FileMode + expectedDirPerm os.FileMode + expectedRestrictDirPerm os.FileMode + }{ + {"remove write for others", "go-w", 0644, 0755, 0750, 0700}, + {"add execute for user", "u+x", 0744, 0755, 0750, 0700}, + {"remove all permissions for group", "g-rwx", 0604, 0705, 0700, 0700}, + {"add read for others", "o+r", 0644, 0755, 0754, 0704}, + {"remove execute for all", "a-x", 0644, 0644, 0640, 0600}, + {"remove others and add execute for group", "o-rwx,g+x", 0650, 0750, 0750, 0710}, + {"capital X (apply execute only if directory)", "a+X", 0644, 0755, 0751, 0711}, + {"remove execute and add write for user", "u-x,u+w", 0644, 0655, 0650, 0600}, + {"add execute for user and others", "u+x,o+x", 0745, 0755, 0751, 0701}, + {"add write and read for group and others", "g+rw,o+rw", 0666, 0777, 0776, 0766}, + {"set read-only for all", "a=r", 0444, 0444, 0444, 0444}, + {"set full permissions for user only", "u=rwx,g=,o=", 0700, 0700, 0700, 0700}, + {"remove all permissions for others", "o-rwx", 0640, 0750, 0750, 0700}, + {"remove read for group, add execute for all", "g-r,a+x", 0715, 0715, 0711, 0711}, + {"complex permissions change", "u+rw,g+r,o-x,o+w", 0646, 0756, 0752, 0742}, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + t2 := t.TempDir() + + err := Copy(context.TODO(), t1, ".", t2, ".", WithCopyInfo(CopyInfo{ + ModeStr: tc.modeStr, + })) + require.NoError(t, err) + + fi, err := os.Lstat(filepath.Join(t2, "file")) + require.NoError(t, err) + assert.Equal(t, tc.expectedFilePerm, fi.Mode().Perm(), "file %04o, got %04o", tc.expectedFilePerm, fi.Mode().Perm()) + + execFileInfo, err := os.Lstat(filepath.Join(t2, "executable_file")) + require.NoError(t, err) + assert.Equal(t, tc.expectedExecPerm, execFileInfo.Mode().Perm(), "executable file %04o, got %04o", tc.expectedExecPerm, execFileInfo.Mode().Perm()) + + dirInfo, err := os.Lstat(filepath.Join(t2, "dir")) + require.NoError(t, err) + assert.Equal(t, tc.expectedDirPerm, dirInfo.Mode().Perm(), "dir %04o, got %04o", tc.expectedDirPerm, dirInfo.Mode().Perm()) + + restrictDirInfo, err := os.Lstat(filepath.Join(t2, "restricted_dir")) + require.NoError(t, err) + assert.Equal(t, tc.expectedRestrictDirPerm, restrictDirInfo.Mode().Perm(), "restricted dir %04o, got %04o", tc.expectedRestrictDirPerm, restrictDirInfo.Mode().Perm()) + }) + } +} diff --git a/copy/copy_windows.go b/copy/copy_windows.go index 58f822d0..a049565e 100644 --- a/copy/copy_windows.go +++ b/copy/copy_windows.go @@ -37,6 +37,10 @@ func getFileSecurityInfo(name string) (*windows.SID, *windows.ACL, error) { } func (c *copier) copyFileInfo(fi os.FileInfo, src, name string) error { + if c.modeSet != nil { + return errors.Errorf("non-octal mode not supported on windows") + } + if err := os.Chmod(name, fi.Mode()); err != nil { return errors.Wrapf(err, "failed to chmod %s", name) } diff --git a/go.mod b/go.mod index 4aeae36d..c84c4aa6 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/tonistiigi/fsutil -go 1.20 +go 1.21 require ( github.com/Microsoft/go-winio v0.5.2 @@ -9,6 +9,7 @@ require ( github.com/opencontainers/go-digest v1.0.0 github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.8.4 + github.com/tonistiigi/dchapes-mode v0.0.0-20241001053921-ca0759fec205 golang.org/x/sync v0.1.0 golang.org/x/sys v0.11.0 google.golang.org/protobuf v1.31.0 diff --git a/go.sum b/go.sum index 488fbeab..dac6bf18 100644 --- a/go.sum +++ b/go.sum @@ -26,6 +26,8 @@ github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/tonistiigi/dchapes-mode v0.0.0-20241001053921-ca0759fec205 h1:eUk79E1w8yMtXeHSzjKorxuC8qJOnyXQnLaJehxpJaI= +github.com/tonistiigi/dchapes-mode v0.0.0-20241001053921-ca0759fec205/go.mod h1:3Iuxbr0P7D3zUzBMAZB+ois3h/et0shEz0qApgHYGpY= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= From f653bdaefa9d976ba531fc9a8ca1fac9abcdbe9e Mon Sep 17 00:00:00 2001 From: "Jonathan A. Sternberg" Date: Wed, 2 Oct 2024 21:48:26 -0500 Subject: [PATCH 48/76] protobuf: add vtproto to supplement protobuf marshaling This adds the vtproto generator to generate code that results in faster marshaling and unmarshaling. vtproto is similar to gogo but it generates additional code on top of the existing protobuf structures rather than changing the generator itself. Signed-off-by: Jonathan A. Sternberg --- bench/go.mod | 1 + bench/go.sum | 2 + go.mod | 1 + go.sum | 2 + hack/dockerfiles/generated-files.Dockerfile | 16 +- receive.go | 2 +- tools/tools.go | 1 + types/stat.go | 29 +- types/stat.pb.go | 54 +- types/stat.proto | 2 + types/stat_vtproto.pb.go | 1124 +++++++++++++++++++ types/wire.go | 8 +- types/wire.pb.go | 49 +- types/wire.proto | 14 +- types/wire_vtproto.pb.go | 555 +++++++++ 15 files changed, 1775 insertions(+), 85 deletions(-) create mode 100644 types/stat_vtproto.pb.go create mode 100644 types/wire_vtproto.pb.go diff --git a/bench/go.mod b/bench/go.mod index 0b0fbc08..74345712 100644 --- a/bench/go.mod +++ b/bench/go.mod @@ -24,6 +24,7 @@ require ( github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.0.1 // indirect github.com/opencontainers/runc v1.0.0-rc93 // indirect + github.com/planetscale/vtprotobuf v0.6.0 // indirect github.com/sirupsen/logrus v1.8.1 // indirect go.opencensus.io v0.22.3 // indirect golang.org/x/sys v0.11.0 // indirect diff --git a/bench/go.sum b/bench/go.sum index a26a4fb0..2d4a1745 100644 --- a/bench/go.sum +++ b/bench/go.sum @@ -468,6 +468,8 @@ github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/planetscale/vtprotobuf v0.6.0 h1:nBeETjudeJ5ZgBHUz1fVHvbqUKnYOXNhsIEabROxmNA= +github.com/planetscale/vtprotobuf v0.6.0/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= diff --git a/go.mod b/go.mod index c84c4aa6..f7865811 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,7 @@ require ( github.com/moby/patternmatcher v0.5.0 github.com/opencontainers/go-digest v1.0.0 github.com/pkg/errors v0.9.1 + github.com/planetscale/vtprotobuf v0.6.0 github.com/stretchr/testify v1.8.4 github.com/tonistiigi/dchapes-mode v0.0.0-20241001053921-ca0759fec205 golang.org/x/sync v0.1.0 diff --git a/go.sum b/go.sum index dac6bf18..b4edbafe 100644 --- a/go.sum +++ b/go.sum @@ -18,6 +18,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/planetscale/vtprotobuf v0.6.0 h1:nBeETjudeJ5ZgBHUz1fVHvbqUKnYOXNhsIEabROxmNA= +github.com/planetscale/vtprotobuf v0.6.0/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= diff --git a/hack/dockerfiles/generated-files.Dockerfile b/hack/dockerfiles/generated-files.Dockerfile index 1b777ab0..0ce0d057 100644 --- a/hack/dockerfiles/generated-files.Dockerfile +++ b/hack/dockerfiles/generated-files.Dockerfile @@ -18,6 +18,18 @@ RUN < 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Stat) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (this *Stat) EqualVT(that *Stat) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Path != that.Path { + return false + } + if this.Mode != that.Mode { + return false + } + if this.Uid != that.Uid { + return false + } + if this.Gid != that.Gid { + return false + } + if this.Size != that.Size { + return false + } + if this.ModTime != that.ModTime { + return false + } + if this.Linkname != that.Linkname { + return false + } + if this.Devmajor != that.Devmajor { + return false + } + if this.Devminor != that.Devminor { + return false + } + if len(this.Xattrs) != len(that.Xattrs) { + return false + } + for i, vx := range this.Xattrs { + vy, ok := that.Xattrs[i] + if !ok { + return false + } + if string(vx) != string(vy) { + return false + } + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Stat) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Stat) + if !ok { + return false + } + return this.EqualVT(that) +} +func (m *Stat) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Stat) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Stat) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Xattrs) > 0 { + for k := range m.Xattrs { + v := m.Xattrs[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = protohelpers.EncodeVarint(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x52 + } + } + if m.Devminor != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Devminor)) + i-- + dAtA[i] = 0x48 + } + if m.Devmajor != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Devmajor)) + i-- + dAtA[i] = 0x40 + } + if len(m.Linkname) > 0 { + i -= len(m.Linkname) + copy(dAtA[i:], m.Linkname) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Linkname))) + i-- + dAtA[i] = 0x3a + } + if m.ModTime != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.ModTime)) + i-- + dAtA[i] = 0x30 + } + if m.Size != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Size)) + i-- + dAtA[i] = 0x28 + } + if m.Gid != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Gid)) + i-- + dAtA[i] = 0x20 + } + if m.Uid != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Uid)) + i-- + dAtA[i] = 0x18 + } + if m.Mode != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Mode)) + i-- + dAtA[i] = 0x10 + } + if len(m.Path) > 0 { + i -= len(m.Path) + copy(dAtA[i:], m.Path) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Path))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Stat) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Stat) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *Stat) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Xattrs) > 0 { + for k := range m.Xattrs { + v := m.Xattrs[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = protohelpers.EncodeVarint(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x52 + } + } + if m.Devminor != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Devminor)) + i-- + dAtA[i] = 0x48 + } + if m.Devmajor != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Devmajor)) + i-- + dAtA[i] = 0x40 + } + if len(m.Linkname) > 0 { + i -= len(m.Linkname) + copy(dAtA[i:], m.Linkname) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Linkname))) + i-- + dAtA[i] = 0x3a + } + if m.ModTime != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.ModTime)) + i-- + dAtA[i] = 0x30 + } + if m.Size != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Size)) + i-- + dAtA[i] = 0x28 + } + if m.Gid != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Gid)) + i-- + dAtA[i] = 0x20 + } + if m.Uid != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Uid)) + i-- + dAtA[i] = 0x18 + } + if m.Mode != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Mode)) + i-- + dAtA[i] = 0x10 + } + if len(m.Path) > 0 { + i -= len(m.Path) + copy(dAtA[i:], m.Path) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Path))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Stat) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Path) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Mode != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Mode)) + } + if m.Uid != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Uid)) + } + if m.Gid != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Gid)) + } + if m.Size != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Size)) + } + if m.ModTime != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.ModTime)) + } + l = len(m.Linkname) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Devmajor != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Devmajor)) + } + if m.Devminor != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Devminor)) + } + if len(m.Xattrs) > 0 { + for k, v := range m.Xattrs { + _ = k + _ = v + l = 1 + len(v) + protohelpers.SizeOfVarint(uint64(len(v))) + mapEntrySize := 1 + len(k) + protohelpers.SizeOfVarint(uint64(len(k))) + l + n += mapEntrySize + 1 + protohelpers.SizeOfVarint(uint64(mapEntrySize)) + } + } + n += len(m.unknownFields) + return n +} + +func (m *Stat) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Stat: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Stat: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Path = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Mode", wireType) + } + m.Mode = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Mode |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Uid", wireType) + } + m.Uid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Uid |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Gid", wireType) + } + m.Gid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Gid |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Size", wireType) + } + m.Size = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Size |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ModTime", wireType) + } + m.ModTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ModTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Linkname", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Linkname = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Devmajor", wireType) + } + m.Devmajor = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Devmajor |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Devminor", wireType) + } + m.Devminor = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Devminor |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Xattrs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Xattrs == nil { + m.Xattrs = make(map[string][]byte) + } + var mapkey string + var mapvalue []byte + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return protohelpers.ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return protohelpers.ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapbyteLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapbyteLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intMapbyteLen := int(mapbyteLen) + if intMapbyteLen < 0 { + return protohelpers.ErrInvalidLength + } + postbytesIndex := iNdEx + intMapbyteLen + if postbytesIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postbytesIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = make([]byte, mapbyteLen) + copy(mapvalue, dAtA[iNdEx:postbytesIndex]) + iNdEx = postbytesIndex + } else { + iNdEx = entryPreIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Xattrs[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Stat) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Stat: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Stat: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + m.Path = stringValue + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Mode", wireType) + } + m.Mode = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Mode |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Uid", wireType) + } + m.Uid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Uid |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Gid", wireType) + } + m.Gid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Gid |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Size", wireType) + } + m.Size = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Size |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ModTime", wireType) + } + m.ModTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ModTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Linkname", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var stringValue string + if intStringLen > 0 { + stringValue = unsafe.String(&dAtA[iNdEx], intStringLen) + } + m.Linkname = stringValue + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Devmajor", wireType) + } + m.Devmajor = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Devmajor |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Devminor", wireType) + } + m.Devminor = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Devminor |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Xattrs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Xattrs == nil { + m.Xattrs = make(map[string][]byte) + } + var mapkey string + var mapvalue []byte + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return protohelpers.ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return protohelpers.ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + if intStringLenmapkey == 0 { + mapkey = "" + } else { + mapkey = unsafe.String(&dAtA[iNdEx], intStringLenmapkey) + } + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapbyteLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapbyteLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intMapbyteLen := int(mapbyteLen) + if intMapbyteLen < 0 { + return protohelpers.ErrInvalidLength + } + postbytesIndex := iNdEx + intMapbyteLen + if postbytesIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postbytesIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = dAtA[iNdEx:postbytesIndex] + iNdEx = postbytesIndex + } else { + iNdEx = entryPreIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Xattrs[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} diff --git a/types/wire.go b/types/wire.go index 541667ef..072323ef 100644 --- a/types/wire.go +++ b/types/wire.go @@ -1,7 +1,5 @@ package types -import "google.golang.org/protobuf/proto" - const ( PACKET_STAT = Packet_PACKET_STAT PACKET_REQ = Packet_PACKET_REQ @@ -11,13 +9,13 @@ const ( ) func (p *Packet) Marshal() ([]byte, error) { - return proto.MarshalOptions{Deterministic: true}.Marshal(p) + return p.MarshalVTStrict() } func (p *Packet) Unmarshal(dAtA []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(dAtA, p) + return p.UnmarshalVT(dAtA) } func (p *Packet) Size() int { - return proto.Size(p) + return p.SizeVT() } diff --git a/types/wire.pb.go b/types/wire.pb.go index 38953329..eeaa0f28 100644 --- a/types/wire.pb.go +++ b/types/wire.pb.go @@ -7,6 +7,7 @@ package types import ( + _ "github.com/planetscale/vtprotobuf/vtproto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -152,28 +153,32 @@ var file_github_com_tonistiigi_fsutil_types_wire_proto_rawDesc = []byte{ 0x0a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x6f, 0x6e, 0x69, 0x73, 0x74, 0x69, 0x69, 0x67, 0x69, 0x2f, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x0c, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x1a, 0x2d, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x6f, 0x6e, 0x69, 0x73, 0x74, - 0x69, 0x69, 0x67, 0x69, 0x2f, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe9, 0x01, 0x0a, - 0x06, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x33, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x50, 0x61, 0x63, 0x6b, - 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x26, 0x0a, 0x04, - 0x73, 0x74, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x66, 0x73, 0x75, - 0x74, 0x69, 0x6c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, 0x04, - 0x73, 0x74, 0x61, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x02, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x5e, 0x0a, 0x0a, 0x50, 0x61, 0x63, 0x6b, - 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, - 0x5f, 0x53, 0x54, 0x41, 0x54, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x50, 0x41, 0x43, 0x4b, 0x45, - 0x54, 0x5f, 0x52, 0x45, 0x51, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x50, 0x41, 0x43, 0x4b, 0x45, - 0x54, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x50, 0x41, 0x43, 0x4b, - 0x45, 0x54, 0x5f, 0x46, 0x49, 0x4e, 0x10, 0x03, 0x12, 0x0e, 0x0a, 0x0a, 0x50, 0x41, 0x43, 0x4b, - 0x45, 0x54, 0x5f, 0x45, 0x52, 0x52, 0x10, 0x04, 0x42, 0x24, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x6f, 0x6e, 0x69, 0x73, 0x74, 0x69, 0x69, 0x67, - 0x69, 0x2f, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x0c, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x1a, 0x33, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x74, + 0x73, 0x63, 0x61, 0x6c, 0x65, 0x2f, 0x76, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2f, 0x76, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, + 0x6f, 0x6e, 0x69, 0x73, 0x74, 0x69, 0x69, 0x67, 0x69, 0x2f, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, + 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0xef, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x33, 0x0a, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x66, 0x73, 0x75, + 0x74, 0x69, 0x6c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, + 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x12, 0x26, 0x0a, 0x04, 0x73, 0x74, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x12, 0x2e, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x53, + 0x74, 0x61, 0x74, 0x52, 0x04, 0x73, 0x74, 0x61, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x5e, 0x0a, + 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x50, + 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, + 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x52, 0x45, 0x51, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, + 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x10, 0x02, 0x12, 0x0e, 0x0a, + 0x0a, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x46, 0x49, 0x4e, 0x10, 0x03, 0x12, 0x0e, 0x0a, + 0x0a, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x45, 0x52, 0x52, 0x10, 0x04, 0x3a, 0x04, 0xa8, + 0xa6, 0x1f, 0x01, 0x42, 0x24, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x74, 0x6f, 0x6e, 0x69, 0x73, 0x74, 0x69, 0x69, 0x67, 0x69, 0x2f, 0x66, 0x73, 0x75, + 0x74, 0x69, 0x6c, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/types/wire.proto b/types/wire.proto index ae2edb15..470050b2 100644 --- a/types/wire.proto +++ b/types/wire.proto @@ -4,16 +4,18 @@ package fsutil.types; option go_package = "github.com/tonistiigi/fsutil/types"; +import "github.com/planetscale/vtprotobuf/vtproto/ext.proto"; import "github.com/tonistiigi/fsutil/types/stat.proto"; message Packet { + option (vtproto.mempool) = true; enum PacketType { - PACKET_STAT = 0; - PACKET_REQ = 1; - PACKET_DATA = 2; - PACKET_FIN = 3; - PACKET_ERR = 4; - } + PACKET_STAT = 0; + PACKET_REQ = 1; + PACKET_DATA = 2; + PACKET_FIN = 3; + PACKET_ERR = 4; + } PacketType type = 1; Stat stat = 2; uint32 ID = 3; diff --git a/types/wire_vtproto.pb.go b/types/wire_vtproto.pb.go new file mode 100644 index 00000000..86c22cde --- /dev/null +++ b/types/wire_vtproto.pb.go @@ -0,0 +1,555 @@ +// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. +// protoc-gen-go-vtproto version: v0.6.0 +// source: github.com/tonistiigi/fsutil/types/wire.proto + +package types + +import ( + fmt "fmt" + protohelpers "github.com/planetscale/vtprotobuf/protohelpers" + proto "google.golang.org/protobuf/proto" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +func (m *Packet) CloneVT() *Packet { + if m == nil { + return (*Packet)(nil) + } + r := PacketFromVTPool() + r.Type = m.Type + r.Stat = m.Stat.CloneVT() + r.ID = m.ID + if rhs := m.Data; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.Data = tmpBytes + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Packet) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (this *Packet) EqualVT(that *Packet) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Type != that.Type { + return false + } + if !this.Stat.EqualVT(that.Stat) { + return false + } + if this.ID != that.ID { + return false + } + if string(this.Data) != string(that.Data) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Packet) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Packet) + if !ok { + return false + } + return this.EqualVT(that) +} +func (m *Packet) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Packet) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Packet) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x22 + } + if m.ID != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.ID)) + i-- + dAtA[i] = 0x18 + } + if m.Stat != nil { + size, err := m.Stat.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + if m.Type != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Packet) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Packet) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *Packet) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x22 + } + if m.ID != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.ID)) + i-- + dAtA[i] = 0x18 + } + if m.Stat != nil { + size, err := m.Stat.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + if m.Type != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +var vtprotoPool_Packet = sync.Pool{ + New: func() interface{} { + return &Packet{} + }, +} + +func (m *Packet) ResetVT() { + if m != nil { + f0 := m.Data[:0] + m.Reset() + m.Data = f0 + } +} +func (m *Packet) ReturnToVTPool() { + if m != nil { + m.ResetVT() + vtprotoPool_Packet.Put(m) + } +} +func PacketFromVTPool() *Packet { + return vtprotoPool_Packet.Get().(*Packet) +} +func (m *Packet) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Type != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Type)) + } + if m.Stat != nil { + l = m.Stat.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.ID != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.ID)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *Packet) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Packet: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Packet: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= Packet_PacketType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stat", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Stat == nil { + m.Stat = &Stat{} + } + if err := m.Stat.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + m.ID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ID |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Packet) UnmarshalVTUnsafe(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Packet: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Packet: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= Packet_PacketType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stat", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Stat == nil { + m.Stat = &Stat{} + } + if err := m.Stat.UnmarshalVTUnsafe(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + m.ID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ID |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = dAtA[iNdEx:postIndex] + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} From 26c6de69aadc923b9aa9feb87c4de078da2a98a0 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Mon, 21 Oct 2024 17:38:31 -0700 Subject: [PATCH 49/76] fix correcting timestamps for created destination dir after copy Signed-off-by: Tonis Tiigi --- copy/copy.go | 35 +++++++++++++++++++++++++++-------- copy/copy_test.go | 22 ++++++++++++++++++++++ copy/mkdir.go | 25 ++++++++++++++----------- 3 files changed, 63 insertions(+), 19 deletions(-) diff --git a/copy/copy.go b/copy/copy.go index c2b1ab97..f24e77f8 100644 --- a/copy/copy.go +++ b/copy/copy.go @@ -6,6 +6,7 @@ import ( "path" "path/filepath" "runtime" + "slices" "strings" "sync" "time" @@ -79,8 +80,10 @@ func Copy(ctx context.Context, srcRoot, src, dstRoot, dst string, opts ...Opt) e if err != nil { return err } - if err := MkdirAll(ensureDstPath, 0755, ci.Chown, ci.Utime); err != nil { + if createdDirs, err := MkdirAll(ensureDstPath, 0755, ci.Chown, ci.Utime); err != nil { return err + } else { + defer fixCreatedParentDirs(createdDirs, ci.Utime) } } @@ -120,10 +123,11 @@ func Copy(ctx context.Context, srcRoot, src, dstRoot, dst string, opts ...Opt) e if err != nil { return err } - dst, err := c.prepareTargetDir(srcFollowed, src, dst, ci.CopyDirContents) + dst, createdDirs, err := c.prepareTargetDir(srcFollowed, src, dst, ci.CopyDirContents) if err != nil { return err } + defer fixCreatedParentDirs(createdDirs, ci.Utime) if err := c.copy(ctx, srcFollowed, "", dst, false, patternmatcher.MatchInfo{}, patternmatcher.MatchInfo{}); err != nil { return err } @@ -132,16 +136,16 @@ func Copy(ctx context.Context, srcRoot, src, dstRoot, dst string, opts ...Opt) e return nil } -func (c *copier) prepareTargetDir(srcFollowed, src, destPath string, copyDirContents bool) (string, error) { +func (c *copier) prepareTargetDir(srcFollowed, src, destPath string, copyDirContents bool) (string, []string, error) { fiSrc, err := os.Lstat(srcFollowed) if err != nil { - return "", err + return "", nil, err } fiDest, err := os.Stat(destPath) if err != nil { if !os.IsNotExist(err) { - return "", errors.Wrap(err, "failed to lstat destination path") + return "", nil, errors.Wrap(err, "failed to lstat destination path") } } @@ -154,11 +158,14 @@ func (c *copier) prepareTargetDir(srcFollowed, src, destPath string, copyDirCont if copyDirContents && fiSrc.IsDir() && fiDest == nil { target = destPath } - if err := MkdirAll(target, 0755, c.chown, c.utime); err != nil { - return "", err + var createdDirs []string + if dirs, err := MkdirAll(target, 0755, c.chown, c.utime); err != nil { + return "", nil, err + } else { + createdDirs = dirs } - return destPath, nil + return destPath, createdDirs, nil } type User struct { @@ -689,3 +696,15 @@ func rel(basepath, targpath string) (string, error) { } return filepath.Rel(basepath, targpath) } + +func fixCreatedParentDirs(dirs []string, tm *time.Time) error { + slices.Reverse(dirs) + for _, d := range dirs { + if tm != nil { + if err := Utimes(d, tm); err != nil { + return err + } + } + } + return nil +} diff --git a/copy/copy_test.go b/copy/copy_test.go index 425ade68..a7353ef4 100644 --- a/copy/copy_test.go +++ b/copy/copy_test.go @@ -596,6 +596,28 @@ func TestCopyIncludeExclude(t *testing.T) { } } +func TestCopyFileWithPathTimestamp(t *testing.T) { + timestamp := time.Unix(0, 0) + apply := fstest.Apply( + fstest.CreateDir("/foo/", 0755), + fstest.CreateFile("/foo/bar", []byte{}, 0644), + ) + + t1 := t.TempDir() + t2 := t.TempDir() + + require.NoError(t, apply.Apply(t1)) + require.NoError(t, Copy(context.TODO(), t1, "/foo/bar", t2, "/test1/test2/test3/bar", WithCopyInfo(CopyInfo{ + CopyDirContents: true, + Utime: ×tamp, + }))) + + for _, s := range []string{"/test1/test2/test3/bar", "/test1/test2/test3", "/test1/test2", "/test1"} { + stat, _ := os.Stat(filepath.Join(t2, s)) + require.Equal(t, timestamp, stat.ModTime(), "path: %s", s) + } +} + type changeCollector struct { changes []string } diff --git a/copy/mkdir.go b/copy/mkdir.go index 9553c08b..b19c2c61 100644 --- a/copy/mkdir.go +++ b/copy/mkdir.go @@ -7,14 +7,14 @@ import ( ) // MkdirAll is forked os.MkdirAll -func MkdirAll(path string, perm os.FileMode, user Chowner, tm *time.Time) error { +func MkdirAll(path string, perm os.FileMode, user Chowner, tm *time.Time) ([]string, error) { // Fast path: if we can tell whether path is a directory or file, stop with success or error. dir, err := os.Stat(path) if err == nil { if dir.IsDir() { - return nil + return nil, nil } - return &os.PathError{Op: "mkdir", Path: path, Err: syscall.ENOTDIR} + return nil, &os.PathError{Op: "mkdir", Path: path, Err: syscall.ENOTDIR} } // Slow path: make sure parent exists and then call Mkdir for path. @@ -28,17 +28,19 @@ func MkdirAll(path string, perm os.FileMode, user Chowner, tm *time.Time) error j-- } + var createdDirs []string + if j > 1 { // Create parent. - err = MkdirAll(fixRootDirectory(path[:j-1]), perm, user, tm) + createdDirs, err = MkdirAll(fixRootDirectory(path[:j-1]), perm, user, tm) if err != nil { - return err + return nil, err } } dir, err1 := os.Lstat(path) if err1 == nil && dir.IsDir() { - return nil + return createdDirs, nil } // Parent now exists; invoke Mkdir and use its result. @@ -48,18 +50,19 @@ func MkdirAll(path string, perm os.FileMode, user Chowner, tm *time.Time) error // double-checking that directory doesn't exist. dir, err1 := os.Lstat(path) if err1 == nil && dir.IsDir() { - return nil + return createdDirs, nil } - return err + return nil, err } + createdDirs = append(createdDirs, path) if err := Chown(path, nil, user); err != nil { - return err + return nil, err } if err := Utimes(path, tm); err != nil { - return err + return nil, err } - return nil + return createdDirs, nil } From f4d5b3735ec9a61efbd49749091c04843b232f6e Mon Sep 17 00:00:00 2001 From: "Kirill A. Korinsky" Date: Fri, 1 Nov 2024 19:29:58 +0100 Subject: [PATCH 50/76] Fixed build on OpenBSD This fixes https://github.com/docker/buildx/issues/2772 --- copy/copy_openbsd.go | 38 ++++++++++++++++++++++++++++++++++++++ copy/copy_unix.go | 4 ++-- copy/stat_bsd.go | 2 +- copy/stat_openbsd.go | 17 +++++++++++++++++ 4 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 copy/copy_openbsd.go create mode 100644 copy/stat_openbsd.go diff --git a/copy/copy_openbsd.go b/copy/copy_openbsd.go new file mode 100644 index 00000000..18cd438f --- /dev/null +++ b/copy/copy_openbsd.go @@ -0,0 +1,38 @@ +//go:build openbsd +// +build openbsd + +package fs + +import ( + "io" + "os" + + "github.com/pkg/errors" + "golang.org/x/sys/unix" +) + +func copyFile(source, target string) error { + src, err := os.Open(source) + if err != nil { + return errors.Wrapf(err, "failed to open source %s", source) + } + defer src.Close() + tgt, err := os.Create(target) + if err != nil { + return errors.Wrapf(err, "failed to open target %s", target) + } + defer tgt.Close() + + return copyFileContent(tgt, src) +} + +func copyFileContent(dst, src *os.File) error { + buf := bufferPool.Get().(*[]byte) + _, err := io.CopyBuffer(dst, src, *buf) + bufferPool.Put(buf) + return err +} + +func mknod(dst string, mode uint32, rDev int) error { + return unix.Mknod(dst, uint32(mode), rDev) +} diff --git a/copy/copy_unix.go b/copy/copy_unix.go index e90a41d3..cb41247a 100644 --- a/copy/copy_unix.go +++ b/copy/copy_unix.go @@ -1,5 +1,5 @@ -//go:build solaris || darwin || freebsd -// +build solaris darwin freebsd +//go:build solaris || darwin || freebsd || openbsd +// +build solaris darwin freebsd openbsd package fs diff --git a/copy/stat_bsd.go b/copy/stat_bsd.go index 362142de..439574c0 100644 --- a/copy/stat_bsd.go +++ b/copy/stat_bsd.go @@ -1,4 +1,4 @@ -// +build darwin freebsd netbsd openbsd +// +build darwin freebsd netbsd package fs diff --git a/copy/stat_openbsd.go b/copy/stat_openbsd.go new file mode 100644 index 00000000..bfdf837e --- /dev/null +++ b/copy/stat_openbsd.go @@ -0,0 +1,17 @@ +// +build openbsd + +package fs + +import ( + "syscall" +) + +// Returns the last-accessed time +func StatAtime(st *syscall.Stat_t) syscall.Timespec { + return st.Atim +} + +// Returns the last-modified time +func StatMtime(st *syscall.Stat_t) syscall.Timespec { + return st.Mtim +} From 8df6b82bd38730f44cad817f4fea81d3e1951b83 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Sat, 2 Nov 2024 12:58:20 +0100 Subject: [PATCH 51/76] build and test openbsd Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/ci.yml | 20 +++++++++++++++----- docker-bake.hcl | 17 ++++++++++++++++- hack/Vagrantfile.freebsd | 4 ++-- hack/Vagrantfile.openbsd | 17 +++++++++++++++++ 4 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 hack/Vagrantfile.openbsd diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e2d075d7..d5a1037a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -128,9 +128,19 @@ jobs: flags: unit,go-${{ matrix.go }} token: ${{ secrets.CODECOV_TOKEN }} - test-freebsd-amd64: + test-bsd-amd64: runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + os: + - freebsd + - openbsd steps: + - + name: Prepare + run: | + echo "VAGRANT_FILE=hack/Vagrantfile.${{ matrix.os }}" >> $GITHUB_ENV - name: Checkout uses: actions/checkout@v4 @@ -139,9 +149,9 @@ jobs: uses: actions/cache@v4 with: path: ~/.vagrant.d/boxes - key: ${{ runner.os }}-vagrant-${{ hashFiles('hack/Vagrantfile.freebsd') }} + key: ${{ runner.os }}-vagrant-${{ matrix.os }}-${{ hashFiles(env.VAGRANT_FILE) }} restore-keys: | - ${{ runner.os }}-vagrant- + ${{ runner.os }}-vagrant-${{ matrix.os }}- - name: Install vagrant run: | @@ -155,7 +165,7 @@ jobs: - name: Set up vagrant run: | - ln -sf hack/Vagrantfile.freebsd Vagrantfile + ln -sf ${{ env.VAGRANT_FILE }} Vagrantfile vagrant up --no-tty - name: Test @@ -172,5 +182,5 @@ jobs: uses: codecov/codecov-action@v4 with: file: ./coverage.txt - flags: unit,freebsd + flags: unit,${{ matrix.os }} token: ${{ secrets.CODECOV_TOKEN }} diff --git a/docker-bake.hcl b/docker-bake.hcl index a18986bc..fe195db2 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -87,5 +87,20 @@ target "shfmt" { target "cross" { inherits = ["build"] - platforms = ["linux/amd64", "linux/386", "linux/arm64", "linux/arm", "linux/ppc64le", "linux/s390x", "darwin/amd64", "darwin/arm64", "windows/amd64", "windows/arm64", "freebsd/amd64", "freebsd/arm64"] + platforms = [ + "linux/amd64", + "linux/386", + "linux/arm64", + "linux/arm", + "linux/ppc64le", + "linux/s390x", + "darwin/amd64", + "darwin/arm64", + "windows/amd64", + "windows/arm64", + "freebsd/amd64", + "freebsd/arm64", + "openbsd/amd64", + "openbsd/arm64" + ] } diff --git a/hack/Vagrantfile.freebsd b/hack/Vagrantfile.freebsd index 2d81a719..5a16f248 100644 --- a/hack/Vagrantfile.freebsd +++ b/hack/Vagrantfile.freebsd @@ -10,8 +10,8 @@ Vagrant.configure("2") do |config| config.vm.provision "init", type: "shell", run: "once" do |sh| sh.inline = <<~SHELL pkg bootstrap - pkg install -y go121 - ln -s /usr/local/bin/go121 /usr/local/bin/go + pkg install -y go123 + ln -s /usr/local/bin/go123 /usr/local/bin/go SHELL end end diff --git a/hack/Vagrantfile.openbsd b/hack/Vagrantfile.openbsd new file mode 100644 index 00000000..e69a424e --- /dev/null +++ b/hack/Vagrantfile.openbsd @@ -0,0 +1,17 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box = "generic/openbsd7" + config.vm.boot_timeout = 900 + config.vm.synced_folder ".", "/vagrant", type: "rsync" + config.ssh.keep_alive = true + + config.vm.provision "init", type: "shell", run: "once" do |sh| + sh.inline = <<~SHELL + ftp https://go.dev/dl/go1.23.2.openbsd-amd64.tar.gz + tar -C /usr/local -xzf go1.23.2.openbsd-amd64.tar.gz + ln -s /usr/local/go/bin/go /usr/local/bin/go + SHELL + end +end From daab4c1e80f71d21925a2e519641b7264b22d7ba Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Sat, 2 Nov 2024 17:52:34 +0100 Subject: [PATCH 52/76] bench: bump modules Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- bench/go.mod | 32 +- bench/go.sum | 929 ++------------------------------------------------- 2 files changed, 41 insertions(+), 920 deletions(-) diff --git a/bench/go.mod b/bench/go.mod index 74345712..7fc68045 100644 --- a/bench/go.mod +++ b/bench/go.mod @@ -3,32 +3,28 @@ module github.com/tonistiigi/fsutil/bench go 1.21 require ( - github.com/containerd/continuity v0.4.1 - github.com/docker/docker v20.10.18+incompatible + github.com/containerd/continuity v0.4.4 + github.com/docker/docker v27.3.1+incompatible github.com/pkg/errors v0.9.1 github.com/tonistiigi/fsutil v0.0.0-00010101000000-000000000000 - golang.org/x/sync v0.1.0 + golang.org/x/sync v0.8.0 ) require ( - github.com/Microsoft/go-winio v0.5.2 // indirect - github.com/Microsoft/hcsshim v0.8.17 // indirect - github.com/containerd/cgroups v1.0.1 // indirect - github.com/containerd/containerd v1.5.2 // indirect - github.com/docker/go-units v0.4.0 // indirect - github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect + github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 // indirect + github.com/Microsoft/go-winio v0.6.2 // indirect + github.com/containerd/log v0.1.0 // indirect + github.com/klauspost/compress v1.11.13 // indirect github.com/moby/patternmatcher v0.5.0 // indirect - github.com/moby/sys/mount v0.2.0 // indirect - github.com/moby/sys/mountinfo v0.4.1 // indirect + github.com/moby/sys/sequential v0.6.0 // indirect + github.com/moby/sys/user v0.3.0 // indirect + github.com/moby/sys/userns v0.1.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/opencontainers/image-spec v1.0.1 // indirect - github.com/opencontainers/runc v1.0.0-rc93 // indirect github.com/planetscale/vtprotobuf v0.6.0 // indirect - github.com/sirupsen/logrus v1.8.1 // indirect - go.opencensus.io v0.22.3 // indirect - golang.org/x/sys v0.11.0 // indirect - google.golang.org/protobuf v1.31.0 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect + golang.org/x/sys v0.26.0 // indirect + google.golang.org/protobuf v1.35.1 // indirect + gotest.tools/v3 v3.0.3 // indirect ) replace github.com/tonistiigi/fsutil => ../ diff --git a/bench/go.sum b/bench/go.sum index 2d4a1745..1a1c5d44 100644 --- a/bench/go.sum +++ b/bench/go.sum @@ -1,470 +1,31 @@ -bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= -github.com/Azure/go-autorest v10.8.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/Azure/go-autorest/autorest v0.11.1/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw= -github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg= -github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A= -github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74= -github.com/Azure/go-autorest/autorest/mocks v0.4.0/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= -github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= -github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= -github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= -github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= -github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= -github.com/Microsoft/go-winio v0.4.16-0.20201130162521-d1ffc52c7331/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= -github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= -github.com/Microsoft/go-winio v0.4.17-0.20210211115548-6eac466e5fa3/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= -github.com/Microsoft/go-winio v0.4.17-0.20210324224401-5516f17a5958/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= -github.com/Microsoft/go-winio v0.4.17/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= -github.com/Microsoft/go-winio v0.5.2 h1:a9IhgEQBCUEk6QCdml9CiJGhAws+YwffDHEMp1VMrpA= -github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= -github.com/Microsoft/hcsshim v0.8.6/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg= -github.com/Microsoft/hcsshim v0.8.7-0.20190325164909-8abdbb8205e4/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg= -github.com/Microsoft/hcsshim v0.8.7/go.mod h1:OHd7sQqRFrYd3RmSgbgji+ctCwkbq2wbEYNSzOYtcBQ= -github.com/Microsoft/hcsshim v0.8.9/go.mod h1:5692vkUqntj1idxauYlpoINNKeqCiG6Sg38RRsjT5y8= -github.com/Microsoft/hcsshim v0.8.14/go.mod h1:NtVKoYxQuTLx6gEq0L96c9Ju4JbRJ4nY2ow3VK6a9Lg= -github.com/Microsoft/hcsshim v0.8.15/go.mod h1:x38A4YbHbdxJtc0sF6oIz+RG0npwSCAvn69iY6URG00= -github.com/Microsoft/hcsshim v0.8.16/go.mod h1:o5/SZqmR7x9JNKsW3pu+nqHm0MF8vbA+VxGOoXdC600= -github.com/Microsoft/hcsshim v0.8.17 h1:yFHH5bghP9ij5Y34PPaMOE8g//oXZ0uJQeMENVo2zcI= -github.com/Microsoft/hcsshim v0.8.17/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4= -github.com/Microsoft/hcsshim/test v0.0.0-20201218223536-d3e5debf77da/go.mod h1:5hlzMzRKMLyo42nCZ9oml8AdTlq/0cvIaBv6tK1RehU= -github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3/go.mod h1:mw7qgWloBUl75W/gVH3cQszUg1+gUITj7D6NY7ywVnY= -github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= -github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= -github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= -github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= -github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= -github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= -github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= -github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= -github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= -github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= -github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/checkpoint-restore/go-criu/v4 v4.1.0/go.mod h1:xUQBLp4RLc5zJtWY++yjOoMoB5lihDt7fai+75m+rGw= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/cilium/ebpf v0.0.0-20200110133405-4032b1d8aae3/go.mod h1:MA5e5Lr8slmEg9bt0VpxxWqJlO4iwu3FBdHUzV7wQVg= -github.com/cilium/ebpf v0.0.0-20200702112145-1c8d4c9ef775/go.mod h1:7cR51M8ViRLIdUjrmSXlK9pkrsDlLHbO8jiB8X8JnOc= -github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs= -github.com/cilium/ebpf v0.4.0/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= -github.com/containerd/aufs v0.0.0-20200908144142-dab0cbea06f4/go.mod h1:nukgQABAEopAHvB6j7cnP5zJ+/3aVcE7hCYqvIwAHyE= -github.com/containerd/aufs v0.0.0-20201003224125-76a6863f2989/go.mod h1:AkGGQs9NM2vtYHaUen+NljV0/baGCAPELGm2q9ZXpWU= -github.com/containerd/aufs v0.0.0-20210316121734-20793ff83c97/go.mod h1:kL5kd6KM5TzQjR79jljyi4olc1Vrx6XBlcyj3gNv2PU= -github.com/containerd/aufs v1.0.0/go.mod h1:kL5kd6KM5TzQjR79jljyi4olc1Vrx6XBlcyj3gNv2PU= -github.com/containerd/btrfs v0.0.0-20201111183144-404b9149801e/go.mod h1:jg2QkJcsabfHugurUvvPhS3E08Oxiuh5W/g1ybB4e0E= -github.com/containerd/btrfs v0.0.0-20210316141732-918d888fb676/go.mod h1:zMcX3qkXTAi9GI50+0HOeuV8LU2ryCE/V2vG/ZBiTss= -github.com/containerd/btrfs v1.0.0/go.mod h1:zMcX3qkXTAi9GI50+0HOeuV8LU2ryCE/V2vG/ZBiTss= -github.com/containerd/cgroups v0.0.0-20190717030353-c4b9ac5c7601/go.mod h1:X9rLEHIqSf/wfK8NsPqxJmeZgW4pcfzdXITDrUSJ6uI= -github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko= -github.com/containerd/cgroups v0.0.0-20200531161412-0dbf7f05ba59/go.mod h1:pA0z1pT8KYB3TCXK/ocprsh7MAkoW8bZVzPdih9snmM= -github.com/containerd/cgroups v0.0.0-20200710171044-318312a37340/go.mod h1:s5q4SojHctfxANBDvMeIaIovkq29IP48TKAxnhYRxvo= -github.com/containerd/cgroups v0.0.0-20200824123100-0b889c03f102/go.mod h1:s5q4SojHctfxANBDvMeIaIovkq29IP48TKAxnhYRxvo= -github.com/containerd/cgroups v0.0.0-20210114181951-8a68de567b68/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= -github.com/containerd/cgroups v1.0.1 h1:iJnMvco9XGvKUvNQkv88bE4uJXxRQH18efbKo9w5vHQ= -github.com/containerd/cgroups v1.0.1/go.mod h1:0SJrPIenamHDcZhEcJMNBB85rHcUsw4f25ZfBiPYRkU= -github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= -github.com/containerd/console v0.0.0-20181022165439-0650fd9eeb50/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= -github.com/containerd/console v0.0.0-20191206165004-02ecf6a7291e/go.mod h1:8Pf4gM6VEbTNRIT26AyyU7hxdQU3MvAvxVI0sc00XBE= -github.com/containerd/console v1.0.1/go.mod h1:XUsP6YE/mKtz6bxc+I8UiKKTP04qjQL4qcS3XoQ5xkw= -github.com/containerd/console v1.0.2/go.mod h1:ytZPjGgY2oeTkAONYafi2kSj0aYggsf8acV1PGKCbzQ= -github.com/containerd/containerd v1.2.10/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.3.0-beta.2.0.20190828155532-0293cbd26c69/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.3.0/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.3.1-0.20191213020239-082f7e3aed57/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.3.2/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.4.0-beta.2.0.20200729163537-40b22ef07410/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.4.1/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.4.3/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.5.0-beta.1/go.mod h1:5HfvG1V2FsKesEGQ17k5/T7V960Tmcumvqn8Mc+pCYQ= -github.com/containerd/containerd v1.5.0-beta.3/go.mod h1:/wr9AVtEM7x9c+n0+stptlo/uBBoBORwEx6ardVcmKU= -github.com/containerd/containerd v1.5.0-beta.4/go.mod h1:GmdgZd2zA2GYIBZ0w09ZvgqEq8EfBp/m3lcVZIvPHhI= -github.com/containerd/containerd v1.5.0-rc.0/go.mod h1:V/IXoMqNGgBlabz3tHD2TWDoTJseu1FGOKuoA4nNb2s= -github.com/containerd/containerd v1.5.1/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g= -github.com/containerd/containerd v1.5.2 h1:MG/Bg1pbmMb61j3wHCFWPxESXHieiKr2xG64px/k8zQ= -github.com/containerd/containerd v1.5.2/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g= -github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= -github.com/containerd/continuity v0.0.0-20190815185530-f2a389ac0a02/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= -github.com/containerd/continuity v0.0.0-20191127005431-f65d91d395eb/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= -github.com/containerd/continuity v0.0.0-20200710164510-efbc4488d8fe/go.mod h1:cECdGN1O8G9bgKTlLhuPJimka6Xb/Gg7vYzCTNVxhvo= -github.com/containerd/continuity v0.0.0-20201208142359-180525291bb7/go.mod h1:kR3BEg7bDFaEddKm54WSmrol1fKWDU1nKYkgrcgZT7Y= -github.com/containerd/continuity v0.0.0-20210208174643-50096c924a4e/go.mod h1:EXlVlkqNba9rJe3j7w3Xa924itAMLgZH4UD/Q4PExuQ= -github.com/containerd/continuity v0.1.0/go.mod h1:ICJu0PwR54nI0yPEnJ6jcS+J7CZAUXrLh8lPo2knzsM= -github.com/containerd/continuity v0.4.1 h1:wQnVrjIyQ8vhU2sgOiL5T07jo+ouqc2bnKsv5/EqGhU= -github.com/containerd/continuity v0.4.1/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= -github.com/containerd/fifo v0.0.0-20180307165137-3d5202aec260/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI= -github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI= -github.com/containerd/fifo v0.0.0-20200410184934-f15a3290365b/go.mod h1:jPQ2IAeZRCYxpS/Cm1495vGFww6ecHmMk1YJH2Q5ln0= -github.com/containerd/fifo v0.0.0-20201026212402-0724c46b320c/go.mod h1:jPQ2IAeZRCYxpS/Cm1495vGFww6ecHmMk1YJH2Q5ln0= -github.com/containerd/fifo v0.0.0-20210316144830-115abcc95a1d/go.mod h1:ocF/ME1SX5b1AOlWi9r677YJmCPSwwWnQ9O123vzpE4= -github.com/containerd/fifo v1.0.0/go.mod h1:ocF/ME1SX5b1AOlWi9r677YJmCPSwwWnQ9O123vzpE4= -github.com/containerd/go-cni v1.0.1/go.mod h1:+vUpYxKvAF72G9i1WoDOiPGRtQpqsNW/ZHtSlv++smU= -github.com/containerd/go-cni v1.0.2/go.mod h1:nrNABBHzu0ZwCug9Ije8hL2xBCYh/pjfMb1aZGrrohk= -github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0= -github.com/containerd/go-runc v0.0.0-20190911050354-e029b79d8cda/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0= -github.com/containerd/go-runc v0.0.0-20200220073739-7016d3ce2328/go.mod h1:PpyHrqVs8FTi9vpyHwPwiNEGaACDxT/N/pLcvMSRA9g= -github.com/containerd/go-runc v0.0.0-20201020171139-16b287bc67d0/go.mod h1:cNU0ZbCgCQVZK4lgG3P+9tn9/PaJNmoDXPpoJhDR+Ok= -github.com/containerd/go-runc v1.0.0/go.mod h1:cNU0ZbCgCQVZK4lgG3P+9tn9/PaJNmoDXPpoJhDR+Ok= -github.com/containerd/imgcrypt v1.0.1/go.mod h1:mdd8cEPW7TPgNG4FpuP3sGBiQ7Yi/zak9TYCG3juvb0= -github.com/containerd/imgcrypt v1.0.4-0.20210301171431-0ae5c75f59ba/go.mod h1:6TNsg0ctmizkrOgXRNQjAPFWpMYRWuiB6dSF4Pfa5SA= -github.com/containerd/imgcrypt v1.1.1-0.20210312161619-7ed62a527887/go.mod h1:5AZJNI6sLHJljKuI9IHnw1pWqo/F0nGDOuR9zgTs7ow= -github.com/containerd/imgcrypt v1.1.1/go.mod h1:xpLnwiQmEUJPvQoAapeb2SNCxz7Xr6PJrXQb0Dpc4ms= -github.com/containerd/nri v0.0.0-20201007170849-eb1350a75164/go.mod h1:+2wGSDGFYfE5+So4M5syatU0N0f0LbWpuqyMi4/BE8c= -github.com/containerd/nri v0.0.0-20210316161719-dbaa18c31c14/go.mod h1:lmxnXF6oMkbqs39FiCt1s0R2HSMhcLel9vNL3m4AaeY= -github.com/containerd/nri v0.1.0/go.mod h1:lmxnXF6oMkbqs39FiCt1s0R2HSMhcLel9vNL3m4AaeY= -github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o= -github.com/containerd/ttrpc v0.0.0-20190828172938-92c8520ef9f8/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o= -github.com/containerd/ttrpc v0.0.0-20191028202541-4f1b8fe65a5c/go.mod h1:LPm1u0xBw8r8NOKoOdNMeVHSawSsltak+Ihv+etqsE8= -github.com/containerd/ttrpc v1.0.1/go.mod h1:UAxOpgT9ziI0gJrmKvgcZivgxOp8iFPSk8httJEt98Y= -github.com/containerd/ttrpc v1.0.2/go.mod h1:UAxOpgT9ziI0gJrmKvgcZivgxOp8iFPSk8httJEt98Y= -github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc= -github.com/containerd/typeurl v0.0.0-20190911142611-5eb25027c9fd/go.mod h1:GeKYzf2pQcqv7tJ0AoCuuhtnqhva5LNU3U+OyKxxJpk= -github.com/containerd/typeurl v1.0.1/go.mod h1:TB1hUtrpaiO88KEK56ijojHS1+NeF0izUACaJW2mdXg= -github.com/containerd/typeurl v1.0.2/go.mod h1:9trJWW2sRlGub4wZJRTW83VtbOLS6hwcDZXTn6oPz9s= -github.com/containerd/zfs v0.0.0-20200918131355-0a33824f23a2/go.mod h1:8IgZOBdv8fAgXddBT4dBXJPtxyRsejFIpXoklgxgEjw= -github.com/containerd/zfs v0.0.0-20210301145711-11e8f1707f62/go.mod h1:A9zfAbMlQwE+/is6hi0Xw8ktpL+6glmqZYtevJgaB8Y= -github.com/containerd/zfs v0.0.0-20210315114300-dde8f0fda960/go.mod h1:m+m51S1DvAP6r3FcmYCp54bQ34pyOwTieQDNRIRHsFY= -github.com/containerd/zfs v0.0.0-20210324211415-d5c4544f0433/go.mod h1:m+m51S1DvAP6r3FcmYCp54bQ34pyOwTieQDNRIRHsFY= -github.com/containerd/zfs v1.0.0/go.mod h1:m+m51S1DvAP6r3FcmYCp54bQ34pyOwTieQDNRIRHsFY= -github.com/containernetworking/cni v0.7.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= -github.com/containernetworking/cni v0.8.0/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= -github.com/containernetworking/cni v0.8.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= -github.com/containernetworking/plugins v0.8.6/go.mod h1:qnw5mN19D8fIwkqW7oHHYDHVlzhJpcY6TQxn/fUyDDM= -github.com/containernetworking/plugins v0.9.1/go.mod h1:xP/idU2ldlzN6m4p5LmGiwRDjeJr6FLK6vuiUwoH7P8= -github.com/containers/ocicrypt v1.0.1/go.mod h1:MeJDzk1RJHv89LjsH0Sp5KTY3ZYkjXO/C+bKAeWFIrc= -github.com/containers/ocicrypt v1.1.0/go.mod h1:b8AOe0YR67uU8OqfVNcznfFpAzu3rdgUV4GP9qXPfu4= -github.com/containers/ocicrypt v1.1.1/go.mod h1:Dm55fwWm1YZAjYRaJ94z2mfZikIyIN4B0oB3dj3jFxY= -github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-iptables v0.4.5/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU= -github.com/coreos/go-iptables v0.5.0/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU= -github.com/coreos/go-oidc v2.1.0+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20161114122254-48702e0da86b/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= -github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= -github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= -github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c/go.mod h1:Ct2BUK8SB0YC1SMSibvLzxjeJLnrYEVLULFNiHY9YfQ= -github.com/d2g/dhcp4client v1.0.0/go.mod h1:j0hNfjhrt2SxUOw55nL0ATM/z4Yt3t2Kd1mW34z5W5s= -github.com/d2g/dhcp4server v0.0.0-20181031114812-7d4a0a7f59a5/go.mod h1:Eo87+Kg/IX2hfWJfwxMzLyuSZyxSoAug2nGa1G2QAi8= -github.com/d2g/hardwareaddr v0.0.0-20190221164911-e7d9fbe030e4/go.mod h1:bMl4RjIciD2oAxI7DmWRx6gbeqrkoLqv3MV0vzNad+I= +github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 h1:He8afgbRMd7mFxO99hRNu+6tazq8nFF9lIwo9JFroBk= +github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8= +github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= +github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= +github.com/containerd/continuity v0.4.4 h1:/fNVfTJ7wIl/YPMHjf+5H32uFhl63JucB34PlCpMKII= +github.com/containerd/continuity v0.4.4/go.mod h1:/lNJvtJKUQStBzpVQ1+rasXO1LAWtUQssk28EZvJ3nE= +github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= +github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= -github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= -github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY= -github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v20.10.18+incompatible h1:SN84VYXTBNGn92T/QwIRPlum9zfemfitN7pbsp26WSc= -github.com/docker/docker v20.10.18+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/go-events v0.0.0-20170721190031-9461782956ad/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= -github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= -github.com/docker/go-metrics v0.0.0-20180209012529-399ea8c73916/go.mod h1:/u0gXw0Gay3ceNrsHubL3BtdOL2fHf93USgMTe0W5dI= -github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw= -github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= -github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE= -github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= -github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= -github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= -github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= -github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= -github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= -github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= -github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= -github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= -github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= -github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= -github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= -github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= -github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/godbus/dbus v0.0.0-20151105175453-c7fdd8b5cd55/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= -github.com/godbus/dbus v0.0.0-20180201030542-885f9cc04c9c/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= -github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= -github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gogo/googleapis v1.2.0/go.mod h1:Njal3psf3qN6dwBtQfUmBZh2ybovJ0tlu3o/AC7HYjU= -github.com/gogo/googleapis v1.4.0/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/docker/docker v27.3.1+incompatible h1:KttF0XoteNTicmUtBO0L2tP+J7FGRFTjaEF4k6WdhfI= +github.com/docker/docker v27.3.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= -github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.10/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA= -github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.11.13 h1:eSvu8Tmq6j2psUJqJrLcWH6K3w5Dwc+qipbaA6eVEN4= github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= -github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= -github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= -github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A= -github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= github.com/moby/patternmatcher v0.5.0 h1:YCZgJOeULcxLw1Q+sVR636pmS7sPEn1Qo2iAN6M7DBo= github.com/moby/patternmatcher v0.5.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= -github.com/moby/sys/mount v0.2.0 h1:WhCW5B355jtxndN5ovugJlMFJawbUODuW8fSnEH6SSM= -github.com/moby/sys/mount v0.2.0/go.mod h1:aAivFE2LB3W4bACsUXChRHQ0qKWsetY4Y9V7sxOougM= -github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= -github.com/moby/sys/mountinfo v0.4.1 h1:1O+1cHA1aujwEwwVMa2Xm2l+gIpUHyd3+D+d7LZh1kM= -github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= -github.com/moby/sys/symlink v0.1.0/go.mod h1:GGDODQmbFOjFsXvfLVn3+ZRxkch54RkSiGqsZeMYowQ= -github.com/moby/term v0.0.0-20200312100748-672ec06f55cd/go.mod h1:DdlQx2hp0Ss5/fLikoLlEeIYiATotOjgB//nb973jeo= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= -github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= -github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/onsi/ginkgo v0.0.0-20151202141238-7f8ab55aaf3b/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/gomega v0.0.0-20151007035656-2152b45fa28a/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= -github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= -github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc= -github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -github.com/opencontainers/go-digest v1.0.0-rc1.0.20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/moby/sys/sequential v0.6.0 h1:qrx7XFUd/5DxtqcoH1h438hF5TmOvzC/lspjy7zgvCU= +github.com/moby/sys/sequential v0.6.0/go.mod h1:uyv8EUTrca5PnDsdMGXhZe6CCe8U/UiTWd+lL+7b/Ko= +github.com/moby/sys/user v0.3.0 h1:9ni5DlcW5an3SvRSx4MouotOygvzaXbaSrc/wGDFWPo= +github.com/moby/sys/user v0.3.0/go.mod h1:bG+tYYYJgaMtRKgEmuueC0hJEAZWwtIbZTB+85uoHjs= +github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g= +github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= -github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= -github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= -github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= -github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= -github.com/opencontainers/runc v1.0.0-rc93 h1:x2UMpOOVf3kQ8arv/EsDGwim8PTNqzL1/EYDr/+scOM= -github.com/opencontainers/runc v1.0.0-rc93/go.mod h1:3NOsor4w32B2tC0Zbl8Knk4Wg84SM2ImC1fxBuqJ/H0= -github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/runtime-spec v1.0.1/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/runtime-spec v1.0.2-0.20190207185410-29686dbc5559/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/runtime-spec v1.0.3-0.20200929063507-e6143ca7d51d/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mod h1:r3f7wjNzSs2extwzU3Y+6pKfobzPh+kKFJ3ofN+3nfs= -github.com/opencontainers/selinux v1.6.0/go.mod h1:VVGKuOLlE7v4PJyT6h7mNWvq1rzqiriPsEqVhc+svHE= -github.com/opencontainers/selinux v1.8.0/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3ogry1nUQF8Evvo= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc= -github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -472,468 +33,32 @@ github.com/planetscale/vtprotobuf v0.6.0 h1:nBeETjudeJ5ZgBHUz1fVHvbqUKnYOXNhsIEa github.com/planetscale/vtprotobuf v0.6.0/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= -github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20180110214958-89604d197083/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.0-20190522114515-bc1a522cf7b1/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= -github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= -github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8= -github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= -github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= -github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= -github.com/tchap/go-patricia v2.2.6+incompatible/go.mod h1:bmLyhP68RS6kStMGxByiQ23RP/odRBOTVjwp2cDyi6I= -github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= -github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk= -github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= -github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho= -github.com/vishvananda/netns v0.0.0-20180720170159-13995c7128cc/go.mod h1:ZjcWmFBXmLKZu9Nxj3WKYEafiSqer2rnvPr0en9UNpI= -github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= -github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0= -github.com/willf/bitset v1.1.11-0.20200630133818-d5bec3311243/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= -github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr3+MjI= -github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= -github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= -github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= -github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= -go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= -go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489/go.mod h1:yVHk9ub3CSBatqGNg7GRmsnfLWtoW60w4eDYfh7vHDg= -go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1/go.mod h1:SNgMg+EgDFwmvSmLRTNKC5fegJjB7v23qTQ0XLGUNHk= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3 h1:8sGtKOrtQqkN1bp2AtX+misvLIlOmsEsNd+9NIcPEm8= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190522044717-8097e1b27ff5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190812073006-9eafafc0a87e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191210023423-ac6580df4449/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200120151820-655fe14d7479/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200817155316-9781c653f443/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200916030750-2334cc1a136f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200922070232-aee5d888a860/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201117170446-d9b008d0a637/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201202213521-69691e467435/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.0.0-20160322025152-9bf6e6e569ff/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/cloud v0.0.0-20151119220103-975617b05ea8/go.mod h1:0H1ncTHf11KCFhTc/+EFRbzSCOZx+VUbRMk55Yv5MYk= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190522204451-c2c4e71fbf69/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200117163144-32f20d992d24/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= -gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= -gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= -gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= -gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0= gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/api v0.20.1/go.mod h1:KqwcCVogGxQY3nBlRpwt+wpAMF/KjaCc7RpywacvqUo= -k8s.io/api v0.20.4/go.mod h1:++lNL1AJMkDymriNniQsWRkMDzRaX2Y/POTUi8yvqYQ= -k8s.io/api v0.20.6/go.mod h1:X9e8Qag6JV/bL5G6bU8sdVRltWKmdHsFUGS3eVndqE8= -k8s.io/apimachinery v0.20.1/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= -k8s.io/apimachinery v0.20.4/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= -k8s.io/apimachinery v0.20.6/go.mod h1:ejZXtW1Ra6V1O5H8xPBGz+T3+4gfkTCeExAHKU57MAc= -k8s.io/apiserver v0.20.1/go.mod h1:ro5QHeQkgMS7ZGpvf4tSMx6bBOgPfE+f52KwvXfScaU= -k8s.io/apiserver v0.20.4/go.mod h1:Mc80thBKOyy7tbvFtB4kJv1kbdD0eIH8k8vianJcbFM= -k8s.io/apiserver v0.20.6/go.mod h1:QIJXNt6i6JB+0YQRNcS0hdRHJlMhflFmsBDeSgT1r8Q= -k8s.io/client-go v0.20.1/go.mod h1:/zcHdt1TeWSd5HoUe6elJmHSQ6uLLgp4bIJHVEuy+/Y= -k8s.io/client-go v0.20.4/go.mod h1:LiMv25ND1gLUdBeYxBIwKpkSC5IsozMMmOOeSJboP+k= -k8s.io/client-go v0.20.6/go.mod h1:nNQMnOvEUEsOzRRFIIkdmYOjAZrC8bgq0ExboWSU1I0= -k8s.io/component-base v0.20.1/go.mod h1:guxkoJnNoh8LNrbtiQOlyp2Y2XFCZQmrcg2n/DeYNLk= -k8s.io/component-base v0.20.4/go.mod h1:t4p9EdiagbVCJKrQ1RsA5/V4rFQNDfRlevJajlGwgjI= -k8s.io/component-base v0.20.6/go.mod h1:6f1MPBAeI+mvuts3sIdtpjljHWBQ2cIy38oBIWMYnrM= -k8s.io/cri-api v0.17.3/go.mod h1:X1sbHmuXhwaHs9xxYffLqJogVsnI+f6cPRcgPel7ywM= -k8s.io/cri-api v0.20.1/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= -k8s.io/cri-api v0.20.4/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= -k8s.io/cri-api v0.20.6/go.mod h1:ew44AjNXwyn1s0U4xCKGodU7J1HzBeZ1MpGrpa5r8Yc= -k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= -k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= -k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= -k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAGcJo0Tvi+dK12EcqSLqcWsryKMpfM= -k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= -k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.14/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= -sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= -sigs.k8s.io/structured-merge-diff/v4 v4.0.3/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= -sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= -sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= From 9c89a744507020775d9b8b2094b8f057f3cacea8 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Sun, 3 Nov 2024 15:49:26 +0100 Subject: [PATCH 53/76] enable golangci-lint for supported platforms Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- .golangci.yml | 2 +- docker-bake.hcl | 41 +++++++++++++++++++------------- hack/dockerfiles/lint.Dockerfile | 9 +++++-- 4 files changed, 33 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5a1037a..8999423c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: strategy: matrix: target: - - lint + - lint-cross - validate-generated-files - validate-gomod - validate-shfmt diff --git a/.golangci.yml b/.golangci.yml index 7300a0e5..76054806 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,5 +1,5 @@ run: - timeout: 10m + timeout: 30m skip-files: - ".*\\.pb\\.go$" diff --git a/docker-bake.hcl b/docker-bake.hcl index fe195db2..b06550a3 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -6,6 +6,25 @@ variable "DESTDIR" { default = "./bin" } +target "_platforms" { + platforms = [ + "darwin/amd64", + "darwin/arm64", + "freebsd/amd64", + "freebsd/arm64", + "linux/386", + "linux/amd64", + "linux/arm", + "linux/arm64", + "linux/ppc64le", + "linux/s390x", + "openbsd/amd64", + "openbsd/arm64", + "windows/amd64", + "windows/arm64" + ] +} + group "default" { targets = ["build"] } @@ -40,6 +59,10 @@ target "lint" { } } +target "lint-cross" { + inherits = ["lint", "_platforms"] +} + target "validate-generated-files" { dockerfile = "./hack/dockerfiles/generated-files.Dockerfile" output = ["type=cacheonly"] @@ -86,21 +109,5 @@ target "shfmt" { } target "cross" { - inherits = ["build"] - platforms = [ - "linux/amd64", - "linux/386", - "linux/arm64", - "linux/arm", - "linux/ppc64le", - "linux/s390x", - "darwin/amd64", - "darwin/arm64", - "windows/amd64", - "windows/arm64", - "freebsd/amd64", - "freebsd/arm64", - "openbsd/amd64", - "openbsd/arm64" - ] + inherits = ["build", "_platforms"] } diff --git a/hack/dockerfiles/lint.Dockerfile b/hack/dockerfiles/lint.Dockerfile index 50b8ce07..960c11b2 100644 --- a/hack/dockerfiles/lint.Dockerfile +++ b/hack/dockerfiles/lint.Dockerfile @@ -1,15 +1,20 @@ # syntax=docker/dockerfile:1 ARG GO_VERSION=1.23 +ARG XX_VERSION=1.5.0 ARG GOLANGCI_LINT_VERSION=1.61.0 -FROM golang:${GO_VERSION}-alpine +FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx +FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine RUN apk add --no-cache git gcc musl-dev ENV GOFLAGS="-buildvcs=false" ARG GOLANGCI_LINT_VERSION RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v${GOLANGCI_LINT_VERSION} +COPY --link --from=xx / / WORKDIR /go/src/github.com/tonistiigi/fsutil +ARG TARGETPLATFORM RUN --mount=target=. \ - --mount=target=/root/.cache,type=cache \ + --mount=target=/root/.cache,type=cache,id=lint-cache-$TARGETPLATFORM \ --mount=target=/go/pkg/mod,type=cache \ + xx-go --wrap && \ golangci-lint run From d70a9867eac85acf24905fa6acc2f71227f7ed47 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Sun, 3 Nov 2024 15:51:34 +0100 Subject: [PATCH 54/76] fix issues in .golangci.yml Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .golangci.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 76054806..b8abb04a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,7 +1,5 @@ run: timeout: 30m - skip-files: - - ".*\\.pb\\.go$" linters: enable: @@ -25,6 +23,10 @@ linters-settings: - pkg: "io/ioutil" desc: The io/ioutil package has been deprecated. -# show all -max-issues-per-linter: 0 -max-same-issues: 0 +issues: + exclude-files: + - ".*\\.pb\\.go$" + + # show all + max-issues-per-linter: 0 + max-same-issues: 0 From 312907a664901a560b6a0e11610427732106ba29 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Sun, 3 Nov 2024 15:55:38 +0100 Subject: [PATCH 55/76] fix lint issues Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- chtimes_nolinux.go | 1 + copy/copy_test.go | 9 --------- copy/copy_unix_test.go | 9 +++++++++ copy/stat_bsd.go | 1 + copy/stat_openbsd.go | 1 + stat_windows.go | 1 + 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/chtimes_nolinux.go b/chtimes_nolinux.go index a3ba0988..08251ec2 100644 --- a/chtimes_nolinux.go +++ b/chtimes_nolinux.go @@ -1,3 +1,4 @@ +//go:build !linux // +build !linux package fsutil diff --git a/copy/copy_test.go b/copy/copy_test.go index a7353ef4..f2878c0b 100644 --- a/copy/copy_test.go +++ b/copy/copy_test.go @@ -18,15 +18,6 @@ import ( "github.com/tonistiigi/fsutil" ) -// requiresRoot skips tests that require root -func requiresRoot(t *testing.T) { - t.Helper() - if os.Getuid() != 0 { - t.Skip("skipping test that requires root") - return - } -} - // TODO: Create copy directory which requires privilege // chown // mknod diff --git a/copy/copy_unix_test.go b/copy/copy_unix_test.go index 55f40817..6045c831 100644 --- a/copy/copy_unix_test.go +++ b/copy/copy_unix_test.go @@ -161,3 +161,12 @@ func TestCopyModeTextFormat(t *testing.T) { }) } } + +// requiresRoot skips tests that require root +func requiresRoot(t *testing.T) { + t.Helper() + if os.Getuid() != 0 { + t.Skip("skipping test that requires root") + return + } +} diff --git a/copy/stat_bsd.go b/copy/stat_bsd.go index 439574c0..37b0840c 100644 --- a/copy/stat_bsd.go +++ b/copy/stat_bsd.go @@ -1,3 +1,4 @@ +//go:build darwin || freebsd || netbsd // +build darwin freebsd netbsd package fs diff --git a/copy/stat_openbsd.go b/copy/stat_openbsd.go index bfdf837e..c87d789c 100644 --- a/copy/stat_openbsd.go +++ b/copy/stat_openbsd.go @@ -1,3 +1,4 @@ +//go:build openbsd // +build openbsd package fs diff --git a/stat_windows.go b/stat_windows.go index 66379bd8..f78016f5 100644 --- a/stat_windows.go +++ b/stat_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package fsutil From bdba6e662e31de57730f1abcf39e93fe4ebcef77 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Tue, 5 Nov 2024 09:02:52 +0100 Subject: [PATCH 56/76] fixes for netbsd Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- copy/{copy_openbsd.go => copy_otherbsd.go} | 4 ++-- copy/copy_unix.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename copy/{copy_openbsd.go => copy_otherbsd.go} (92%) diff --git a/copy/copy_openbsd.go b/copy/copy_otherbsd.go similarity index 92% rename from copy/copy_openbsd.go rename to copy/copy_otherbsd.go index 18cd438f..8e71292b 100644 --- a/copy/copy_openbsd.go +++ b/copy/copy_otherbsd.go @@ -1,5 +1,5 @@ -//go:build openbsd -// +build openbsd +//go:build openbsd || netbsd +// +build openbsd netbsd package fs diff --git a/copy/copy_unix.go b/copy/copy_unix.go index cb41247a..df1cdd07 100644 --- a/copy/copy_unix.go +++ b/copy/copy_unix.go @@ -1,5 +1,5 @@ -//go:build solaris || darwin || freebsd || openbsd -// +build solaris darwin freebsd openbsd +//go:build solaris || darwin || freebsd || openbsd || netbsd +// +build solaris darwin freebsd openbsd netbsd package fs From a5af7e432bd733ce3958e099277e3887cb454638 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Tue, 5 Nov 2024 08:57:57 +0100 Subject: [PATCH 57/76] build and test netbsd Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/ci.yml | 1 + docker-bake.hcl | 2 ++ hack/Vagrantfile.netbsd | 21 +++++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 hack/Vagrantfile.netbsd diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8999423c..5a193ebb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -135,6 +135,7 @@ jobs: matrix: os: - freebsd + - netbsd - openbsd steps: - diff --git a/docker-bake.hcl b/docker-bake.hcl index b06550a3..9b307068 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -18,6 +18,8 @@ target "_platforms" { "linux/arm64", "linux/ppc64le", "linux/s390x", + "netbsd/amd64", + "netbsd/arm64", "openbsd/amd64", "openbsd/arm64", "windows/amd64", diff --git a/hack/Vagrantfile.netbsd b/hack/Vagrantfile.netbsd new file mode 100644 index 00000000..e0f2194a --- /dev/null +++ b/hack/Vagrantfile.netbsd @@ -0,0 +1,21 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box = "generic/netbsd9" + config.vm.boot_timeout = 900 + config.vm.synced_folder ".", "/vagrant", type: "rsync" + config.ssh.keep_alive = true + + config.vm.provision "init", type: "shell", run: "once" do |sh| + sh.inline = <<~SHELL + # update CA certs + pkgin -y install mozilla-rootcerts + mozilla-rootcerts install + + ftp https://go.dev/dl/go1.23.2.netbsd-amd64.tar.gz + tar -C /tmp -xzf go1.23.2.netbsd-amd64.tar.gz + ln -s /tmp/go/bin/go /usr/bin/go + SHELL + end +end From d379a0e22ea22e00c3663e0830d2c08ce5ea01a9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 23:24:45 +0000 Subject: [PATCH 58/76] chore(deps): Bump codecov/codecov-action from 4 to 5 Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8999423c..e011b326 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,7 +86,7 @@ jobs: targets: test-${{ matrix.mode }} - name: Upload coverage - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: directory: ${{ env.DESTDIR }}/coverage flags: unit,${{ matrix.mode }},go-${{ matrix.go }} @@ -121,7 +121,7 @@ jobs: - name: Upload coverage if: always() - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: file: ./coverage.txt env_vars: RUNNER_OS @@ -179,7 +179,7 @@ jobs: - name: Upload coverage if: always() - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: file: ./coverage.txt flags: unit,${{ matrix.os }} From 211ad803364e53002cd7d2904bee252b5c535025 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Thu, 21 Nov 2024 10:33:49 +0100 Subject: [PATCH 59/76] ci: fix deprecated input for codecov-action Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e011b326..df6f3b3d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -123,7 +123,7 @@ jobs: if: always() uses: codecov/codecov-action@v5 with: - file: ./coverage.txt + files: ./coverage.txt env_vars: RUNNER_OS flags: unit,go-${{ matrix.go }} token: ${{ secrets.CODECOV_TOKEN }} @@ -181,6 +181,6 @@ jobs: if: always() uses: codecov/codecov-action@v5 with: - file: ./coverage.txt + files: ./coverage.txt flags: unit,${{ matrix.os }} token: ${{ secrets.CODECOV_TOKEN }} From 5b2dd0f853e277706a09ed9feadf7152f2ec6e26 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 10 Dec 2024 10:45:49 +0100 Subject: [PATCH 60/76] update xx to v1.6.1 for compatibility with alpine 3.21 and file 5.46+ This fixes compatibility with alpine 3.21 and file 5.46+ - Fix additional possible `xx-cc`/`xx-cargo` compatibility issue with Alpine 3.21 - Support for Alpine 3.21 - Fix `xx-verify` with `file` 5.46+ - Fix possible error taking lock in `xx-apk` in latest Alpine without `coreutils` full diff: https://github.com/tonistiigi/xx/compare/v1.5.0...v1.6.1 Signed-off-by: Sebastiaan van Stijn --- Dockerfile | 2 +- hack/dockerfiles/lint.Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3a76d341..3501573d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 ARG GO_VERSION=1.23 -ARG XX_VERSION=1.5.0 +ARG XX_VERSION=1.6.1 FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx diff --git a/hack/dockerfiles/lint.Dockerfile b/hack/dockerfiles/lint.Dockerfile index 960c11b2..ad7a45dc 100644 --- a/hack/dockerfiles/lint.Dockerfile +++ b/hack/dockerfiles/lint.Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 ARG GO_VERSION=1.23 -ARG XX_VERSION=1.5.0 +ARG XX_VERSION=1.6.1 ARG GOLANGCI_LINT_VERSION=1.61.0 FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx From f8467f177052b0048666118971c6f9b4be588fa3 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Thu, 2 Jan 2025 17:40:29 -0800 Subject: [PATCH 61/76] fix error message for invalid includepatterns The patterns returned in the error message were missing the ones added via opts.FollowLinks Signed-off-by: Tonis Tiigi --- filter.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filter.go b/filter.go index 9cee8ad2..2f0387e1 100644 --- a/filter.go +++ b/filter.go @@ -111,7 +111,7 @@ func NewFilterFS(fs FS, opt *FilterOpt) (FS, error) { if len(includePatterns) > 0 { includeMatcher, err = patternmatcher.New(includePatterns) if err != nil { - return nil, errors.Wrapf(err, "invalid includepatterns: %s", opt.IncludePatterns) + return nil, errors.Wrapf(err, "invalid includepatterns: %s", includePatterns) } for _, p := range includeMatcher.Patterns() { From 6de9584c40bb4cce56b108f4c8c9d53d9f600e6f Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Mon, 13 Jan 2025 10:29:48 +0100 Subject: [PATCH 62/76] ci: update bake-action to v6 Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/ci.yml | 15 +++------------ docker-bake.hcl | 11 +++++++++++ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f7eb064..715fb748 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,15 +27,12 @@ jobs: - validate-gomod - validate-shfmt steps: - - - name: Checkout - uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Run - uses: docker/bake-action@v5 + uses: docker/bake-action@v6 with: targets: ${{ matrix.target }} @@ -47,15 +44,12 @@ jobs: - build - cross steps: - - - name: Checkout - uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Run - uses: docker/bake-action@v5 + uses: docker/bake-action@v6 with: targets: ${{ matrix.target }} @@ -73,15 +67,12 @@ jobs: env: GO_VERSION: ${{ matrix.go }} steps: - - - name: Checkout - uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Test - uses: docker/bake-action@v5 + uses: docker/bake-action@v6 with: targets: test-${{ matrix.mode }} - diff --git a/docker-bake.hcl b/docker-bake.hcl index 9b307068..ea73bd20 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -27,11 +27,18 @@ target "_platforms" { ] } +target "_common" { + args = { + BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1 + } +} + group "default" { targets = ["build"] } target "build" { + inherits = ["_common"] args = { GO_VERSION = "${GO_VERSION}" } @@ -54,6 +61,7 @@ target "test-noroot" { } target "lint" { + inherits = ["_common"] dockerfile = "./hack/dockerfiles/lint.Dockerfile" output = ["type=cacheonly"] args = { @@ -66,6 +74,7 @@ target "lint-cross" { } target "validate-generated-files" { + inherits = ["_common"] dockerfile = "./hack/dockerfiles/generated-files.Dockerfile" output = ["type=cacheonly"] target = "validate" @@ -81,6 +90,7 @@ target "generated-files" { } target "validate-gomod" { + inherits = ["_common"] dockerfile = "./hack/dockerfiles/gomod.Dockerfile" output = ["type=cacheonly"] target = "validate" @@ -99,6 +109,7 @@ target "gomod" { } target "validate-shfmt" { + inherits = ["_common"] dockerfile = "./hack/dockerfiles/shfmt.Dockerfile" output = ["type=cacheonly"] target = "validate" From 183e7fb4d67787d9f55353523e1be62c4eb1131e Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Tue, 25 Feb 2025 11:18:17 -0800 Subject: [PATCH 63/76] copy: fix custom chmod for parent directories Signed-off-by: Tonis Tiigi --- copy/copy.go | 14 +++++++++-- copy/copy_test.go | 50 +++++++++++++++++++++++++++++++++++++++ copy/copy_unix_test.go | 7 ++++++ copy/copy_windows_test.go | 10 ++++++++ 4 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 copy/copy_windows_test.go diff --git a/copy/copy.go b/copy/copy.go index f24e77f8..42237bd3 100644 --- a/copy/copy.go +++ b/copy/copy.go @@ -18,6 +18,8 @@ import ( "github.com/tonistiigi/fsutil" ) +const defaultDirectoryMode = 0755 + var bufferPool = &sync.Pool{ New: func() interface{} { buffer := make([]byte, 32*1024) @@ -80,7 +82,11 @@ func Copy(ctx context.Context, srcRoot, src, dstRoot, dst string, opts ...Opt) e if err != nil { return err } - if createdDirs, err := MkdirAll(ensureDstPath, 0755, ci.Chown, ci.Utime); err != nil { + perm := defaultDirectoryMode + if ci.Mode != nil { + perm = *ci.Mode + } + if createdDirs, err := MkdirAll(ensureDstPath, os.FileMode(perm), ci.Chown, ci.Utime); err != nil { return err } else { defer fixCreatedParentDirs(createdDirs, ci.Utime) @@ -159,7 +165,11 @@ func (c *copier) prepareTargetDir(srcFollowed, src, destPath string, copyDirCont target = destPath } var createdDirs []string - if dirs, err := MkdirAll(target, 0755, c.chown, c.utime); err != nil { + mode := defaultDirectoryMode + if c.mode != nil { + mode = *c.mode + } + if dirs, err := MkdirAll(target, os.FileMode(mode), c.chown, c.utime); err != nil { return "", nil, err } else { createdDirs = dirs diff --git a/copy/copy_test.go b/copy/copy_test.go index f2878c0b..3398b7e3 100644 --- a/copy/copy_test.go +++ b/copy/copy_test.go @@ -283,6 +283,56 @@ func TestCopyExistingDirDest(t *testing.T) { require.Equal(t, "bar-contents", string(dt)) } +func TestCopyDirectoryChmodChown(t *testing.T) { + if os.Getuid() != 0 { + t.Skip() + } + + t1 := t.TempDir() + apply := fstest.Apply( + fstest.CreateDir("dir", 0755), + fstest.CreateFile("dir/foo.txt", []byte("foo-contents"), 0644), + fstest.CreateDir("dir/sub2", 0755), + ) + require.NoError(t, apply.Apply(t1)) + + t2 := t.TempDir() + + mod := int(0700) + err := Copy(context.TODO(), t1, "dir", t2, "dest/sub", WithCopyInfo(CopyInfo{ + CopyDirContents: true, + Mode: &mod, + }), WithChown(100, 200)) + require.NoError(t, err) + + st, err := os.Lstat(filepath.Join(t2, "dest/sub")) + require.NoError(t, err) + uid, gid, ok := readUidGid(st) + if ok { + require.Equal(t, 100, uid) + require.Equal(t, 200, gid) + } + require.Equal(t, os.FileMode(0700), st.Mode()&os.ModePerm) + + st, err = os.Lstat(filepath.Join(t2, "dest/sub/foo.txt")) + require.NoError(t, err) + uid, gid, ok = readUidGid(st) + if ok { + require.Equal(t, 100, uid) + require.Equal(t, 200, gid) + } + require.Equal(t, os.FileMode(0700), st.Mode()&os.ModePerm) + + st, err = os.Lstat(filepath.Join(t2, "dest/sub/sub2")) + require.NoError(t, err) + uid, gid, ok = readUidGid(st) + if ok { + require.Equal(t, 100, uid) + require.Equal(t, 200, gid) + } + require.Equal(t, os.FileMode(0700), st.Mode()&os.ModePerm) +} + func TestCopyDirectoryContentsTimestamp(t *testing.T) { timestamp := time.Unix(0, 0) apply := fstest.Apply( diff --git a/copy/copy_unix_test.go b/copy/copy_unix_test.go index 6045c831..071fa0a4 100644 --- a/copy/copy_unix_test.go +++ b/copy/copy_unix_test.go @@ -170,3 +170,10 @@ func requiresRoot(t *testing.T) { return } } + +func readUidGid(fi os.FileInfo) (uid, gid int, ok bool) { + if stat, ok := fi.Sys().(*syscall.Stat_t); ok { + return int(stat.Uid), int(stat.Gid), true + } + return 0, 0, false +} diff --git a/copy/copy_windows_test.go b/copy/copy_windows_test.go new file mode 100644 index 00000000..f48fce4a --- /dev/null +++ b/copy/copy_windows_test.go @@ -0,0 +1,10 @@ +//go:build windows +// +build windows + +package fs + +import "os" + +func readUidGid(fi os.FileInfo) (uid, gid int, ok bool) { + return 0, 0, false +} From c0f1a459f683b3fb74d6c967e46988a65aa54b2e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Feb 2025 23:27:17 +0000 Subject: [PATCH 64/76] chore(deps): Bump nick-fields/retry from 3.0.0 to 3.0.2 Bumps [nick-fields/retry](https://github.com/nick-fields/retry) from 3.0.0 to 3.0.2. - [Release notes](https://github.com/nick-fields/retry/releases) - [Changelog](https://github.com/nick-fields/retry/blob/master/.releaserc.js) - [Commits](https://github.com/nick-fields/retry/compare/7152eba30c6575329ac0576536151aca5a72780e...ce71cc2ab81d554ebbe88c79ab5975992d79ba08) --- updated-dependencies: - dependency-name: nick-fields/retry dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 715fb748..403740b8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -161,7 +161,7 @@ jobs: vagrant up --no-tty - name: Test - uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0 + uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2 with: timeout_minutes: 20 max_attempts: 5 From 4a39469150ba8adea1bfaf051c44b26800e5665b Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Tue, 25 Feb 2025 16:41:21 -0800 Subject: [PATCH 65/76] add gopls linter fixes Signed-off-by: Tonis Tiigi --- .github/workflows/ci.yml | 3 +- copy/copy.go | 22 +++++++------- copy/copy_linux.go | 2 +- copy/copy_unix.go | 2 +- copy/copy_windows.go | 6 ++-- copy/hardlink_windows.go | 2 +- diskwriter_windows.go | 2 +- docker-bake.hcl | 23 +++++++++++++-- hack/dockerfiles/lint.Dockerfile | 50 +++++++++++++++++++++++++++++++- 9 files changed, 89 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 715fb748..d1d4f8ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,8 @@ jobs: strategy: matrix: target: - - lint-cross + - lint-golangci-cross + - lint-gopls-cross - validate-generated-files - validate-gomod - validate-shfmt diff --git a/copy/copy.go b/copy/copy.go index f24e77f8..443969f1 100644 --- a/copy/copy.go +++ b/copy/copy.go @@ -335,13 +335,13 @@ func (c *copier) copy(ctx context.Context, src, srcComponents, target string, ov if srcComponents != "" { matchesIncludePattern := false matchesExcludePattern := false - matchesIncludePattern, includeMatchInfo, err = c.include(srcComponents, fi, parentIncludeMatchInfo) + matchesIncludePattern, includeMatchInfo, err = c.include(srcComponents, parentIncludeMatchInfo) if err != nil { return err } include = matchesIncludePattern - matchesExcludePattern, excludeMatchInfo, err = c.exclude(srcComponents, fi, parentExcludeMatchInfo) + matchesExcludePattern, excludeMatchInfo, err = c.exclude(srcComponents, parentExcludeMatchInfo) if err != nil { return err } @@ -351,11 +351,11 @@ func (c *copier) copy(ctx context.Context, src, srcComponents, target string, ov } if include { - if err := c.removeTargetIfNeeded(src, target, fi, targetFi); err != nil { + if err := c.removeTargetIfNeeded(target, fi, targetFi); err != nil { return err } - if err := c.createParentDirs(src, srcComponents, target, overwriteTargetMetadata); err != nil { + if err := c.createParentDirs(src, overwriteTargetMetadata); err != nil { return err } } @@ -447,7 +447,7 @@ func (c *copier) notifyChange(target string, fi os.FileInfo) error { return nil } -func (c *copier) include(path string, fi os.FileInfo, parentIncludeMatchInfo patternmatcher.MatchInfo) (bool, patternmatcher.MatchInfo, error) { +func (c *copier) include(path string, parentIncludeMatchInfo patternmatcher.MatchInfo) (bool, patternmatcher.MatchInfo, error) { if c.includePatternMatcher == nil { return true, patternmatcher.MatchInfo{}, nil } @@ -459,7 +459,7 @@ func (c *copier) include(path string, fi os.FileInfo, parentIncludeMatchInfo pat return m, matchInfo, nil } -func (c *copier) exclude(path string, fi os.FileInfo, parentExcludeMatchInfo patternmatcher.MatchInfo) (bool, patternmatcher.MatchInfo, error) { +func (c *copier) exclude(path string, parentExcludeMatchInfo patternmatcher.MatchInfo) (bool, patternmatcher.MatchInfo, error) { if c.excludePatternMatcher == nil { return false, patternmatcher.MatchInfo{}, nil } @@ -471,7 +471,7 @@ func (c *copier) exclude(path string, fi os.FileInfo, parentExcludeMatchInfo pat return m, matchInfo, nil } -func (c *copier) removeTargetIfNeeded(src, target string, srcFi, targetFi os.FileInfo) error { +func (c *copier) removeTargetIfNeeded(target string, srcFi, targetFi os.FileInfo) error { if !c.alwaysReplaceExistingDestPaths { return nil } @@ -488,7 +488,7 @@ func (c *copier) removeTargetIfNeeded(src, target string, srcFi, targetFi os.Fil // Delayed creation of parent directories when a file or dir matches an include // pattern. -func (c *copier) createParentDirs(src, srcComponents, target string, overwriteTargetMetadata bool) error { +func (c *copier) createParentDirs(src string, overwriteTargetMetadata bool) error { for i, parentDir := range c.parentDirs { if parentDir.copied { continue @@ -502,7 +502,7 @@ func (c *copier) createParentDirs(src, srcComponents, target string, overwriteTa return errors.Errorf("%s is not a directory", parentDir.srcPath) } - created, err := copyDirectoryOnly(parentDir.srcPath, parentDir.dstPath, fi, overwriteTargetMetadata) + created, err := copyDirectoryOnly(parentDir.dstPath, fi, overwriteTargetMetadata) if err != nil { return err } @@ -549,7 +549,7 @@ func (c *copier) copyDirectory( // encounter a/b/c. if include { var err error - created, err = copyDirectoryOnly(src, dst, stat, overwriteTargetMetadata) + created, err = copyDirectoryOnly(dst, stat, overwriteTargetMetadata) if err != nil { return created, err } @@ -586,7 +586,7 @@ func (c *copier) copyDirectory( return created, nil } -func copyDirectoryOnly(src, dst string, stat os.FileInfo, overwriteTargetMetadata bool) (bool, error) { +func copyDirectoryOnly(dst string, stat os.FileInfo, overwriteTargetMetadata bool) (bool, error) { if st, err := os.Lstat(dst); err != nil { if !os.IsNotExist(err) { return false, err diff --git a/copy/copy_linux.go b/copy/copy_linux.go index 9b046c53..3df11d6a 100644 --- a/copy/copy_linux.go +++ b/copy/copy_linux.go @@ -15,7 +15,7 @@ func getUIDGID(fi os.FileInfo) (uid, gid int) { return int(st.Uid), int(st.Gid) } -func (c *copier) copyFileInfo(fi os.FileInfo, src, name string) error { +func (c *copier) copyFileInfo(fi os.FileInfo, _, name string) error { chown := c.chown uid, gid := getUIDGID(fi) old := &User{UID: uid, GID: gid} diff --git a/copy/copy_unix.go b/copy/copy_unix.go index df1cdd07..5407c16e 100644 --- a/copy/copy_unix.go +++ b/copy/copy_unix.go @@ -16,7 +16,7 @@ func getUIDGID(fi os.FileInfo) (uid, gid int) { return int(st.Uid), int(st.Gid) } -func (c *copier) copyFileInfo(fi os.FileInfo, src, name string) error { +func (c *copier) copyFileInfo(fi os.FileInfo, _, name string) error { chown := c.chown uid, gid := getUIDGID(fi) old := &User{UID: uid, GID: gid} diff --git a/copy/copy_windows.go b/copy/copy_windows.go index a049565e..45b4f210 100644 --- a/copy/copy_windows.go +++ b/copy/copy_windows.go @@ -13,7 +13,7 @@ const ( seTakeOwnershipPrivilege = "SeTakeOwnershipPrivilege" ) -func getUIDGID(fi os.FileInfo) (uid, gid int) { +func getUIDGID(_ os.FileInfo) (uid, gid int) { return 0, 0 } @@ -119,10 +119,10 @@ func copyFileContent(dst, src *os.File) error { return err } -func copyXAttrs(dst, src string, xeh XAttrErrorHandler) error { +func copyXAttrs(_, _ string, _ XAttrErrorHandler) error { return nil } -func copyDevice(dst string, fi os.FileInfo) error { +func copyDevice(_ string, _ os.FileInfo) error { return errors.New("device copy not supported") } diff --git a/copy/hardlink_windows.go b/copy/hardlink_windows.go index ad8845a7..ce081d68 100644 --- a/copy/hardlink_windows.go +++ b/copy/hardlink_windows.go @@ -2,6 +2,6 @@ package fs import "os" -func getLinkInfo(fi os.FileInfo) (uint64, bool) { +func getLinkInfo(_ os.FileInfo) (uint64, bool) { return 0, false } diff --git a/diskwriter_windows.go b/diskwriter_windows.go index 2dd3f7d0..d278add8 100644 --- a/diskwriter_windows.go +++ b/diskwriter_windows.go @@ -20,7 +20,7 @@ func rewriteMetadata(p string, stat *types.Stat) error { // handleTarTypeBlockCharFifo is an OS-specific helper function used by // createTarFile to handle the following types of header: Block; Char; Fifo -func handleTarTypeBlockCharFifo(path string, stat *types.Stat) error { +func handleTarTypeBlockCharFifo(_ string, _ *types.Stat) error { return errors.New("Not implemented on windows") } diff --git a/docker-bake.hcl b/docker-bake.hcl index ea73bd20..c70ad2b6 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -60,7 +60,15 @@ target "test-noroot" { output = ["${DESTDIR}/coverage"] } -target "lint" { +group "lint" { + targets = ["lint-golangci", "lint-gopls"] +} + +group "lint-cross" { + targets = ["lint-golangci-cross", "lint-gopls-cross"] +} + +target "lint-golangci" { inherits = ["_common"] dockerfile = "./hack/dockerfiles/lint.Dockerfile" output = ["type=cacheonly"] @@ -69,8 +77,17 @@ target "lint" { } } -target "lint-cross" { - inherits = ["lint", "_platforms"] +target "lint-gopls" { + inherits = ["lint-golangci"] + target = "gopls-analyze" +} + +target "lint-golangci-cross" { + inherits = ["lint-golangci", "_platforms"] +} + +target "lint-gopls-cross" { + inherits = ["lint-gopls", "_platforms"] } target "validate-generated-files" { diff --git a/hack/dockerfiles/lint.Dockerfile b/hack/dockerfiles/lint.Dockerfile index ad7a45dc..2189f66b 100644 --- a/hack/dockerfiles/lint.Dockerfile +++ b/hack/dockerfiles/lint.Dockerfile @@ -3,15 +3,63 @@ ARG GO_VERSION=1.23 ARG XX_VERSION=1.6.1 ARG GOLANGCI_LINT_VERSION=1.61.0 +ARG GOPLS_VERSION=v0.26.0 +# GOPLS_ANALYZERS defines gopls analyzers to be run. disabled by default: deprecated unusedvariable simplifyrange +ARG GOPLS_ANALYZERS="embeddirective fillreturns infertypeargs nonewvars norangeoverfunc noresultvalues simplifycompositelit simplifyslice undeclaredname unusedparams useany" FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx -FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine +FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS golang-base RUN apk add --no-cache git gcc musl-dev ENV GOFLAGS="-buildvcs=false" ARG GOLANGCI_LINT_VERSION RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v${GOLANGCI_LINT_VERSION} COPY --link --from=xx / / WORKDIR /go/src/github.com/tonistiigi/fsutil + +FROM golang-base AS gopls +ARG GOPLS_VERSION +WORKDIR /src +RUN git clone https://github.com/golang/tools.git && \ + cd tools && git checkout ${GOPLS_VERSION} +WORKDIR tools/gopls +ARG GOPLS_ANALYZERS +RUN <<'EOF' + set -ex + mkdir -p /out + for analyzer in ${GOPLS_ANALYZERS}; do + mkdir -p internal/cmd/$analyzer + cat < internal/cmd/$analyzer/main.go +package main + +import ( + "golang.org/x/tools/go/analysis/singlechecker" + analyzer "golang.org/x/tools/gopls/internal/analysis/$analyzer" +) + +func main() { singlechecker.Main(analyzer.Analyzer) } +eot + echo "Analyzing with ${analyzer}..." + go build -o /out/$analyzer ./internal/cmd/$analyzer + done +EOF + +FROM golang-base AS gopls-analyze +COPY --link --from=xx / / +ARG GOPLS_ANALYZERS +ARG TARGETNAME +ARG TARGETPLATFORM +RUN --mount=target=. \ + --mount=target=/root/.cache,type=cache,id=lint-cache-${TARGETNAME}-${TARGETPLATFORM} \ + --mount=target=/gopls-analyzers,from=gopls,source=/out < Date: Wed, 26 Feb 2025 17:49:05 -0800 Subject: [PATCH 66/76] fix linter after merge conflict Signed-off-by: Tonis Tiigi --- copy/copy_windows_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copy/copy_windows_test.go b/copy/copy_windows_test.go index f48fce4a..8cac71ae 100644 --- a/copy/copy_windows_test.go +++ b/copy/copy_windows_test.go @@ -5,6 +5,6 @@ package fs import "os" -func readUidGid(fi os.FileInfo) (uid, gid int, ok bool) { +func readUidGid(_ os.FileInfo) (uid, gid int, ok bool) { return 0, 0, false } From 6f3e554a9481614cbda3c12d41c59a7f4f12f196 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Tue, 18 Mar 2025 10:48:34 -0700 Subject: [PATCH 67/76] copy: support for linux X mode Signed-off-by: Tonis Tiigi --- copy/copy_unix_test.go | 2 ++ go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/copy/copy_unix_test.go b/copy/copy_unix_test.go index 071fa0a4..0585950f 100644 --- a/copy/copy_unix_test.go +++ b/copy/copy_unix_test.go @@ -124,6 +124,8 @@ func TestCopyModeTextFormat(t *testing.T) { {"remove execute for all", "a-x", 0644, 0644, 0640, 0600}, {"remove others and add execute for group", "o-rwx,g+x", 0650, 0750, 0750, 0710}, {"capital X (apply execute only if directory)", "a+X", 0644, 0755, 0751, 0711}, + {"capital u-go X (apply execute only if directory)", "u=rwX,go=rX", 0644, 0755, 0755, 0755}, + {"capital u-go X (apply execute only if directory)", "u=rX,go=r", 0444, 0544, 0544, 0544}, {"remove execute and add write for user", "u-x,u+w", 0644, 0655, 0650, 0600}, {"add execute for user and others", "u+x,o+x", 0745, 0755, 0751, 0701}, {"add write and read for group and others", "g+rw,o+rw", 0666, 0777, 0776, 0766}, diff --git a/go.mod b/go.mod index f7865811..4265dfbc 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/planetscale/vtprotobuf v0.6.0 github.com/stretchr/testify v1.8.4 - github.com/tonistiigi/dchapes-mode v0.0.0-20241001053921-ca0759fec205 + github.com/tonistiigi/dchapes-mode v0.0.0-20250318174251-73d941a28323 golang.org/x/sync v0.1.0 golang.org/x/sys v0.11.0 google.golang.org/protobuf v1.31.0 diff --git a/go.sum b/go.sum index b4edbafe..207e72bf 100644 --- a/go.sum +++ b/go.sum @@ -28,8 +28,8 @@ github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/tonistiigi/dchapes-mode v0.0.0-20241001053921-ca0759fec205 h1:eUk79E1w8yMtXeHSzjKorxuC8qJOnyXQnLaJehxpJaI= -github.com/tonistiigi/dchapes-mode v0.0.0-20241001053921-ca0759fec205/go.mod h1:3Iuxbr0P7D3zUzBMAZB+ois3h/et0shEz0qApgHYGpY= +github.com/tonistiigi/dchapes-mode v0.0.0-20250318174251-73d941a28323 h1:r0p7fK56l8WPequOaR3i9LBqfPtEdXIQbUTzT55iqT4= +github.com/tonistiigi/dchapes-mode v0.0.0-20250318174251-73d941a28323/go.mod h1:3Iuxbr0P7D3zUzBMAZB+ois3h/et0shEz0qApgHYGpY= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= From c877f9bdee20b25e9154413d48a11c3387aaf985 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Tue, 8 Apr 2025 11:18:39 +0200 Subject: [PATCH 68/76] ci: install latest vagrant Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d1d4f8ff..1a281f5b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -149,8 +149,10 @@ jobs: name: Install vagrant run: | set -x + wget -O - https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list sudo apt-get update - sudo apt-get install -y libvirt-daemon libvirt-daemon-system vagrant vagrant-libvirt ruby-libvirt + sudo apt-get install -y libvirt-dev libvirt-daemon libvirt-daemon-system vagrant vagrant-libvirt ruby-libvirt sudo systemctl enable --now libvirtd sudo chmod a+rw /var/run/libvirt/libvirt-sock vagrant plugin install vagrant-libvirt From 1fdb88265f6c4ab0eaeebda23daca50a3c959597 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Tue, 8 Apr 2025 11:18:39 +0200 Subject: [PATCH 69/76] ci: infer go version from workflow for bsd tests Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/ci.yml | 11 ++++++++--- hack/Vagrantfile.freebsd | 6 ++++-- hack/Vagrantfile.netbsd | 19 +++++++++++++++---- hack/Vagrantfile.openbsd | 5 +++-- 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1a281f5b..e4a89724 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,9 +4,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -env: - DESTDIR: ./bin - on: workflow_dispatch: schedule: @@ -16,6 +13,10 @@ on: - master pull_request: +env: + DESTDIR: ./bin + GO_VERSION: "1.23" + jobs: validate: runs-on: ubuntu-latest @@ -134,6 +135,10 @@ jobs: name: Prepare run: | echo "VAGRANT_FILE=hack/Vagrantfile.${{ matrix.os }}" >> $GITHUB_ENV + + # Sets semver Go version to be able to download tarball during vagrant setup + goVersion=$(curl --silent "https://go.dev/dl/?mode=json&include=all" | jq -r '.[].files[].version' | uniq | sed -e 's/go//' | sort -V | grep $GO_VERSION | tail -1) + echo "GO_VERSION=$goVersion" >> $GITHUB_ENV - name: Checkout uses: actions/checkout@v4 diff --git a/hack/Vagrantfile.freebsd b/hack/Vagrantfile.freebsd index 5a16f248..a90e3df1 100644 --- a/hack/Vagrantfile.freebsd +++ b/hack/Vagrantfile.freebsd @@ -9,9 +9,11 @@ Vagrant.configure("2") do |config| config.vm.provision "init", type: "shell", run: "once" do |sh| sh.inline = <<~SHELL + set -ex pkg bootstrap - pkg install -y go123 - ln -s /usr/local/bin/go123 /usr/local/bin/go + fetch https://go.dev/dl/go#{ENV['GO_VERSION']}.freebsd-amd64.tar.gz + tar -C /usr/local -xzf go#{ENV['GO_VERSION']}.freebsd-amd64.tar.gz + ln -s /usr/local/go/bin/go /usr/local/bin/go SHELL end end diff --git a/hack/Vagrantfile.netbsd b/hack/Vagrantfile.netbsd index e0f2194a..adc3c192 100644 --- a/hack/Vagrantfile.netbsd +++ b/hack/Vagrantfile.netbsd @@ -9,13 +9,24 @@ Vagrant.configure("2") do |config| config.vm.provision "init", type: "shell", run: "once" do |sh| sh.inline = <<~SHELL - # update CA certs + set -ex + mkdir -p /var/tmp + chmod 1777 /var/tmp + pkgin -y install mozilla-rootcerts mozilla-rootcerts install - ftp https://go.dev/dl/go1.23.2.netbsd-amd64.tar.gz - tar -C /tmp -xzf go1.23.2.netbsd-amd64.tar.gz - ln -s /tmp/go/bin/go /usr/bin/go + ftp https://go.dev/dl/go#{ENV['GO_VERSION']}.netbsd-amd64.tar.gz + tar -C /var/tmp -xzf go#{ENV['GO_VERSION']}.netbsd-amd64.tar.gz + + cat << 'EOF' > /usr/bin/go-wrapper + #!/bin/sh + export TMPDIR="/var/tmp" + exec /var/tmp/go/bin/go "$@" + EOF + chmod +x /usr/bin/go-wrapper + + ln -s /usr/bin/go-wrapper /usr/bin/go SHELL end end diff --git a/hack/Vagrantfile.openbsd b/hack/Vagrantfile.openbsd index e69a424e..f44becad 100644 --- a/hack/Vagrantfile.openbsd +++ b/hack/Vagrantfile.openbsd @@ -9,8 +9,9 @@ Vagrant.configure("2") do |config| config.vm.provision "init", type: "shell", run: "once" do |sh| sh.inline = <<~SHELL - ftp https://go.dev/dl/go1.23.2.openbsd-amd64.tar.gz - tar -C /usr/local -xzf go1.23.2.openbsd-amd64.tar.gz + set -ex + ftp https://go.dev/dl/go#{ENV['GO_VERSION']}.openbsd-amd64.tar.gz + tar -C /usr/local -xzf go#{ENV['GO_VERSION']}.openbsd-amd64.tar.gz ln -s /usr/local/go/bin/go /usr/local/bin/go SHELL end From e9e49a2d3bee07b065e822b11ed759834665418f Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Tue, 8 Apr 2025 11:24:49 +0200 Subject: [PATCH 70/76] ci: fix freebsd package repository Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- hack/Vagrantfile.freebsd | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hack/Vagrantfile.freebsd b/hack/Vagrantfile.freebsd index a90e3df1..14b1caa8 100644 --- a/hack/Vagrantfile.freebsd +++ b/hack/Vagrantfile.freebsd @@ -10,6 +10,9 @@ Vagrant.configure("2") do |config| config.vm.provision "init", type: "shell", run: "once" do |sh| sh.inline = <<~SHELL set -ex + freebsd-version -kru + # switching to "release_2" ensures compatibility with the current Vagrant box + sed -i '' 's/latest/release_2/' /usr/local/etc/pkg/repos/FreeBSD.conf pkg bootstrap fetch https://go.dev/dl/go#{ENV['GO_VERSION']}.freebsd-amd64.tar.gz tar -C /usr/local -xzf go#{ENV['GO_VERSION']}.freebsd-amd64.tar.gz From bdef6d103735df7beaef2e1cd62550889b8da65a Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Mon, 7 Apr 2025 23:24:16 -0700 Subject: [PATCH 71/76] Allow metadata-only receivers This optional mode allows skipping transferring the file data if remote side just hopes to analyze how the local files look like. Signed-off-by: Tonis Tiigi --- buffer.go | 44 ++++++++++++++++++++ buffer_test.go | 70 +++++++++++++++++++++++++++++++ receive.go | 66 ++++++++++++++++++++++++----- receive_test.go | 107 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 276 insertions(+), 11 deletions(-) create mode 100644 buffer.go create mode 100644 buffer_test.go diff --git a/buffer.go b/buffer.go new file mode 100644 index 00000000..09d94acb --- /dev/null +++ b/buffer.go @@ -0,0 +1,44 @@ +package fsutil + +import ( + "io" +) + +const chunkSize = 32 * 1024 + +type buffer struct { + chunks [][]byte +} + +func (b *buffer) alloc(n int) []byte { + if n > chunkSize { + buf := make([]byte, n) + b.chunks = append(b.chunks, buf) + return buf + } + + if len(b.chunks) != 0 { + lastChunk := b.chunks[len(b.chunks)-1] + l := len(lastChunk) + if l+n <= cap(lastChunk) { + lastChunk = lastChunk[:l+n] + b.chunks[len(b.chunks)-1] = lastChunk + return lastChunk[l : l+n] + } + } + + buf := make([]byte, n, chunkSize) + b.chunks = append(b.chunks, buf) + return buf +} + +func (b *buffer) WriteTo(w io.Writer) (n int64, err error) { + for _, c := range b.chunks { + m, err := w.Write(c) + n += int64(m) + if err != nil { + return n, err + } + } + return n, nil +} diff --git a/buffer_test.go b/buffer_test.go new file mode 100644 index 00000000..e24752c1 --- /dev/null +++ b/buffer_test.go @@ -0,0 +1,70 @@ +package fsutil + +import ( + "bytes" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestAllocAndBytes(t *testing.T) { + buf := &buffer{} + + out1 := buf.alloc(10) + require.Len(t, out1, 10) + copy(out1, []byte("abcdefghij")) + + out2 := buf.alloc(5) + require.Len(t, out2, 5) + copy(out2, []byte("12345")) + + res := &bytes.Buffer{} + n, err := buf.WriteTo(res) + require.NoError(t, err) + require.Equal(t, int64(15), n) + require.Equal(t, []byte("abcdefghij12345"), res.Bytes()) +} + +func TestLargeAllocGetsOwnChunk(t *testing.T) { + buf := &buffer{} + + out := buf.alloc(100000) + require.Len(t, out, 100000) + + for i := range out { + out[i] = byte(i % 256) + } + + res := &bytes.Buffer{} + n, err := buf.WriteTo(res) + require.NoError(t, err) + require.Equal(t, int64(100000), n) + require.Equal(t, 100000, res.Len()) +} + +func TestMultipleChunkBoundary(t *testing.T) { + buf := &buffer{} + + var written []byte + for i := 0; i < 100; i++ { + b := buf.alloc(400) + require.Len(t, b, 400) + for j := range b { + b[j] = byte((i + j) % 256) + } + written = append(written, b...) + } + + res := &bytes.Buffer{} + n, err := buf.WriteTo(res) + require.NoError(t, err) + require.Equal(t, int64(40000), n) + require.Equal(t, 40000, res.Len()) + dt := res.Bytes() + for i := 0; i < 100; i++ { + for j := 0; j < 400; j++ { + require.Equal(t, byte((i+j)%256), dt[i*400+j]) + } + } + require.Equal(t, written, dt) +} diff --git a/receive.go b/receive.go index 2f94778a..e819ed1c 100644 --- a/receive.go +++ b/receive.go @@ -32,6 +32,7 @@ package fsutil import ( "context" + "encoding/binary" "io" "os" "path/filepath" @@ -51,6 +52,8 @@ const ( DiffContent ) +const metadataPath = ".fsutil-metadata" + type ReceiveOpt struct { NotifyHashed ChangeFunc ContentHasher ContentHasher @@ -58,6 +61,7 @@ type ReceiveOpt struct { Merge bool Filter FilterFunc Differ DiffType + MetadataOnly FilterFunc } func Receive(ctx context.Context, conn Stream, dest string, opt ReceiveOpt) error { @@ -75,21 +79,23 @@ func Receive(ctx context.Context, conn Stream, dest string, opt ReceiveOpt) erro merge: opt.Merge, filter: opt.Filter, differ: opt.Differ, + metadataOnly: opt.MetadataOnly, } return r.run(ctx) } type receiver struct { - dest string - conn Stream - files map[string]uint32 - pipes map[uint32]io.WriteCloser - mu sync.RWMutex - muPipes sync.RWMutex - progressCb func(int, bool) - merge bool - filter FilterFunc - differ DiffType + dest string + conn Stream + files map[string]uint32 + pipes map[uint32]io.WriteCloser + mu sync.RWMutex + muPipes sync.RWMutex + progressCb func(int, bool) + merge bool + filter FilterFunc + differ DiffType + metadataOnly FilterFunc notifyHashed ChangeFunc contentHasher ContentHasher @@ -164,6 +170,8 @@ func (r *receiver) run(ctx context.Context) error { } w := newDynamicWalker() + metadataOnly := r.metadataOnly != nil + metadataBuffer := &buffer{} g.Go(func() (retErr error) { defer func() { @@ -223,6 +231,22 @@ func (r *receiver) run(ctx context.Context) error { // e.g. a linux path foo/bar\baz cannot be represented on windows return errors.WithStack(&os.PathError{Path: p.Stat.Path, Err: syscall.EINVAL, Op: "unrepresentable path"}) } + if metadataOnly { + if path == metadataPath { + continue + } + n := p.Stat.SizeVT() + dt := metadataBuffer.alloc(n + 4) + binary.LittleEndian.PutUint32(dt[0:4], uint32(n)) + _, err := p.Stat.MarshalToSizedBufferVT(dt[4:]) + if err != nil { + return err + } + if !r.metadataOnly(path, p.Stat) { + i++ + continue + } + } p.Stat.Path = path p.Stat.Linkname = filepath.FromSlash(p.Stat.Linkname) @@ -272,7 +296,27 @@ func (r *receiver) run(ctx context.Context) error { } } }) - return g.Wait() + + if err := g.Wait(); err != nil { + return err + } + + if !metadataOnly { + return nil + } + + // although we don't allow tranferring metadataPath, make sure there was no preexisting file/symlink + os.Remove(filepath.Join(r.dest, metadataPath)) + + f, err := os.OpenFile(filepath.Join(r.dest, metadataPath), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) + if err != nil { + return err + } + if _, err := metadataBuffer.WriteTo(f); err != nil { + f.Close() + return err + } + return f.Close() } func (r *receiver) asyncDataFunc(ctx context.Context, p string, wc io.WriteCloser) error { diff --git a/receive_test.go b/receive_test.go index 5fc1ff8e..3b38d328 100644 --- a/receive_test.go +++ b/receive_test.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "crypto/sha256" + "encoding/binary" "hash" "io" gofs "io/fs" @@ -511,6 +512,112 @@ file zzz.aa assert.Equal(t, false, ok) } +func TestCopyMetadataOnly(t *testing.T) { + d, err := tmpDir(changeStream([]string{ + "ADD foo file data1", + "ADD foo2 file dat2", + "ADD zzz dir", + "ADD zzz/aa file data3", + })) + assert.NoError(t, err) + defer os.RemoveAll(d) + fs, err := NewFS(d) + assert.NoError(t, err) + fs, err = NewFilterFS(fs, &FilterOpt{ + Map: func(_ string, s *types.Stat) MapResult { + s.Uid = 0 + s.Gid = 0 + return MapResultKeep + }, + }) + assert.NoError(t, err) + + dest := t.TempDir() + + ts := newNotificationBuffer() + chs := &changes{fn: ts.HandleChange} + + eg, ctx := errgroup.WithContext(context.Background()) + s1, s2 := sockPairProto(ctx) + + tm := time.Now().Truncate(time.Hour) + + var processCbWasCalled bool + progressCb := func(size int, last bool) { + processCbWasCalled = true + } + + eg.Go(func() error { + defer s1.(*fakeConnProto).closeSend() + return Send(ctx, s1, fs, progressCb) + }) + eg.Go(func() error { + return Receive(ctx, s2, dest, ReceiveOpt{ + NotifyHashed: chs.HandleChange, + ContentHasher: simpleSHA256Hasher, + Filter: func(p string, s *types.Stat) bool { + if runtime.GOOS != "windows" { + // On Windows, Getuid() and Getgid() always return -1 + // See: https://pkg.go.dev/os#Getgid + // See: https://pkg.go.dev/os#Geteuid + s.Uid = uint32(os.Getuid()) + s.Gid = uint32(os.Getgid()) + } + s.ModTime = tm.UnixNano() + return true + }, + MetadataOnly: func(p string, s *types.Stat) bool { + return p == "foo2" + }, + }) + }) + + assert.NoError(t, eg.Wait()) + assert.True(t, processCbWasCalled) + + b := &bytes.Buffer{} + err = Walk(context.Background(), dest, nil, bufWalk(b)) + assert.NoError(t, err) + + assert.Equal(t, `file .fsutil-metadata +file foo2 +`, b.String()) + + dt, err := os.ReadFile(filepath.Join(dest, "foo2")) + assert.NoError(t, err) + assert.Equal(t, "dat2", string(dt)) + + dt, err = os.ReadFile(filepath.Join(dest, ".fsutil-metadata")) + assert.NoError(t, err) + + files := parseFSMetadata(t, dt) + assert.Equal(t, 4, len(files)) + + assert.Equal(t, "foo", files[0].Path) + assert.Equal(t, int64(5), files[0].Size) + assert.Equal(t, "foo2", files[1].Path) + assert.Equal(t, int64(4), files[1].Size) + assert.Equal(t, "zzz", files[2].Path) + assert.Equal(t, int64(0), files[2].Size) + assert.True(t, (&StatInfo{&files[2]}).IsDir()) + assert.Equal(t, "zzz/aa", files[3].Path) + assert.Equal(t, int64(5), files[3].Size) +} + +func parseFSMetadata(t *testing.T, dt []byte) []types.Stat { + var m []types.Stat + for len(dt) > 0 { + var s types.Stat + n := binary.LittleEndian.Uint32(dt[:4]) + dt = dt[4:] + err := s.Unmarshal(dt[:n]) + assert.NoError(t, err) + m = append(m, *s.CloneVT()) + dt = dt[n:] + } + return m +} + func sockPairProto(ctx context.Context) (Stream, Stream) { c1 := make(chan []byte, 32) c2 := make(chan []byte, 32) From 26f1dff95c6b42e71118d01af1b0e06e2768e292 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Tue, 8 Apr 2025 21:46:40 -0700 Subject: [PATCH 72/76] receive: add parent memory for metadata transfers This is needed because metadata-only parent may have a data file as a child. Signed-off-by: Tonis Tiigi --- receive.go | 76 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 70 insertions(+), 6 deletions(-) diff --git a/receive.go b/receive.go index e819ed1c..57d903c5 100644 --- a/receive.go +++ b/receive.go @@ -170,8 +170,11 @@ func (r *receiver) run(ctx context.Context) error { } w := newDynamicWalker() - metadataOnly := r.metadataOnly != nil + metadataTransfer := r.metadataOnly != nil + // buffer Stat metadata in framed proto metadataBuffer := &buffer{} + // stack of parent paths that can be replayed if metadata filter matches + metadataParents := newStack[*currentPath]() g.Go(func() (retErr error) { defer func() { @@ -231,7 +234,8 @@ func (r *receiver) run(ctx context.Context) error { // e.g. a linux path foo/bar\baz cannot be represented on windows return errors.WithStack(&os.PathError{Path: p.Stat.Path, Err: syscall.EINVAL, Op: "unrepresentable path"}) } - if metadataOnly { + var metaOnly bool + if metadataTransfer { if path == metadataPath { continue } @@ -243,14 +247,13 @@ func (r *receiver) run(ctx context.Context) error { return err } if !r.metadataOnly(path, p.Stat) { - i++ - continue + metaOnly = true } } p.Stat.Path = path p.Stat.Linkname = filepath.FromSlash(p.Stat.Linkname) - if fileCanRequestData(os.FileMode(p.Stat.Mode)) { + if !metaOnly && fileCanRequestData(os.FileMode(p.Stat.Mode)) { r.mu.Lock() r.files[p.Stat.Path] = i r.mu.Unlock() @@ -264,6 +267,31 @@ func (r *receiver) run(ctx context.Context) error { if err := r.hlValidator.HandleChange(ChangeKindAdd, cp.path, &StatInfo{cp.stat}, nil); err != nil { return err } + if metadataTransfer { + parent := filepath.Dir(cp.path) + isDir := os.FileMode(p.Stat.Mode).IsDir() + for { + last, ok := metadataParents.peek() + if !ok || parent == last.path { + break + } + metadataParents.pop() + } + if isDir { + metadataParents.push(cp) + } + if metaOnly { + continue + } else { + for _, cp := range metadataParents.items { + if err := w.update(cp); err != nil { + return err + } + } + metadataParents.clear() + } + } + if err := w.update(cp); err != nil { return err } @@ -301,7 +329,7 @@ func (r *receiver) run(ctx context.Context) error { return err } - if !metadataOnly { + if !metadataTransfer { return nil } @@ -371,3 +399,39 @@ func (w *wrappedWriteCloser) Wait(ctx context.Context) error { return w.err } } + +type stack[T any] struct { + items []T +} + +func newStack[T any]() *stack[T] { + return &stack[T]{ + items: make([]T, 0, 8), + } +} + +func (s *stack[T]) push(v T) { + s.items = append(s.items, v) +} + +func (s *stack[T]) pop() (T, bool) { + if len(s.items) == 0 { + var zero T + return zero, false + } + v := s.items[len(s.items)-1] + s.items = s.items[:len(s.items)-1] + return v, true +} + +func (s *stack[T]) peek() (T, bool) { + if len(s.items) == 0 { + var zero T + return zero, false + } + return s.items[len(s.items)-1], true +} + +func (s *stack[T]) clear() { + s.items = s.items[:0] +} From 207219664d60af7c0a890f74cb194910f116a775 Mon Sep 17 00:00:00 2001 From: "Jonathan A. Sternberg" Date: Thu, 17 Apr 2025 09:01:14 -0500 Subject: [PATCH 73/76] stat: ignore apple extended attributes Extended attributes from `com.apple` will bust remote layer caches and shouldn't be transferred to a Linux environment. Skip loading these extended attributes as part of loading xattrs. Signed-off-by: Jonathan A. Sternberg --- stat_test.go | 15 +++++++++++++++ stat_unix.go | 22 +++++++++++++++++++--- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/stat_test.go b/stat_test.go index 05eb0af6..214866ca 100644 --- a/stat_test.go +++ b/stat_test.go @@ -3,6 +3,8 @@ package fsutil import ( "os" "path/filepath" + "runtime" + "strings" "testing" "github.com/stretchr/testify/assert" @@ -54,3 +56,16 @@ func TestStat(t *testing.T) { st.ModTime = 0 assert.Equal(t, &types.Stat{Path: "sock", Mode: 0755 /* ModeSocket not set */}, st) } + +func TestStat_SkipAppleXattrs(t *testing.T) { + if runtime.GOOS != "darwin" { + t.Skip("skipping test that requires darwin") + } + + st, err := Stat("Dockerfile") + assert.NoError(t, err) + + for key := range st.Xattrs { + assert.False(t, strings.HasPrefix(key, "com.apple.")) + } +} diff --git a/stat_unix.go b/stat_unix.go index def901e3..94e5da0f 100644 --- a/stat_unix.go +++ b/stat_unix.go @@ -5,6 +5,7 @@ package fsutil import ( "os" + "strings" "syscall" "github.com/containerd/continuity/sysx" @@ -12,6 +13,8 @@ import ( "github.com/tonistiigi/fsutil/types" ) +const xattrApplePrefix = "com.apple." + func loadXattr(origpath string, stat *types.Stat) error { xattrs, err := sysx.LListxattr(origpath) if err != nil { @@ -23,16 +26,29 @@ func loadXattr(origpath string, stat *types.Stat) error { if len(xattrs) > 0 { m := make(map[string][]byte) for _, key := range xattrs { - v, err := sysx.LGetxattr(origpath, key) - if err == nil { + if skipXattr(key) { + continue + } + + if v, err := sysx.LGetxattr(origpath, key); err == nil { m[key] = v } } - stat.Xattrs = m + + if len(m) > 0 { + stat.Xattrs = m + } } return nil } +func skipXattr(key string) bool { + if strings.HasPrefix(key, xattrApplePrefix) { + return true + } + return false +} + func setUnixOpt(fi os.FileInfo, stat *types.Stat, path string, seenFiles map[uint64]string) { s := fi.Sys().(*syscall.Stat_t) From a5256fcbae3a7366730c31a521bbdf918532a3f4 Mon Sep 17 00:00:00 2001 From: Anthony Nandaa Date: Thu, 5 Jun 2025 22:42:43 +0300 Subject: [PATCH 74/76] fix: send: use platform-specific root path Using "/" was causing a silent bug later on at `fs.go:121` that is expecting platform-specific separators. See discussion at https://github.com/moby/buildkit/pull/6007 Fix this by using `\\` on Windows and `/` on unix. Signed-off-by: Anthony Nandaa --- send.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/send.go b/send.go index e4a31563..31d61008 100644 --- a/send.go +++ b/send.go @@ -148,7 +148,8 @@ func (s *sender) sendFile(h *sendHandle) error { func (s *sender) walk(ctx context.Context) error { var i uint32 = 0 - err := s.fs.Walk(ctx, "/", func(path string, entry os.DirEntry, err error) error { + target := string(filepath.Separator) + err := s.fs.Walk(ctx, target, func(path string, entry os.DirEntry, err error) error { if err != nil { return err } From 2d9f3212b9696d70812f0fc4a397c8c956f26999 Mon Sep 17 00:00:00 2001 From: Janis Horsts Date: Mon, 14 Jul 2025 19:15:38 +0100 Subject: [PATCH 75/76] ci: add CODEOWNERS --- .github/CODEOWNERS | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..231659a8 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +# PRs require approval from the EarthBuild admin team +* @EarthBuild/fork-admins From 78507163b074599983c364d21272c368665f944c Mon Sep 17 00:00:00 2001 From: Janis Horsts Date: Mon, 14 Jul 2025 19:29:15 +0100 Subject: [PATCH 76/76] chore: tidy ci.yml --- .github/workflows/ci.yml | 79 ++++++++++++++++++++++++++-------------- bench/diffcopy.go | 6 +-- 2 files changed, 52 insertions(+), 33 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d950c4f7..574a61d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,6 @@ env: DESTDIR: ./bin GO_VERSION: "1.23" - jobs: validate: runs-on: ubuntu-latest @@ -30,9 +29,11 @@ jobs: - validate-gomod - validate-shfmt steps: - - name: Set up Docker Buildx + - + name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Run + - + name: Run uses: docker/bake-action@v6 with: targets: ${{ matrix.target }} @@ -45,9 +46,11 @@ jobs: - build - cross steps: - - name: Set up Docker Buildx + - + name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Run + - + name: Run uses: docker/bake-action@v6 with: targets: ${{ matrix.target }} @@ -66,13 +69,16 @@ jobs: env: GO_VERSION: ${{ matrix.go }} steps: - - name: Set up Docker Buildx + - + name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Test + - + name: Test uses: docker/bake-action@v6 with: targets: test-${{ matrix.mode }} - - name: Upload coverage + - + name: Upload coverage uses: codecov/codecov-action@v5 # skip the step for EarthBuild if: false @@ -96,18 +102,21 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} - - name: Test + - + name: Test run: | go test -coverprofile="coverage.txt" -covermode="atomic" ./... go tool cover -func="coverage.txt" - - name: Upload coverage - if: always() + - + name: Upload coverage + # skip the step for EarthBuild + if: false uses: codecov/codecov-action@v5 with: files: ./coverage.txt @@ -115,18 +124,27 @@ jobs: flags: unit,go-${{ matrix.go }} token: ${{ secrets.CODECOV_TOKEN }} - test-freebsd-amd64: - # TODO(jhorsts): macOS latest (v10.15) used to contain vagrant but not anymore. - # The comment can be removed when the latest fsutil is merged into this repo. - if: false - runs-on: macos-latest - timeout-minutes: 60 - env: - VAGRANT_VAGRANTFILE: hack/Vagrantfile.freebsd13 + test-bsd-amd64: + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + os: + - freebsd + - netbsd + - openbsd steps: + - + name: Prepare + run: | + echo "VAGRANT_FILE=hack/Vagrantfile.${{ matrix.os }}" >> $GITHUB_ENV + + # Sets semver Go version to be able to download tarball during vagrant setup + goVersion=$(curl --silent "https://go.dev/dl/?mode=json&include=all" | jq -r '.[].files[].version' | uniq | sed -e 's/go//' | sort -V | grep $GO_VERSION | tail -1) + echo "GO_VERSION=$goVersion" >> $GITHUB_ENV - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Cache Vagrant boxes uses: actions/cache@v4 @@ -135,7 +153,8 @@ jobs: key: ${{ runner.os }}-vagrant-${{ matrix.os }}-${{ hashFiles(env.VAGRANT_FILE) }} restore-keys: | ${{ runner.os }}-vagrant-${{ matrix.os }}- - - name: Install vagrant + - + name: Install vagrant run: | set -x wget -O - https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg @@ -146,22 +165,26 @@ jobs: sudo chmod a+rw /var/run/libvirt/libvirt-sock vagrant plugin install vagrant-libvirt vagrant --version - - name: Set up vagrant + - + name: Set up vagrant run: | ln -sf ${{ env.VAGRANT_FILE }} Vagrantfile vagrant up --no-tty - - name: Test - uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2 + - + name: Test + uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2 with: timeout_minutes: 20 max_attempts: 5 command: | vagrant ssh -- "cd /vagrant; go test -buildvcs=false -coverprofile=coverage.txt -covermode=atomic ./..." vagrant ssh -c "sudo cat /vagrant/coverage.txt" > coverage.txt - - name: Upload coverage - if: always() + - + name: Upload coverage + # skip the step for EarthBuild + if: false uses: codecov/codecov-action@v5 with: files: ./coverage.txt flags: unit,${{ matrix.os }} - token: ${{ secrets.CODECOV_TOKEN }} + token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/bench/diffcopy.go b/bench/diffcopy.go index 8c679534..fd3dd297 100644 --- a/bench/diffcopy.go +++ b/bench/diffcopy.go @@ -21,15 +21,11 @@ func diffCopy(proto bool, src, dest string) error { } eg.Go(func() error { -<<<<<<< HEAD - return fsutil.Send(ctx, s1, fsutil.NewFS(src, nil), nil, nil) -======= fs, err := fsutil.NewFS(src) if err != nil { panic(err) } - return fsutil.Send(ctx, s1, fs, nil) ->>>>>>> tonistiigi/master + return fsutil.Send(ctx, s1, fs, nil, nil) }) eg.Go(func() error { return fsutil.Receive(ctx, s2, dest, fsutil.ReceiveOpt{})