类似的错误很容易发生,能看出来是什么原因吗:
panic: reflect: call of reflect.Value.FieldByName on ptr Value
goroutine 67 [running]:
github.com/jinzhu/gorm.(*Scope).callCallbacks.func1(0xc000113d80)
/root/go/pkg/mod/github.com/jinzhu/[email protected]/scope.go:865 +0xb0
panic(0x13b4ea0, 0xc00063cbc0)
/home/jenkins/tools/org.jenkinsci.plugins.golang.GolangInstallation/go-lang-1.13/src/runtime/panic.go:679 +0x1b2
reflect.flag.mustBe(...)
/home/jenkins/tools/org.jenkinsci.plugins.golang.GolangInstallation/go-lang-1.13/src/reflect/value.go:208
reflect.Value.FieldByName(0x13aad00, 0xc00063cba0, 0x196, 0x121f13c, 0x2, 0xc00063cba0, 0x196, 0xc00060d640)
/home/jenkins/tools/org.jenkinsci.plugins.golang.GolangInstallation/go-lang-1.13/src/reflect/value.go:890 +0x1ed
github.com/8treenet/gcache/internal.(*easyScope).EasyPrimarys(0xc0004ccb00, 0x1616ed8, 0x8, 0xc0000486c0, 0x3c, 0xc00060d630)
/root/go/pkg/mod/github.com/8treenet/[email protected]/internal/easy_scope.go:497 +0xbcf
github.com/8treenet/gcache/internal.(*queryHandle).BySearch(0xc0000196f8, 0xc0004ccb00, 0xc00063c080, 0x197, 0x203000, 0x203000, 0x203000)
/root/go/pkg/mod/github.com/8treenet/[email protected]/internal/handle_query.go:109 +0xf7
github.com/8treenet/gcache/internal.(*callQuery).bySearch(0xc0003cc340, 0xc0004ccb00, 0x0, 0x0, 0x0, 0x0)
/root/go/pkg/mod/github.com/8treenet/[email protected]/internal/call_query.go:118 +0xd6
github.com/8treenet/gcache/internal.(*callQuery).invoke.func1(0x413031, 0xd0, 0x14a1860, 0xfba41cc9035f6801)
/root/go/pkg/mod/github.com/8treenet/[email protected]/internal/call_query.go:53 +0x75
github.com/8treenet/gcache/internal.(*Group).doCall(0xc0003cc348, 0xc000491f20, 0xc000040690, 0x4c, 0xc0000198a0)
/root/go/pkg/mod/github.com/8treenet/[email protected]/internal/singleflight.go:91 +0x2e
github.com/8treenet/gcache/internal.(*Group).Do(0xc0003cc348, 0xc000040690, 0x4c, 0xc0000198a0, 0xe, 0xc00060d5c8, 0x2, 0xc000040690, 0x4c)
/root/go/pkg/mod/github.com/8treenet/[email protected]/internal/singleflight.go:61 +0x1ba
github.com/8treenet/gcache/internal.(*callQuery).invoke(0xc0003cc340, 0xc000113d80)
/root/go/pkg/mod/github.com/8treenet/[email protected]/internal/call_query.go:46 +0x1a8
github.com/jinzhu/gorm.(*Scope).callCallbacks(0xc000113d80, 0xc0003cce20, 0x4, 0x4, 0x0)
/root/go/pkg/mod/github.com/jinzhu/[email protected]/scope.go:869 +0x92
github.com/jinzhu/gorm.(*DB).Find(0xc0003e8270, 0x12caea0, 0xc00063c080, 0xc000633950, 0x3, 0x3, 0xc000633950)
/root/go/pkg/mod/github.com/jinzhu/[email protected]/main.go:354 +0x98
gitlab.com/example/dal/reader.(*Reader).GetProducts(0xc00048f580, 0xc000633950, 0x3, 0x3, 0xc00063c060, 0x2, 0x2, 0x2, 0xc0004d4240)
/home/jenkins/workspace/example/dal/reader/product.go:19 +0xb4
gitlab.com/sensestar/example/payment/controllers.(*PaymentController).GetProducts(0x27c54b0, 0x19ed8e0, 0xc0005006c0, 0xc0004d4240, 0x27c54b0, 0xc0005006c0, 0xc000027b58)
/home/jenkins/workspace/example/payment/controllers/payment.go:72 +0x4ee
gitlab.com/sensestar/example/payment._PaymentService_GetProducts_Handler(0x15ede00, 0x27c54b0, 0x19ed8e0, 0xc0005006c0, 0xc000490f60, 0x0, 0x19ed8e0, 0xc0005006c0, 0xc0004deb10, 0x10)
/home/jenkins/workspace/example/payment/payment.pb.go:5483 +0x217
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000210d00, 0x1a04620, 0xc0000ebe00, 0xc0004cc300, 0xc000089800, 0x2788aa0, 0x0, 0x0, 0x0)
/root/go/pkg/mod/google.golang.org/[email protected]/server.go:1082 +0x4fd
google.golang.org/grpc.(*Server).handleStream(0xc000210d00, 0x1a04620, 0xc0000ebe00, 0xc0004cc300, 0x0)
/root/go/pkg/mod/google.golang.org/[email protected]/server.go:1405 +0xd27
google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc0004de9b0, 0xc000210d00, 0x1a04620, 0xc0000ebe00, 0xc0004cc300)
/root/go/pkg/mod/google.golang.org/[email protected]/server.go:746 +0xbb
created by google.golang.org/grpc.(*Server).serveStreams.func1
/root/go/pkg/mod/google.golang.org/[email protected]/server.go:744 +0xa1