Data racing
canhlinh opened this issue · 3 comments
When i run go test -v -race
with socket
package I got a lot of data race error messages
Could you please fix this issue ?
Hi @canhlinh, thanks for the report,
This is a known issue but since it's come up for you I'll take another look. The issue comes from mocking the socket to test the channels the API returns. It probably makes sense to separate that out but I'm not sure what the best approach is. I'm open to any ideas.
@mkenney Never mind. I've not much time but I can help you fix this bug on the socket
package only.
I think this tiny standalone lib might give you some ideas about how to design the WebSocket protocol without racing problem: https://github.com/go-rod/rod/tree/master/lib/cdp
Since it's standalone, you can directly use it in your lib.
Also, I think the lib that uses it is worth to check: https://github.com/go-rod/rod