Browse code

Fix golint issues

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2018/07/10 02:51:13
Showing 4 changed files
... ...
@@ -90,20 +90,13 @@ func (s *snapshotter) Prepare(ctx context.Context, key, parent string, opts ...s
90 90
 	if err := s.opt.GraphDriver.Create(key, parent, nil); err != nil {
91 91
 		return err
92 92
 	}
93
-	if err := s.db.Update(func(tx *bolt.Tx) error {
93
+	return s.db.Update(func(tx *bolt.Tx) error {
94 94
 		b, err := tx.CreateBucketIfNotExists([]byte(key))
95 95
 		if err != nil {
96 96
 			return err
97 97
 		}
98
-
99
-		if err := b.Put(keyParent, []byte(origParent)); err != nil {
100
-			return err
101
-		}
102
-		return nil
103
-	}); err != nil {
104
-		return err
105
-	}
106
-	return nil
98
+		return b.Put(keyParent, []byte(origParent))
99
+	})
107 100
 }
108 101
 
109 102
 func (s *snapshotter) chainID(key string) (layer.ChainID, bool) {
... ...
@@ -332,10 +325,7 @@ func (s *snapshotter) Commit(ctx context.Context, name, key string, opts ...snap
332 332
 		if err != nil {
333 333
 			return err
334 334
 		}
335
-		if err := b.Put(keyCommitted, []byte(key)); err != nil {
336
-			return err
337
-		}
338
-		return nil
335
+		return b.Put(keyCommitted, []byte(key))
339 336
 	})
340 337
 }
341 338
 
... ...
@@ -21,6 +21,7 @@ type TestContainerConfig struct {
21 21
 }
22 22
 
23 23
 // Create creates a container with the specified options
24
+// nolint: golint
24 25
 func Create(t *testing.T, ctx context.Context, client client.APIClient, ops ...func(*TestContainerConfig)) string { // nolint: golint
25 26
 	t.Helper()
26 27
 	config := &TestContainerConfig{
... ...
@@ -43,6 +44,7 @@ func Create(t *testing.T, ctx context.Context, client client.APIClient, ops ...f
43 43
 }
44 44
 
45 45
 // Run creates and start a container with the specified options
46
+// nolint: golint
46 47
 func Run(t *testing.T, ctx context.Context, client client.APIClient, ops ...func(*TestContainerConfig)) string { // nolint: golint
47 48
 	t.Helper()
48 49
 	id := Create(t, ctx, client, ops...)
... ...
@@ -26,6 +26,7 @@ func Create(ctx context.Context, client client.APIClient, name string, ops ...fu
26 26
 }
27 27
 
28 28
 // CreateNoError creates a network with the specified options and verifies there were no errors
29
+// nolint: golint
29 30
 func CreateNoError(t *testing.T, ctx context.Context, client client.APIClient, name string, ops ...func(*types.NetworkCreate)) string { // nolint: golint
30 31
 	t.Helper()
31 32
 
... ...
@@ -437,6 +437,7 @@ func TestGraphdriverPluginV2(t *testing.T) {
437 437
 	testGraphDriver(t, client, ctx, plugin, nil)
438 438
 }
439 439
 
440
+// nolint: golint
440 441
 func testGraphDriver(t *testing.T, c client.APIClient, ctx context.Context, driverName string, afterContainerRunFn func(*testing.T)) { //nolint: golint
441 442
 	id := container.Run(t, ctx, c, container.WithCmd("sh", "-c", "echo hello > /hello"))
442 443