Use fmt.Errorf
This commit is contained in:
parent
8308491d9a
commit
d699c85486
4
main.go
4
main.go
@ -367,10 +367,10 @@ func (s *DB) Association(column string) *Association {
|
|||||||
if f, ok := scopeType.FieldByName(SnakeToUpperCamel(column)); ok {
|
if f, ok := scopeType.FieldByName(SnakeToUpperCamel(column)); ok {
|
||||||
field = scope.fieldFromStruct(f)
|
field = scope.fieldFromStruct(f)
|
||||||
if field.Relationship == nil || field.Relationship.ForeignKey == "" {
|
if field.Relationship == nil || field.Relationship.ForeignKey == "" {
|
||||||
scope.Err(errors.New(fmt.Sprintf("invalid association %v for %v", column, scopeType)))
|
scope.Err(fmt.Errorf("invalid association %v for %v", column, scopeType))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
scope.Err(errors.New(fmt.Sprintf("%v doesn't have column %v", scopeType, column)))
|
scope.Err(fmt.Errorf("%v doesn't have column %v", scopeType, column))
|
||||||
}
|
}
|
||||||
|
|
||||||
return &Association{Scope: scope, Column: column, Error: s.Error, PrimaryKey: primaryKey, Field: field}
|
return &Association{Scope: scope, Column: column, Error: s.Error, PrimaryKey: primaryKey, Field: field}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user