Closed douyw closed 2 years ago
I fixed the issue https://github.com/vardius/go-api-boilerplate/commit/1dca296ffc7d92f891b4dc4b7734ebfd37770453
but it would be good as well to update interface casting as well
- e := event.Payload.(*user.WasRegisteredWithEmail)
+ e, ok := event.Payload.(*user.WasRegisteredWithEmail) // handle !ok
Thanks. I cloned the revised version. But sill no luck -- just the same error. I'm a golang newbie, but I guess the marshalling/unmarshalling does not work as expected, althougth the object factory part had changed.
This https://github.com/vardius/go-api-boilerplate/commit/1b87ca51e43c982963db378a4cc01582e314c16f should help, I missed it earlier
Up and running. Thank you very much.
panic: interface conversion: interface {} is user.WasRegisteredWithEmail, not *user.WasRegisteredWithEmail
goroutine 65 [running]: github.com/vardius/go-api-boilerplate/cmd/user/internal/application/eventhandler.WhenUserWasRegisteredWithEmail.func1({0xada780, 0x4000283470}, 0x4000200880) /app/cmd/user/internal/application/eventhandler/when_user_was_registered_with_email.go:22 +0x374 github.com/vardius/go-api-boilerplate/pkg/eventbus/memory.(eventBus).Subscribe.func1({0xada780, 0x4000283470}, 0x4000200880, 0x40002d6840) /app/pkg/eventbus/memory/event_bus.go:107 +0xe4 reflect.Value.call({0x7a6480, 0x400045d200, 0x13}, {0x8836e1, 0x4}, {0x400011f3e0, 0x3, 0x4}) /usr/local/go/src/reflect/value.go:543 +0x590 reflect.Value.Call({0x7a6480, 0x400045d200, 0x13}, {0x400011f3e0, 0x3, 0x4}) /usr/local/go/src/reflect/value.go:339 +0x8c github.com/vardius/message-bus.(messageBus).Subscribe.func1(0x400045d220) /go/pkg/mod/github.com/vardius/message-bus@v1.1.4/bus.go:60 +0x74 created by github.com/vardius/message-bus.(*messageBus).Subscribe /go/pkg/mod/github.com/vardius/message-bus@v1.1.4/bus.go:58 +0x278