diff --git a/client/orm/orm.go b/client/orm/orm.go index a87e23ad..d6ae0c80 100644 --- a/client/orm/orm.go +++ b/client/orm/orm.go @@ -318,7 +318,7 @@ func (o *ormBase) LoadRelated(md interface{}, name string, args ...utils.KV) (in return o.LoadRelatedWithCtx(context.Background(), md, name, args...) } -func (o *ormBase) LoadRelatedWithCtx(ctx context.Context, md interface{}, name string, args ...utils.KV) (int64, error) { +func (o *ormBase) LoadRelatedWithCtx(_ context.Context, md interface{}, name string, args ...utils.KV) (int64, error) { _, fi, ind, qs := o.queryRelated(md, name) var relDepth int @@ -488,7 +488,7 @@ func (o *ormBase) Raw(query string, args ...interface{}) RawSeter { return o.RawWithCtx(context.Background(), query, args...) } -func (o *ormBase) RawWithCtx(ctx context.Context, query string, args ...interface{}) RawSeter { +func (o *ormBase) RawWithCtx(_ context.Context, query string, args ...interface{}) RawSeter { return newRawSet(o, query, args) } diff --git a/client/orm/orm_test.go b/client/orm/orm_test.go index 81fbf2b5..764e5b6d 100644 --- a/client/orm/orm_test.go +++ b/client/orm/orm_test.go @@ -144,7 +144,7 @@ func getCaller(skip int) string { } func formatLines(s string) string { - return strings.Replace(s, "\t", " ", -1) + return strings.ReplaceAll(s, "\t", " ") } // Deprecated: Using stretchr/testify/assert @@ -1725,7 +1725,7 @@ func TestQueryM2M(t *testing.T) { throwFailNow(t, AssertIs(num, 1)) } -func TestQueryRelate(t *testing.T) { +func TestQueryRelate(_ *testing.T) { // post := &Post{Id: 2} // qs := dORM.QueryRelate(post, "Tags") @@ -2075,9 +2075,7 @@ func TestRawPrepare(t *testing.T) { err error pre RawPreparer ) - switch { - case IsMysql || IsSqlite: - + if IsMysql || IsSqlite { pre, err = dORM.Raw("INSERT INTO tag (name) VALUES (?)").Prepare() assert.Nil(t, err) if pre != nil { @@ -2112,9 +2110,7 @@ func TestRawPrepare(t *testing.T) { assert.Nil(t, err) assert.Equal(t, num, int64(3)) } - - case IsPostgres: - + } else if IsPostgres { pre, err = dORM.Raw(`INSERT INTO "tag" ("name") VALUES (?) RETURNING "id"`).Prepare() assert.Nil(t, err) if pre != nil { @@ -2244,8 +2240,7 @@ func TestTransaction(t *testing.T) { throwFail(t, err) throwFail(t, AssertIs(num, 1)) - switch { - case IsMysql || IsSqlite: + if IsMysql || IsSqlite { res, err := to.Raw("INSERT INTO tag (name) VALUES (?)", names[2]).Exec() throwFail(t, err) if err == nil {