Add structcheck, unused, and varcheck linters.

Warn on unused and dead code

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
This commit is contained in:
Daniel Nephin
2017-11-13 16:21:26 -05:00
parent 96e2f30250
commit f74862a0dd
35 changed files with 29 additions and 444 deletions

View File

@@ -38,13 +38,6 @@ type snapshotter struct {
ms *storage.MetaStore
}
type activeSnapshot struct {
id string
name string
parentID interface{}
readonly bool
}
// NewSnapshotter returns a Snapshotter which uses overlayfs. The overlayfs
// diffs are stored under the provided root. A metadata file is stored under
// the root.

View File

@@ -444,11 +444,6 @@ func testCommit(ctx context.Context, t *testing.T, ms *MetaStore) {
assertNotActive(t, err)
}
func testCommitNotExist(ctx context.Context, t *testing.T, ms *MetaStore) {
_, err := CommitActive(ctx, "active-not-exist", "committed-1", snapshot.Usage{})
assertNotExist(t, err)
}
func testCommitExist(ctx context.Context, t *testing.T, ms *MetaStore) {
if err := basePopulate(ctx, ms); err != nil {
t.Fatalf("Populate failed: %+v", err)

View File

@@ -99,6 +99,7 @@ func checkChown(ctx context.Context, t *testing.T, sn snapshot.Snapshotter, work
// checkRename
// https://github.com/docker/docker/issues/25409
func checkRename(ctx context.Context, t *testing.T, sn snapshot.Snapshotter, work string) {
t.Skip("rename test still fails on some kernels with overlay")
l1Init := fstest.Apply(
fstest.CreateDir("/dir1", 0700),
fstest.CreateDir("/somefiles", 0700),

View File

@@ -38,8 +38,7 @@ func SnapshotterSuite(t *testing.T, name string, snapshotterFn func(ctx context.
t.Run("RemoveIntermediateSnapshot", makeTest(name, snapshotterFn, checkRemoveIntermediateSnapshot))
t.Run("DeletedFilesInChildSnapshot", makeTest(name, snapshotterFn, checkDeletedFilesInChildSnapshot))
t.Run("MoveFileFromLowerLayer", makeTest(name, snapshotterFn, checkFileFromLowerLayer))
// Rename test still fails on some kernels with overlay
//t.Run("Rename", makeTest(name, snapshotterFn, checkRename))
t.Run("Rename", makeTest(name, snapshotterFn, checkRename))
t.Run("ViewReadonly", makeTest(name, snapshotterFn, checkSnapshotterViewReadonly))