1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Remove unused functions, variables, fields

opts/env_test: suppress a linter warning

this one:

> opts/env_test.go:95:4: U1000: field `err` is unused (unused)
> 			err      error
>			^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2019-08-05 17:50:51 +02:00
parent bca161d7cb
commit 744f1c261c
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
8 changed files with 8 additions and 13 deletions

View file

@ -180,7 +180,7 @@ func TestValidateManifest(t *testing.T) {
t.Fatal("error unmarshaling manifest:", err)
}
verifiedManifest, err = verifySchema1Manifest(&badSignedManifest, expectedDigest)
_, err = verifySchema1Manifest(&badSignedManifest, expectedDigest)
if err == nil || !strings.HasPrefix(err.Error(), "image verification failed for digest") {
t.Fatal("expected validateManifest to fail with digest error")
}

View file

@ -171,10 +171,6 @@ func getCachedLayer(l Layer) *roLayer {
return l.(*roLayer)
}
func getMountLayer(l RWLayer) *mountedLayer {
return l.(*referencedRWLayer).mountedLayer
}
func createMetadata(layers ...Layer) []Metadata {
metadata := make([]Metadata, len(layers))
for i := range layers {

View file

@ -13,7 +13,6 @@ type mountedLayer struct {
mountID string
initID string
parent *roLayer
path string
layerStore *layerStore
sync.Mutex

View file

@ -96,9 +96,9 @@ func TestValidateEnv(t *testing.T) {
}{
value: "PaTh",
expected: fmt.Sprintf("PaTh=%v", os.Getenv("PATH")),
err: nil,
}
testcase = append(testcase, tmp)
}
for _, r := range testcase {

View file

@ -122,7 +122,7 @@ func TestMountReadonly(t *testing.T) {
}
}()
f, err = os.OpenFile(targetPath, os.O_RDWR, 0777)
_, err = os.OpenFile(targetPath, os.O_RDWR, 0777)
if err == nil {
t.Fatal("Should not be able to open a ro file as rw")
}

View file

@ -127,7 +127,6 @@ type scanner struct {
delim []byte
err error
idx int
done bool
}
func (s *scanner) Start(ctx context.Context) int64 {

View file

@ -110,8 +110,9 @@ func TestAddDeleteGet(t *testing.T) {
t.Fatalf("error creating temp file: %v", err)
}
_, err = jsonFile.Write([]byte(`{}`))
jsonFile.Close()
defer os.RemoveAll(jsonFile.Name())
assert.NilError(t, err)
_ = jsonFile.Close()
defer func() { _ = os.RemoveAll(jsonFile.Name()) }()
store, err := NewReferenceStore(jsonFile.Name())
if err != nil {

View file

@ -147,14 +147,14 @@ func TestServiceGet(t *testing.T) {
assert.NilError(t, err)
assert.Assert(t, is.Len(v.Status, 1), v.Status)
v, err = service.Get(ctx, "test", opts.WithGetDriver("notarealdriver"))
_, err = service.Get(ctx, "test", opts.WithGetDriver("notarealdriver"))
assert.Assert(t, errdefs.IsConflict(err), err)
v, err = service.Get(ctx, "test", opts.WithGetDriver("d1"))
assert.Assert(t, err == nil)
assert.Assert(t, is.DeepEqual(created, v))
assert.Assert(t, ds.Register(testutils.NewFakeDriver("d2"), "d2"))
v, err = service.Get(ctx, "test", opts.WithGetDriver("d2"))
_, err = service.Get(ctx, "test", opts.WithGetDriver("d2"))
assert.Assert(t, errdefs.IsConflict(err), err)
}