From 03e2400494cb61df3ee9ede8ab3efd6d45e828e3 Mon Sep 17 00:00:00 2001 From: Artur Sawicki Date: Wed, 4 Dec 2024 18:56:47 +0100 Subject: [PATCH] Run make pre-push --- pkg/resources/procedure.go | 6 +++--- pkg/sdk/functions_gen_test.go | 1 - pkg/sdk/procedures_gen_test.go | 1 - pkg/sdk/sql_builder.go | 2 +- pkg/sdk/sql_builder_test.go | 1 - 5 files changed, 4 insertions(+), 7 deletions(-) diff --git a/pkg/resources/procedure.go b/pkg/resources/procedure.go index c1e7a95a5b..f7577833f9 100644 --- a/pkg/resources/procedure.go +++ b/pkg/resources/procedure.go @@ -261,7 +261,7 @@ func createJavaProcedure(ctx context.Context, d *schema.ResourceData, meta inter } procedureDefinition := d.Get("statement").(string) runtimeVersion := d.Get("runtime_version").(string) - var packages []sdk.ProcedurePackageRequest + packages := make([]sdk.ProcedurePackageRequest, 0) for _, item := range d.Get("packages").([]interface{}) { packages = append(packages, *sdk.NewProcedurePackageRequest(item.(string))) } @@ -373,7 +373,7 @@ func createScalaProcedure(ctx context.Context, d *schema.ResourceData, meta inte } procedureDefinition := d.Get("statement").(string) runtimeVersion := d.Get("runtime_version").(string) - var packages []sdk.ProcedurePackageRequest + packages := make([]sdk.ProcedurePackageRequest, 0) for _, item := range d.Get("packages").([]interface{}) { packages = append(packages, *sdk.NewProcedurePackageRequest(item.(string))) } @@ -484,7 +484,7 @@ func createPythonProcedure(ctx context.Context, d *schema.ResourceData, meta int } procedureDefinition := d.Get("statement").(string) runtimeVersion := d.Get("runtime_version").(string) - var packages []sdk.ProcedurePackageRequest + packages := make([]sdk.ProcedurePackageRequest, 0) for _, item := range d.Get("packages").([]interface{}) { packages = append(packages, *sdk.NewProcedurePackageRequest(item.(string))) } diff --git a/pkg/sdk/functions_gen_test.go b/pkg/sdk/functions_gen_test.go index 5ad79d64cb..fe9f855040 100644 --- a/pkg/sdk/functions_gen_test.go +++ b/pkg/sdk/functions_gen_test.go @@ -273,7 +273,6 @@ func TestFunctions_CreateForJavascript(t *testing.T) { opts.FunctionDefinition = "return 1;" assertOptsValidAndSQLEquals(t, opts, `CREATE OR REPLACE TEMPORARY SECURE FUNCTION %s (d FLOAT DEFAULT 1.0) COPY GRANTS RETURNS FLOAT NOT NULL LANGUAGE JAVASCRIPT CALLED ON NULL INPUT IMMUTABLE COMMENT = 'comment' AS 'return 1;'`, id.FullyQualifiedName()) }) - } func TestFunctions_CreateForPython(t *testing.T) { diff --git a/pkg/sdk/procedures_gen_test.go b/pkg/sdk/procedures_gen_test.go index 026bf329a6..2c2a9d8ec4 100644 --- a/pkg/sdk/procedures_gen_test.go +++ b/pkg/sdk/procedures_gen_test.go @@ -255,7 +255,6 @@ func TestProcedures_CreateForJavaScript(t *testing.T) { opts.ProcedureDefinition = "return 1;" assertOptsValidAndSQLEquals(t, opts, `CREATE OR REPLACE SECURE PROCEDURE %s (d FLOAT DEFAULT 1.0) COPY GRANTS RETURNS FLOAT NOT NULL LANGUAGE JAVASCRIPT STRICT COMMENT = 'test comment' EXECUTE AS CALLER AS 'return 1;'`, id.FullyQualifiedName()) }) - } func TestProcedures_CreateForPython(t *testing.T) { diff --git a/pkg/sdk/sql_builder.go b/pkg/sdk/sql_builder.go index b6d9f7469b..ba50ac65f6 100644 --- a/pkg/sdk/sql_builder.go +++ b/pkg/sdk/sql_builder.go @@ -644,7 +644,7 @@ func (v sqlParameterClause) String() string { if v.value == nil { return s } - var value = v.value + value := v.value if dataType, ok := value.(datatypes.DataType); ok { // We check like this and not by `dataType == nil` because for e.g. `var *datatypes.ArrayDataType` return false in a normal nil check if reflect.ValueOf(dataType).IsZero() { diff --git a/pkg/sdk/sql_builder_test.go b/pkg/sdk/sql_builder_test.go index df38f0a69a..48289cdad1 100644 --- a/pkg/sdk/sql_builder_test.go +++ b/pkg/sdk/sql_builder_test.go @@ -476,7 +476,6 @@ func TestBuilder_sql(t *testing.T) { } func TestBuilder_DataType(t *testing.T) { - type dataTypeTestHelper struct { DataType datatypes.DataType `ddl:"parameter,no_quotes,no_equals"` }