From 438c19f2afdcb8edf1ae60a9bb8ea219da9bb8e2 Mon Sep 17 00:00:00 2001 From: Andrew Nester Date: Mon, 16 Dec 2024 13:42:12 +0100 Subject: [PATCH] fixed lint --- bundle/apps/upload_config_test.go | 2 +- bundle/apps/validate.go | 3 +-- bundle/deploy/terraform/tfdyn/convert_app.go | 4 ---- bundle/deploy/terraform/tfdyn/convert_app_test.go | 3 +-- bundle/run/app.go | 3 --- bundle/tests/apps_test.go | 1 - integration/bundle/helpers_test.go | 4 ++-- libs/dyn/merge/elements_by_key.go | 6 +++--- 8 files changed, 8 insertions(+), 18 deletions(-) diff --git a/bundle/apps/upload_config_test.go b/bundle/apps/upload_config_test.go index 56e3101e..2d9b1c70 100644 --- a/bundle/apps/upload_config_test.go +++ b/bundle/apps/upload_config_test.go @@ -20,7 +20,7 @@ import ( func TestAppUploadConfig(t *testing.T) { root := t.TempDir() - err := os.MkdirAll(filepath.Join(root, "my_app"), 0700) + err := os.MkdirAll(filepath.Join(root, "my_app"), 0o700) require.NoError(t, err) b := &bundle.Bundle{ diff --git a/bundle/apps/validate.go b/bundle/apps/validate.go index d12d0131..dfb3fffa 100644 --- a/bundle/apps/validate.go +++ b/bundle/apps/validate.go @@ -9,8 +9,7 @@ import ( "github.com/databricks/cli/libs/diag" ) -type validate struct { -} +type validate struct{} func (v *validate) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics { var diags diag.Diagnostics diff --git a/bundle/deploy/terraform/tfdyn/convert_app.go b/bundle/deploy/terraform/tfdyn/convert_app.go index a07d8172..235b3a56 100644 --- a/bundle/deploy/terraform/tfdyn/convert_app.go +++ b/bundle/deploy/terraform/tfdyn/convert_app.go @@ -29,10 +29,6 @@ func (appConverter) Convert(ctx context.Context, key string, vin dyn.Value, out return err } - if err != nil { - return err - } - // Add the converted resource to the output. out.App[key] = vout.AsAny() diff --git a/bundle/deploy/terraform/tfdyn/convert_app_test.go b/bundle/deploy/terraform/tfdyn/convert_app_test.go index 5f309d1c..5dfebdc0 100644 --- a/bundle/deploy/terraform/tfdyn/convert_app_test.go +++ b/bundle/deploy/terraform/tfdyn/convert_app_test.go @@ -14,7 +14,7 @@ import ( ) func TestConvertApp(t *testing.T) { - var src = resources.App{ + src := resources.App{ SourceCodePath: "./app", Config: map[string]any{ "command": []string{"python", "app.py"}, @@ -95,5 +95,4 @@ func TestConvertApp(t *testing.T) { }, }, }, out.Permissions["app_my_app"]) - } diff --git a/bundle/run/app.go b/bundle/run/app.go index 2bbce10c..3bcdc221 100644 --- a/bundle/run/app.go +++ b/bundle/run/app.go @@ -102,7 +102,6 @@ func (a *appRunner) start(ctx context.Context) error { } logProgress(ctx, "App is starting...") }).Get() - if err != nil { return err } @@ -149,7 +148,6 @@ func (a *appRunner) deploy(ctx context.Context) error { SourceCodePath: app.SourceCodePath, }, }) - // If deploy returns an error, then there's an active deployment in progress, wait for it to complete. if err != nil { return err @@ -161,7 +159,6 @@ func (a *appRunner) deploy(ctx context.Context) error { } logProgress(ctx, ad.Status.Message) }).Get() - if err != nil { return err } diff --git a/bundle/tests/apps_test.go b/bundle/tests/apps_test.go index 2b777a32..7fee60d1 100644 --- a/bundle/tests/apps_test.go +++ b/bundle/tests/apps_test.go @@ -57,5 +57,4 @@ func TestAppsOverride(t *testing.T) { assert.Equal(t, "key", app.Resources[2].Secret.Key) assert.Equal(t, "scope", app.Resources[2].Secret.Scope) assert.Equal(t, "CAN_USE", string(app.Resources[2].Secret.Permission)) - } diff --git a/integration/bundle/helpers_test.go b/integration/bundle/helpers_test.go index eb5095e9..c62c7930 100644 --- a/integration/bundle/helpers_test.go +++ b/integration/bundle/helpers_test.go @@ -119,7 +119,7 @@ func runResource(t testutil.TestingT, ctx context.Context, path, key string) (st return stdout.String(), err } -func runResourceWithStderr(t testutil.TestingT, ctx context.Context, path string, key string) (string, string, error) { +func runResourceWithStderr(t testutil.TestingT, ctx context.Context, path, key string) (string, string, error) { ctx = env.Set(ctx, "BUNDLE_ROOT", path) ctx = cmdio.NewContext(ctx, cmdio.Default()) @@ -128,7 +128,7 @@ func runResourceWithStderr(t testutil.TestingT, ctx context.Context, path string return stdout.String(), stderr.String(), err } -func runResourceWithParams(t testutil.TestingT, ctx context.Context, path string, key string, params ...string) (string, error) { +func runResourceWithParams(t testutil.TestingT, ctx context.Context, path, key string, params ...string) (string, error) { ctx = env.Set(ctx, "BUNDLE_ROOT", path) ctx = cmdio.NewContext(ctx, cmdio.Default()) diff --git a/libs/dyn/merge/elements_by_key.go b/libs/dyn/merge/elements_by_key.go index e94c5fdc..df393003 100644 --- a/libs/dyn/merge/elements_by_key.go +++ b/libs/dyn/merge/elements_by_key.go @@ -7,7 +7,7 @@ type elementsByKey struct { keyFunc func(dyn.Value) string } -func (e elementsByKey) doMap(_ dyn.Path, v dyn.Value, mergeFunc func(a dyn.Value, b dyn.Value) (dyn.Value, error)) (dyn.Value, error) { +func (e elementsByKey) doMap(_ dyn.Path, v dyn.Value, mergeFunc func(a, b dyn.Value) (dyn.Value, error)) (dyn.Value, error) { // We know the type of this value is a sequence. // For additional defence, return self if it is not. elements, ok := v.AsSequence() @@ -60,7 +60,7 @@ func (e elementsByKey) Map(_ dyn.Path, v dyn.Value) (dyn.Value, error) { } func (e elementsByKey) MapWithOverride(p dyn.Path, v dyn.Value) (dyn.Value, error) { - return e.doMap(nil, v, func(a dyn.Value, b dyn.Value) (dyn.Value, error) { + return e.doMap(nil, v, func(a, b dyn.Value) (dyn.Value, error) { return Override(a, b, OverrideVisitor{ VisitInsert: func(_ dyn.Path, v dyn.Value) (dyn.Value, error) { return v, nil @@ -68,7 +68,7 @@ func (e elementsByKey) MapWithOverride(p dyn.Path, v dyn.Value) (dyn.Value, erro VisitDelete: func(valuePath dyn.Path, left dyn.Value) error { return nil }, - VisitUpdate: func(_ dyn.Path, a dyn.Value, b dyn.Value) (dyn.Value, error) { + VisitUpdate: func(_ dyn.Path, a, b dyn.Value) (dyn.Value, error) { return b, nil }, })