From 067d0d2bf2ba61bd6afe028b2ee8f3c12d523826 Mon Sep 17 00:00:00 2001 From: Eduardo Apolinario Date: Mon, 16 Oct 2023 16:35:03 -0700 Subject: [PATCH] More linting Signed-off-by: Eduardo Apolinario --- flytestdlib/database/db.go | 9 +++++---- flytestdlib/database/postgres_test.go | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/flytestdlib/database/db.go b/flytestdlib/database/db.go index 8d8deec75a..6e9c065ec9 100644 --- a/flytestdlib/database/db.go +++ b/flytestdlib/database/db.go @@ -3,6 +3,7 @@ package database import ( "context" "fmt" + "github.com/flyteorg/flyte/flytestdlib/logger" "github.com/go-gormigrate/gormigrate/v2" "gorm.io/driver/sqlite" @@ -103,13 +104,13 @@ func withDB(ctx context.Context, do func(db *gorm.DB) error) error { } // Migrate runs all configured migrations -func Migrate(ctx context.Context, migrations []*gormigrate.Migration, initializationSql string) error { - if migrations == nil || len(migrations) == 0 { +func Migrate(ctx context.Context, migrations []*gormigrate.Migration, initializationSQL string) error { + if len(migrations) == 0 { logger.Infof(ctx, "No migrations to run") return nil } return withDB(ctx, func(db *gorm.DB) error { - tx := db.Exec(initializationSql) + tx := db.Exec(initializationSQL) if tx.Error != nil { return tx.Error } @@ -125,7 +126,7 @@ func Migrate(ctx context.Context, migrations []*gormigrate.Migration, initializa // Rollback rolls back the last migration func Rollback(ctx context.Context, migrations []*gormigrate.Migration) error { - if migrations == nil || len(migrations) == 0 { + if len(migrations) == 0 { logger.Infof(ctx, "No migrations to rollback") return nil } diff --git a/flytestdlib/database/postgres_test.go b/flytestdlib/database/postgres_test.go index 088ce8c1d2..fab6822726 100644 --- a/flytestdlib/database/postgres_test.go +++ b/flytestdlib/database/postgres_test.go @@ -3,12 +3,13 @@ package database import ( "context" "errors" - "github.com/jackc/pgconn" - "github.com/stretchr/testify/assert" "io/ioutil" "net" "os" "testing" + + "github.com/jackc/pgconn" + "github.com/stretchr/testify/assert" ) func TestResolvePassword(t *testing.T) {