Skip to content

Commit

Permalink
address review lint issues (#4354) (#4357)
Browse files Browse the repository at this point in the history
  • Loading branch information
6543 authored Nov 11, 2024
1 parent 2ec46c5 commit b68b038
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions pipeline/backend/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,10 @@ func (e *kube) WaitStep(ctx context.Context, step *types.Step, taskUUID string)

finished := make(chan bool)

podUpdated := func(_, new any) {
pod, ok := new.(*v1.Pod)
podUpdated := func(_, newPod any) {
pod, ok := newPod.(*v1.Pod)
if !ok {
log.Error().Msgf("could not parse pod: %v", new)
log.Error().Msgf("could not parse pod: %v", newPod)
return
}

Expand Down Expand Up @@ -322,10 +322,10 @@ func (e *kube) TailStep(ctx context.Context, step *types.Step, taskUUID string)

up := make(chan bool)

podUpdated := func(_, new any) {
pod, ok := new.(*v1.Pod)
podUpdated := func(_, newPod any) {
pod, ok := newPod.(*v1.Pod)
if !ok {
log.Error().Msgf("could not parse pod: %v", new)
log.Error().Msgf("could not parse pod: %v", newPod)
return
}

Expand Down
6 changes: 3 additions & 3 deletions server/store/datastore/migration/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ import (
"xorm.io/xorm/schemas"
)

func renameTable(sess *xorm.Session, old, new string) error {
func renameTable(sess *xorm.Session, oldTable, newTable string) error {
dialect := sess.Engine().Dialect().URI().DBType
switch dialect {
case schemas.MYSQL:
_, err := sess.Exec(fmt.Sprintf("RENAME TABLE `%s` TO `%s`;", old, new))
_, err := sess.Exec(fmt.Sprintf("RENAME TABLE `%s` TO `%s`;", oldTable, newTable))
return err
case schemas.POSTGRES, schemas.SQLITE:
_, err := sess.Exec(fmt.Sprintf("ALTER TABLE `%s` RENAME TO `%s`;", old, new))
_, err := sess.Exec(fmt.Sprintf("ALTER TABLE `%s` RENAME TO `%s`;", oldTable, newTable))
return err
default:
return fmt.Errorf("dialect '%s' not supported", dialect)
Expand Down
6 changes: 3 additions & 3 deletions server/store/datastore/migration/migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ func createSQLiteDB(t *testing.T) string {
return tmpF.Name()
}

func testDB(t *testing.T, new bool) (engine *xorm.Engine, closeDB func()) {
func testDB(t *testing.T, initNewDB bool) (engine *xorm.Engine, closeDB func()) {
driver := testDriver()
var err error
closeDB = func() {}
switch driver {
case "sqlite3":
config := ":memory:"
if !new {
if !initNewDB {
config = createSQLiteDB(t)
closeDB = func() {
_ = os.Remove(config)
Expand All @@ -77,7 +77,7 @@ func testDB(t *testing.T, new bool) (engine *xorm.Engine, closeDB func()) {
return
case "mysql", "postgres":
config := os.Getenv("WOODPECKER_DATABASE_DATASOURCE")
if !new {
if !initNewDB {
t.Logf("do not have dump to test against")
t.SkipNow()
}
Expand Down

0 comments on commit b68b038

Please sign in to comment.