From 35f7e7c50a131494c9d530800e80bf2da42fb89c Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 9 Jul 2018 19:51:13 +0200 Subject: [PATCH] Fix golint issues Signed-off-by: Sebastiaan van Stijn --- .../builder-next/adapters/snapshot/snapshot.go | 18 ++++-------------- integration/internal/container/container.go | 2 ++ integration/internal/network/network.go | 1 + .../plugin/graphdriver/external_test.go | 1 + 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/builder/builder-next/adapters/snapshot/snapshot.go b/builder/builder-next/adapters/snapshot/snapshot.go index 5b2c583a17..e1a12a4563 100644 --- a/builder/builder-next/adapters/snapshot/snapshot.go +++ b/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)) }) } diff --git a/integration/internal/container/container.go b/integration/internal/container/container.go index 489e07154a..20ad774242 100644 --- a/integration/internal/container/container.go +++ b/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...) diff --git a/integration/internal/network/network.go b/integration/internal/network/network.go index 9c13114f92..07d366433b 100644 --- a/integration/internal/network/network.go +++ b/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() diff --git a/integration/plugin/graphdriver/external_test.go b/integration/plugin/graphdriver/external_test.go index 3596056a84..2aabc21df3 100644 --- a/integration/plugin/graphdriver/external_test.go +++ b/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"))