go-json-experiment / json

Experimental implementation of a proposed v2 encoding/json package
BSD 3-Clause "New" or "Revised" License
341 stars 11 forks source link

minor code tyding up and using new APIs #25

Closed mvdan closed 2 months ago

mvdan commented 3 months ago

(see commit messages - please do not squash)

Note that the last commit, using OnceFunc, is up for debate - it simplifies the code a bit and gives us perhaps better panic semantics, but it is slightly slower too, although not always for some reason.

dsnet commented 2 months ago

The performance hit of sync.OnceFunc is unfortunate. Given that it doesn't cleanup the code much, I'm inclined to keep the older code.

All other changes LGTM.

Before submitting, try keeping the commit titles consistent with historical titles (i.e., we don't prefix with the component name). It's unfortunate that I didn't start this project off with the typical Go project convention, but that ship sailed and consistency is nice.

mvdan commented 2 months ago

Thanks, done.