easyjson generated marshalling methods use value receiver on type containing mutex
rwelin opened this issue · comments
Robert Welin commented
Hi! This might ultimately be an easyjson bug, but running go vet on the generated cdproto package showed issues of mutex copies in the cdp sub-package.
Seen on latest master bfeac1f
$ go vet ./...
# github.com/chromedp/cdproto/cdp
cdp/easyjson.go:353:81: easyjsonC5a4559bEncodeGithubComChromedpCdprotoCdp1 passes lock by value: github.com/chromedp/cdproto/cdp.Node
cdp/easyjson.go:562:9: MarshalJSON passes lock by value: github.com/chromedp/cdproto/cdp.Node
cdp/easyjson.go:564:57: call of easyjsonC5a4559bEncodeGithubComChromedpCdprotoCdp1 copies lock value: github.com/chromedp/cdproto/cdp.Node
cdp/easyjson.go:569:9: MarshalEasyJSON passes lock by value: github.com/chromedp/cdproto/cdp.Node
cdp/easyjson.go:570:56: call of easyjsonC5a4559bEncodeGithubComChromedpCdprotoCdp1 copies lock value: github.com/chromedp/cdproto/cdp.Node
cdp/easyjson.go:631:81: easyjsonC5a4559bEncodeGithubComChromedpCdprotoCdp2 passes lock by value: github.com/chromedp/cdproto/cdp.Frame
cdp/easyjson.go:684:9: MarshalJSON passes lock by value: github.com/chromedp/cdproto/cdp.Frame
cdp/easyjson.go:686:57: call of easyjsonC5a4559bEncodeGithubComChromedpCdprotoCdp2 copies lock value: github.com/chromedp/cdproto/cdp.Frame
cdp/easyjson.go:691:9: MarshalEasyJSON passes lock by value: github.com/chromedp/cdproto/cdp.Frame
cdp/easyjson.go:692:56: call of easyjsonC5a4559bEncodeGithubComChromedpCdprotoCdp2 copies lock value: github.com/chromedp/cdproto/cdp.Frame
I'm new to this project and don't quite understand how all the code is generated, but I'm happy keep digging if it's not a straight forward fix.
Daniel Martí commented
Have you tried contacting the easyjson project about this? I imagine this would be something to fix on their end.