fixed lint

This commit is contained in:
Andrew Nester 2024-12-16 13:42:12 +01:00
parent 59c8254770
commit 438c19f2af
No known key found for this signature in database
GPG Key ID: 12BC628A44B7DA57
8 changed files with 8 additions and 18 deletions

View File

@ -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{

View File

@ -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

View File

@ -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()

View File

@ -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"])
}

View File

@ -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
}

View File

@ -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))
}

View File

@ -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())

View File

@ -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
},
})