Skip to content

Commit

Permalink
switch to github.com/containerd/log module
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed Jun 21, 2024
1 parent 56a67e3 commit 1651a36
Show file tree
Hide file tree
Showing 187 changed files with 4,992 additions and 2,097 deletions.
27 changes: 13 additions & 14 deletions cmd/continuity/commands/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
package commands

import (
"log"
"os"
"os/signal"
"path/filepath"
Expand All @@ -33,7 +32,7 @@ import (
"github.com/containerd/continuity"
"github.com/containerd/continuity/cmd/continuity/continuityfs"
"github.com/containerd/continuity/driver"
"github.com/sirupsen/logrus"
"github.com/containerd/log"
"github.com/spf13/cobra"
)

Expand All @@ -42,7 +41,7 @@ var MountCmd = &cobra.Command{
Short: "Mount the manifest to the provided mountpoint using content from a source directory",
Run: func(cmd *cobra.Command, args []string) {
if len(args) != 3 {
log.Fatal("Must specify mountpoint, manifest, and source directory")
log.L.Fatal("Must specify mountpoint, manifest, and source directory")
}
mountpoint := args[0]
manifest, source := args[1], args[2]
Expand All @@ -51,24 +50,24 @@ var MountCmd = &cobra.Command{

p, err := os.ReadFile(manifest)
if err != nil {
log.Fatalf("error reading manifest: %v", err)
log.L.Fatalf("error reading manifest: %v", err)
}

m, err := continuity.Unmarshal(p)
if err != nil {
log.Fatalf("error unmarshaling manifest: %v", err)
log.L.Fatalf("error unmarshaling manifest: %v", err)
}

driver, err := driver.NewSystemDriver()
if err != nil {
logrus.Fatal(err)
log.L.Fatal(err)
}

provider := continuityfs.NewFSFileContentProvider(source, driver)

contfs, err := continuityfs.NewFSFromManifest(m, mountpoint, provider)
if err != nil {
logrus.Fatal(err)
log.L.Fatal(err)
}

c, err := fuse.Mount(
Expand All @@ -81,13 +80,13 @@ var MountCmd = &cobra.Command{
fuse.VolumeName("Continuity FileSystem"),
)
if err != nil {
logrus.Fatal(err)
log.L.Fatal(err)
}

<-c.Ready
if err := c.MountError; err != nil {
c.Close()
logrus.Fatal(err)
log.L.Fatal(err)
}

errChan := make(chan error, 1)
Expand All @@ -105,27 +104,27 @@ var MountCmd = &cobra.Command{

select {
case <-sigChan:
logrus.Infof("Shutting down")
log.L.Infof("Shutting down")
case err = <-errChan:
}

go func() {
if err := c.Close(); err != nil {
logrus.Errorf("Unable to close connection %s", err)
log.L.Errorf("Unable to close connection %s", err)
}
}()

// Wait for any inprogress requests to be handled
time.Sleep(time.Second)

logrus.Infof("Attempting unmount")
log.L.Info("Attempting unmount")
if err := fuse.Unmount(mountpoint); err != nil {
logrus.Errorf("Error unmounting %s: %v", mountpoint, err)
log.L.Errorf("Error unmounting %s: %v", mountpoint, err)
}

// Handle server error
if err != nil {
logrus.Fatalf("Error serving fuse server: %v", err)
log.L.Fatalf("Error serving fuse server: %v", err)
}
},
}
14 changes: 7 additions & 7 deletions cmd/continuity/continuityfs/fuse.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import (
"bazil.org/fuse"
"bazil.org/fuse/fs"
"github.com/containerd/continuity"
"github.com/containerd/log"
"github.com/opencontainers/go-digest"
"github.com/sirupsen/logrus"
)

// File represents any file type (non directory) in the filesystem
Expand Down Expand Up @@ -93,7 +93,7 @@ func (f *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenR
// TODO(dmcgowan): else check if device can be opened for read
r, err := f.provider.Open(f.resource.Path(), dgst)
if err != nil {
logrus.Debugf("Error opening handle: %v", err)
log.G(ctx).Debugf("Error opening handle: %v", err)
return nil, err
}
return &fileHandler{
Expand Down Expand Up @@ -132,7 +132,7 @@ func (h *fileHandler) Read(ctx context.Context, req *fuse.ReadRequest, resp *fus
if h.offset != req.Offset {
if seeker, ok := h.reader.(io.Seeker); ok {
if _, err := seeker.Seek(req.Offset, io.SeekStart); err != nil {
logrus.Debugf("Error seeking: %v", err)
log.G(ctx).Debugf("Error seeking: %v", err)
return err
}
h.offset = req.Offset
Expand All @@ -143,7 +143,7 @@ func (h *fileHandler) Read(ctx context.Context, req *fuse.ReadRequest, resp *fus

n, err := h.reader.Read(resp.Data[:req.Size])
if err != nil {
logrus.Debugf("Read error: %v", err)
log.G(ctx).Debugf("Read error: %v", err)
return err
}
h.offset = h.offset + int64(n)
Expand Down Expand Up @@ -214,7 +214,7 @@ func (d *Dir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
}
ents = append(ents, de)
} else {
logrus.Errorf("%s does not have a directory entry", name)
log.G(ctx).Errorf("%s does not have a directory entry", name)
}
}

Expand Down Expand Up @@ -249,15 +249,15 @@ func addNode(path string, node fs.Node, cache map[string]*Dir, provider FileCont
addNode(filepath.Clean(dirPath), d, cache, provider)
}
d.nodes[file] = node
logrus.Debugf("%s (%#v) added to %s", file, node, dirPath)
log.G(context.TODO()).Debugf("%s (%#v) added to %s", file, node, dirPath)
}

type treeRoot struct {
root *Dir
}

func (t treeRoot) Root() (fs.Node, error) {
logrus.Debugf("Returning root with %#v", t.root.nodes)
log.G(context.TODO()).Debugf("Returning root with %#v", t.root.nodes)
return t.root, nil
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/continuity/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ go 1.17
require (
bazil.org/fuse v0.0.0-20200524192727-fb710f7dfd05
github.com/containerd/continuity v0.0.0-00010101000000-000000000000 // see replace
github.com/containerd/log v0.1.0
github.com/dustin/go-humanize v1.0.0
github.com/golang/protobuf v1.5.2
github.com/opencontainers/go-digest v1.0.0
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.4.0
)

require (
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/sys v0.1.0 // indirect
golang.org/x/sys v0.7.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
)

Expand Down
7 changes: 7 additions & 0 deletions cmd/continuity/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ bazil.org/fuse v0.0.0-20200524192727-fb710f7dfd05 h1:UrYe9YkT4Wpm6D+zByEyCJQzDqT
bazil.org/fuse v0.0.0-20200524192727-fb710f7dfd05/go.mod h1:h0h5FBYpXThbvSfTqthw+0I4nmHnhTHkO5BoOHsBWqg=
github.com/Julusian/godocdown v0.0.0-20170816220326-6d19f8ff2df8/go.mod h1:INZr5t32rG59/5xeltqoCJoNY7e5x/3xoY9WSWVWg74=
github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY=
github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo=
github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
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=
Expand All @@ -17,6 +18,7 @@ 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/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand All @@ -26,6 +28,7 @@ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD
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/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q=
github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
Expand All @@ -35,6 +38,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c h1:u6SKchux2yDvFQnDHS3lPnIRmfVJ5Sxy3ao2SIdysLQ=
github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c/go.mod h1:hzIxponao9Kjc7aWznkXaL4U4TWaDSs8zcsY4Ka08nM=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand All @@ -52,8 +56,10 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191210023423-ac6580df4449/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
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.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200423201157-2723c5de0d66/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
Expand All @@ -67,3 +73,4 @@ google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGm
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
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=
4 changes: 2 additions & 2 deletions fs/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"os"
"path/filepath"

"github.com/sirupsen/logrus"
"github.com/containerd/log"
)

// XAttrErrorHandler transform a non-nil xattr error.
Expand Down Expand Up @@ -161,7 +161,7 @@ func copyDirectory(dst, src string, inodes map[uint64]string, o *copyDirOpts) er
return fmt.Errorf("failed to create irregular file: %w", err)
}
default:
logrus.Warnf("unsupported mode: %s: %s", source, fileInfo.Mode())
log.L.Warnf("unsupported mode: %s: %s", source, fileInfo.Mode())
return nil
}

Expand Down
6 changes: 3 additions & 3 deletions fs/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"path/filepath"
"strings"

"github.com/sirupsen/logrus"
"github.com/containerd/log"
"golang.org/x/sync/errgroup"
)

Expand Down Expand Up @@ -101,11 +101,11 @@ type ChangeFunc func(ChangeKind, string, os.FileInfo, error) error
// is to account for timestamp truncation during archiving.
func Changes(ctx context.Context, a, b string, changeFn ChangeFunc) error {
if a == "" {
logrus.Debugf("Using single walk diff for %s", b)
log.G(ctx).Debugf("Using single walk diff for %s", b)
return addDirChanges(ctx, changeFn, b)
}

logrus.Debugf("Using double walk diff for %s from %s", b, a)
log.G(ctx).Debugf("Using double walk diff for %s from %s", b, a)
return doubleWalkDiff(ctx, changeFn, a, b)
}

Expand Down
11 changes: 7 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ go 1.19

require (
github.com/Microsoft/go-winio v0.5.2
github.com/containerd/log v0.1.0
github.com/opencontainers/go-digest v1.0.0
github.com/sirupsen/logrus v1.8.1
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sys v0.1.0
golang.org/x/sync v0.1.0
golang.org/x/sys v0.7.0
google.golang.org/protobuf v1.33.0
)

require github.com/stretchr/testify v1.3.0 // indirect
require (
github.com/sirupsen/logrus v1.9.3 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
23 changes: 15 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
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/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=
Expand All @@ -9,18 +11,23 @@ github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3I
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=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
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=
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/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
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=
8 changes: 4 additions & 4 deletions testutil/loopback/loopback_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"strings"
"syscall"

"github.com/sirupsen/logrus"
"github.com/containerd/log"
)

// New creates a loopback device
Expand Down Expand Up @@ -57,18 +57,18 @@ func New(size int64) (*Loopback, error) {
}

deviceName := strings.TrimSpace(stdout.String())
logrus.Debugf("Created loop device %s (using %s)", deviceName, file.Name())
log.L.Debugf("Created loop device %s (using %s)", deviceName, file.Name())

cleanup := func() error {
// detach device
logrus.Debugf("Removing loop device %s", deviceName)
log.L.Debugf("Removing loop device %s", deviceName)
losetup := exec.Command("losetup", "--detach", deviceName)
if out, err := losetup.CombinedOutput(); err != nil {
return fmt.Errorf("Could not remove loop device %s (%v): %q: %w", deviceName, losetup.Args, string(out), err)
}

// remove file
logrus.Debugf("Removing temporary file %s", file.Name())
log.L.Debugf("Removing temporary file %s", file.Name())
return os.Remove(file.Name())
}

Expand Down
30 changes: 30 additions & 0 deletions vendor/github.com/containerd/log/.golangci.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1651a36

Please sign in to comment.