Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SynchronousAdapter panic when using byte slice as message #103

Open
johanbrandhorst opened this issue Mar 26, 2020 · 1 comment
Open

SynchronousAdapter panic when using byte slice as message #103

johanbrandhorst opened this issue Mar 26, 2020 · 1 comment

Comments

@johanbrandhorst
Copy link
Contributor

johanbrandhorst commented Mar 26, 2020

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)
}
@johanbrandhorst
Copy link
Contributor Author

Workaround is to use a pointer to the data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant