浏览代码

Fix golint issues

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 7 年之前
父节点
当前提交
35f7e7c50a

+ 4 - 14
builder/builder-next/adapters/snapshot/snapshot.go

@@ -90,20 +90,13 @@ func (s *snapshotter) Prepare(ctx context.Context, key, parent string, opts ...s
 	if err := s.opt.GraphDriver.Create(key, parent, nil); err != nil {
 		return err
 	}
-	if err := s.db.Update(func(tx *bolt.Tx) error {
+	return s.db.Update(func(tx *bolt.Tx) error {
 		b, err := tx.CreateBucketIfNotExists([]byte(key))
 		if err != nil {
 			return err
 		}
-
-		if err := b.Put(keyParent, []byte(origParent)); err != nil {
-			return err
-		}
-		return nil
-	}); err != nil {
-		return err
-	}
-	return nil
+		return b.Put(keyParent, []byte(origParent))
+	})
 }
 
 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
 		if err != nil {
 			return err
 		}
-		if err := b.Put(keyCommitted, []byte(key)); err != nil {
-			return err
-		}
-		return nil
+		return b.Put(keyCommitted, []byte(key))
 	})
 }
 

+ 2 - 0
integration/internal/container/container.go

@@ -21,6 +21,7 @@ type TestContainerConfig struct {
 }
 
 // Create creates a container with the specified options
+// nolint: golint
 func Create(t *testing.T, ctx context.Context, client client.APIClient, ops ...func(*TestContainerConfig)) string { // nolint: golint
 	t.Helper()
 	config := &TestContainerConfig{
@@ -43,6 +44,7 @@ func Create(t *testing.T, ctx context.Context, client client.APIClient, ops ...f
 }
 
 // Run creates and start a container with the specified options
+// nolint: golint
 func Run(t *testing.T, ctx context.Context, client client.APIClient, ops ...func(*TestContainerConfig)) string { // nolint: golint
 	t.Helper()
 	id := Create(t, ctx, client, ops...)

+ 1 - 0
integration/internal/network/network.go

@@ -26,6 +26,7 @@ func Create(ctx context.Context, client client.APIClient, name string, ops ...fu
 }
 
 // CreateNoError creates a network with the specified options and verifies there were no errors
+// nolint: golint
 func CreateNoError(t *testing.T, ctx context.Context, client client.APIClient, name string, ops ...func(*types.NetworkCreate)) string { // nolint: golint
 	t.Helper()
 

+ 1 - 0
integration/plugin/graphdriver/external_test.go

@@ -437,6 +437,7 @@ func TestGraphdriverPluginV2(t *testing.T) {
 	testGraphDriver(t, client, ctx, plugin, nil)
 }
 
+// nolint: golint
 func testGraphDriver(t *testing.T, c client.APIClient, ctx context.Context, driverName string, afterContainerRunFn func(*testing.T)) { //nolint: golint
 	id := container.Run(t, ctx, c, container.WithCmd("sh", "-c", "echo hello > /hello"))