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

Review use of go-spew in production code #169

Closed
jholdstock opened this issue Mar 29, 2020 · 2 comments · Fixed by #172
Closed

Review use of go-spew in production code #169

jholdstock opened this issue Mar 29, 2020 · 2 comments · Fixed by #172

Comments

@jholdstock
Copy link
Member

davecgh/go-spew is used in production code:

log.Errorf("unexpected response message: %v", spew.Sdump(resp))

I believe we should be avoiding the use of go-spew in production code as it has a dependency on the unsafe package.

A comment from jrick on the topic: davecgh/go-spew#106

We also use it a few times in the CPU miner, but I guess this is acceptable as the CPU miner is only intended for testing.

fyi: @davecgh, @jrick

@dnldd
Copy link
Member

dnldd commented Mar 29, 2020

I'm opting to remove the use of spew entirely, relegating to using it only when debugging locally. I noticed most of the cases where spew was being used were related to debugging scenarios where more information was needed, this isn't needed in production code. In other cases spew was being used to output more information than necessary, particularly in tests.

@davecgh
Copy link
Member

davecgh commented Mar 29, 2020

This is fine for dcrpool, but I can say that spew will not be removed from use in dcrd because it is used for trace logging which is extremely useful when dealing with protocol level things.

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

Successfully merging a pull request may close this issue.

3 participants