diff --git a/README.md b/README.md index 3618fb6..b747037 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # [containerd](https://github.com/containerd/containerd) ZFS snapshotter plugin -[![Build Status](https://github.com/containerd/zfs/workflows/CI/badge.svg)](https://github.com/containerd/zfs/actions?query=workflow%3ACI) +[![PkgGoDev](https://pkg.go.dev/badge/github.com/containerd/zfs)](https://pkg.go.dev/github.com/containerd/zfs) +[![Build Status](https://github.com/containerd/zfs/actions/workflows/ci.yml/badge.svg)](https://github.com/containerd/zfs/actions/workflows/ci.yml) +[![Go Report Card](https://goreportcard.com/badge/github.com/containerd/zfs)](https://goreportcard.com/report/github.com/containerd/zfs) [![codecov](https://codecov.io/gh/containerd/zfs/branch/main/graph/badge.svg)](https://codecov.io/gh/containerd/zfs) ZFS snapshotter plugin for containerd. diff --git a/zfs.go b/zfs.go index bd26aa2..e48b956 100644 --- a/zfs.go +++ b/zfs.go @@ -75,11 +75,9 @@ func NewSnapshotter(root string) (snapshots.Snapshotter, error) { return b, nil } -var ( - zfsCreateProperties = map[string]string{ - "mountpoint": "legacy", - } -) +var zfsCreateProperties = map[string]string{ + "mountpoint": "legacy", +} // createFilesystem creates but not mount. func createFilesystem(datasetName string) (*zfs.Dataset, error) { @@ -138,7 +136,6 @@ func (z *snapshotter) usage(ctx context.Context, key string) (snapshots.Usage, e if info.Kind == snapshots.KindActive { activeName := filepath.Join(z.dataset.Name, id) sDataset, err := zfs.GetDataset(activeName) - if err != nil { return snapshots.Usage{}, err } diff --git a/zfs_test.go b/zfs_test.go index b97326c..991fc62 100644 --- a/zfs_test.go +++ b/zfs_test.go @@ -101,11 +101,7 @@ func TestZFSUsage(t *testing.T) { ctx := context.Background() // Create temporary directory - root, err := os.MkdirTemp("", "TestZFSUsage-") - if err != nil { - t.Error(err) - } - defer os.RemoveAll(root) + root := t.TempDir() // Create the snapshotter z, closer, err := newSnapshotter()(ctx, root) @@ -142,7 +138,7 @@ func TestZFSUsage(t *testing.T) { ) // Create a child layer with a 1MB file - baseApplier := fstest.Apply(fstest.CreateRandomFile("/a", 12345679, oneMB, 0777)) + baseApplier := fstest.Apply(fstest.CreateRandomFile("/a", 12345679, oneMB, 0o777)) target = filepath.Join(root, "prepare-2") mounts, err := z.Prepare(ctx, target, filepath.Join(root, "layer-1")) @@ -172,7 +168,7 @@ func TestZFSUsage(t *testing.T) { } // Create another child layer with a 2MB file - baseApplier = fstest.Apply(fstest.CreateRandomFile("/b", 12345679, twoMB, 0777)) + baseApplier = fstest.Apply(fstest.CreateRandomFile("/b", 12345679, twoMB, 0o777)) target = filepath.Join(root, "prepare-3") mounts, err = z.Prepare(ctx, target, filepath.Join(root, "layer-2"))