substrate
substrate copied to clipboard
SynchronousAdapter panic when using byte slice as message
The following line causes a panic if the underlying type of the substrate.Message
is a slice:
https://github.com/uw-labs/substrate/blob/master/sync_adapter_sink.go#L98-L100
panic: runtime error: comparing uncomparable type writer.message
goroutine 19 [running]:
github.com/uw-labs/substrate.(*synchronousMessageSinkAdapter).loop.func2(0x0, 0x0)
/home/johan/go/pkg/mod/github.com/uw-labs/[email protected]/sync_adapter_sink.go:98 +0x301
github.com/uw-labs/sync/rungroup.(*group).Go.func1(0xc00041c000, 0xc00041c060)
/home/johan/go/pkg/mod/github.com/uw-labs/[email protected]/rungroup/rungroup.go:55 +0x59
created by github.com/uw-labs/sync/rungroup.(*group).Go
/home/johan/go/pkg/mod/github.com/uw-labs/[email protected]/rungroup/rungroup.go:52 +0x66
exit status 2
For example, using a type like:
type message []byte
func (m message) Data() []byte {
return []byte(m)
}
Workaround is to use a pointer to the data.