Fixed golangci-lint

This commit is contained in:
ktsivkov 2023-03-20 17:53:20 +01:00
parent 16f1168cdd
commit 785a3e936d
3 changed files with 14 additions and 29 deletions

View File

@ -33,9 +33,7 @@ func TestDeepCopy(t *testing.T) {
}
dstStruct := supportedMockStruct{}
err := deepCopy(srcStruct, &dstStruct)
if err != nil {
if err := deepCopy(srcStruct, &dstStruct); err != nil {
t.Errorf("deepCopy returned an unexpected error %+v", err)
}
@ -60,9 +58,7 @@ func TestDeepCopy(t *testing.T) {
}
dstStruct := unsupportedMockStruct{}
err := deepCopy(srcStruct, &dstStruct)
if err == nil {
if err := deepCopy(srcStruct, &dstStruct); err == nil {
t.Error("deepCopy was expected to fail copying an structure with unexported fields")
}
})
@ -76,9 +72,7 @@ func TestDeepCopy(t *testing.T) {
}
dstMap := make(map[string]string)
err := deepCopy(srcMap, &dstMap)
if err != nil {
if err := deepCopy(srcMap, &dstMap); err != nil {
t.Errorf("deepCopy returned an unexpected error %+v", err)
}
@ -108,9 +102,7 @@ func TestDeepCopy(t *testing.T) {
}
dstMap := make(map[string]supportedMockStruct)
err := deepCopy(srcMap, &dstMap)
if err != nil {
if err := deepCopy(srcMap, &dstMap); err != nil {
t.Errorf("deepCopy returned an unexpected error %+v", err)
}
@ -125,9 +117,7 @@ func TestDeepCopy(t *testing.T) {
srcSlice := []string{"A", "B", "C"}
dstSlice := make([]string, len(srcSlice))
err := deepCopy(srcSlice, &dstSlice)
if err != nil {
if err := deepCopy(srcSlice, &dstSlice); err != nil {
t.Errorf("deepCopy returned an unexpected error %+v", err)
}
@ -162,9 +152,7 @@ func TestDeepCopy(t *testing.T) {
}
dstSlice := make([]supportedMockStruct, len(srcSlice))
err := deepCopy(srcSlice, &dstSlice)
if err != nil {
if err := deepCopy(srcSlice, &dstSlice); err != nil {
t.Errorf("deepCopy returned an unexpected error %+v", err)
}
@ -185,9 +173,7 @@ func TestDeepCopy(t *testing.T) {
}
dstStruct := &supportedMockStruct{}
err := deepCopy(srcStruct, dstStruct)
if err != nil {
if err := deepCopy(srcStruct, dstStruct); err != nil {
t.Errorf("deepCopy returned an unexpected error %+v", err)
}
@ -200,9 +186,7 @@ func TestDeepCopy(t *testing.T) {
src := "a string"
dst := 123
err := deepCopy(src, &dst)
if err == nil {
if err := deepCopy(src, &dst); err == nil {
t.Error("deepCopy did not return an error when provided mismatched types")
}
})

View File

@ -2,20 +2,21 @@ package callbacks
import (
"fmt"
"reflect"
"sort"
"strings"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"
"gorm.io/gorm/utils"
"reflect"
"sort"
"strings"
)
func Query(db *gorm.DB) {
if db.Error == nil {
BuildQuerySQL(db)
var _query = func(db *gorm.DB) {
_query := func(db *gorm.DB) {
if !db.DryRun && db.Error == nil {
rows, err := db.Statement.ConnPool.QueryContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...)
if err != nil {

View File

@ -501,7 +501,7 @@ func (db *DB) Ease(cb func(*DB)) *DB {
}
eq.wg.Add(1)
var runner, ok = db.easeQueue.LoadOrStore(hash, eq)
runner, ok := db.easeQueue.LoadOrStore(hash, eq)
et := runner.(*easedTask)
if !ok {