mirror of https://github.com/go-gorm/gorm.git
Only get address from non pointer when call method, fix #912
This commit is contained in:
parent
9fd05d1bad
commit
5174cc5c24
3
scope.go
3
scope.go
|
@ -413,7 +413,8 @@ func (scope *Scope) CommitOrRollback() *Scope {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
func (scope *Scope) callMethod(methodName string, reflectValue reflect.Value) {
|
func (scope *Scope) callMethod(methodName string, reflectValue reflect.Value) {
|
||||||
if reflectValue.CanAddr() {
|
// Only get address from non-pointer
|
||||||
|
if reflectValue.CanAddr() && reflectValue.Kind() != reflect.Ptr {
|
||||||
reflectValue = reflectValue.Addr()
|
reflectValue = reflectValue.Addr()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue