Fixed golangci-lint
This commit is contained in:
parent
16f1168cdd
commit
785a3e936d
@ -33,9 +33,7 @@ func TestDeepCopy(t *testing.T) {
|
|||||||
}
|
}
|
||||||
dstStruct := supportedMockStruct{}
|
dstStruct := supportedMockStruct{}
|
||||||
|
|
||||||
err := deepCopy(srcStruct, &dstStruct)
|
if err := deepCopy(srcStruct, &dstStruct); err != nil {
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
t.Errorf("deepCopy returned an unexpected error %+v", err)
|
t.Errorf("deepCopy returned an unexpected error %+v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,9 +58,7 @@ func TestDeepCopy(t *testing.T) {
|
|||||||
}
|
}
|
||||||
dstStruct := unsupportedMockStruct{}
|
dstStruct := unsupportedMockStruct{}
|
||||||
|
|
||||||
err := deepCopy(srcStruct, &dstStruct)
|
if err := deepCopy(srcStruct, &dstStruct); err == nil {
|
||||||
|
|
||||||
if err == nil {
|
|
||||||
t.Error("deepCopy was expected to fail copying an structure with unexported fields")
|
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)
|
dstMap := make(map[string]string)
|
||||||
|
|
||||||
err := deepCopy(srcMap, &dstMap)
|
if err := deepCopy(srcMap, &dstMap); err != nil {
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
t.Errorf("deepCopy returned an unexpected error %+v", err)
|
t.Errorf("deepCopy returned an unexpected error %+v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,9 +102,7 @@ func TestDeepCopy(t *testing.T) {
|
|||||||
}
|
}
|
||||||
dstMap := make(map[string]supportedMockStruct)
|
dstMap := make(map[string]supportedMockStruct)
|
||||||
|
|
||||||
err := deepCopy(srcMap, &dstMap)
|
if err := deepCopy(srcMap, &dstMap); err != nil {
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
t.Errorf("deepCopy returned an unexpected error %+v", err)
|
t.Errorf("deepCopy returned an unexpected error %+v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,9 +117,7 @@ func TestDeepCopy(t *testing.T) {
|
|||||||
srcSlice := []string{"A", "B", "C"}
|
srcSlice := []string{"A", "B", "C"}
|
||||||
dstSlice := make([]string, len(srcSlice))
|
dstSlice := make([]string, len(srcSlice))
|
||||||
|
|
||||||
err := deepCopy(srcSlice, &dstSlice)
|
if err := deepCopy(srcSlice, &dstSlice); err != nil {
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
t.Errorf("deepCopy returned an unexpected error %+v", err)
|
t.Errorf("deepCopy returned an unexpected error %+v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,9 +152,7 @@ func TestDeepCopy(t *testing.T) {
|
|||||||
}
|
}
|
||||||
dstSlice := make([]supportedMockStruct, len(srcSlice))
|
dstSlice := make([]supportedMockStruct, len(srcSlice))
|
||||||
|
|
||||||
err := deepCopy(srcSlice, &dstSlice)
|
if err := deepCopy(srcSlice, &dstSlice); err != nil {
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
t.Errorf("deepCopy returned an unexpected error %+v", err)
|
t.Errorf("deepCopy returned an unexpected error %+v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,9 +173,7 @@ func TestDeepCopy(t *testing.T) {
|
|||||||
}
|
}
|
||||||
dstStruct := &supportedMockStruct{}
|
dstStruct := &supportedMockStruct{}
|
||||||
|
|
||||||
err := deepCopy(srcStruct, dstStruct)
|
if err := deepCopy(srcStruct, dstStruct); err != nil {
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
t.Errorf("deepCopy returned an unexpected error %+v", err)
|
t.Errorf("deepCopy returned an unexpected error %+v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,9 +186,7 @@ func TestDeepCopy(t *testing.T) {
|
|||||||
src := "a string"
|
src := "a string"
|
||||||
dst := 123
|
dst := 123
|
||||||
|
|
||||||
err := deepCopy(src, &dst)
|
if err := deepCopy(src, &dst); err == nil {
|
||||||
|
|
||||||
if err == nil {
|
|
||||||
t.Error("deepCopy did not return an error when provided mismatched types")
|
t.Error("deepCopy did not return an error when provided mismatched types")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -2,20 +2,21 @@ package callbacks
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"reflect"
|
||||||
|
"sort"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"gorm.io/gorm/clause"
|
"gorm.io/gorm/clause"
|
||||||
"gorm.io/gorm/schema"
|
"gorm.io/gorm/schema"
|
||||||
"gorm.io/gorm/utils"
|
"gorm.io/gorm/utils"
|
||||||
"reflect"
|
|
||||||
"sort"
|
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func Query(db *gorm.DB) {
|
func Query(db *gorm.DB) {
|
||||||
if db.Error == nil {
|
if db.Error == nil {
|
||||||
BuildQuerySQL(db)
|
BuildQuerySQL(db)
|
||||||
|
|
||||||
var _query = func(db *gorm.DB) {
|
_query := func(db *gorm.DB) {
|
||||||
if !db.DryRun && db.Error == nil {
|
if !db.DryRun && db.Error == nil {
|
||||||
rows, err := db.Statement.ConnPool.QueryContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...)
|
rows, err := db.Statement.ConnPool.QueryContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user