Merge pull request #183 from bruston/errorf

Use fmt.Errorf
This commit is contained in:
Jinzhu 2014-08-05 10:14:25 +08:00
commit 943a873051
1 changed files with 2 additions and 2 deletions

View File

@ -367,10 +367,10 @@ func (s *DB) Association(column string) *Association {
if f, ok := scopeType.FieldByName(SnakeToUpperCamel(column)); ok {
field = scope.fieldFromStruct(f)
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 {
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}