Skip to content

Commit

Permalink
More linting
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo Apolinario <[email protected]>
  • Loading branch information
eapolinario committed Oct 16, 2023
1 parent 128495e commit 067d0d2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions flytestdlib/database/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
5 changes: 3 additions & 2 deletions flytestdlib/database/postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 067d0d2

Please sign in to comment.