Live data from Hacker News

Go 1.14 release notes

tip.golang.org

41–42 of 42 posts

Re: Go 1.14 release notes

#41
post #18

Buried in the notes is a small, but useful addition to the testing package that allows your test helpers to register their own cleanup functions (testing.(*T).Cleanup). I wrote a blog post discussing it in depth here: https://www.gopherguides.com/articles/test-cleanup-in-go-1-1...

Hey. Interesting blog post! Quick bit of feedback for you... I find the code snippets quite hard to read on mobile as the lines wrap. Could you enable horizontal overflow scrolling do you think? overflow-x:scroll

Re: Go 1.14 release notes

#42
post #40
post #35

Wish the json.Register funcion had been in 1.14. Desperately need it for a project I'm working on. If anyone has any ideas for overriding structs in a pkg I'd love to hear them!

For others following along - this is https://github.com/golang/go/issues/5901 to register custom marshallers on an existing `json.Encoder` instance. I feel like it's generally possible to work around this by creating a wrapper struct with an overridden MarshalJSON method? But maybe that's infeasible for deeply nested structs.

> But maybe that's infeasible for deeply nested structs.

That's the crux of my issue. If it was only for a single, un-nested field then it would be trivial.

I am currently solving it by walking through the whole struct, but that is not-ideal.

Post reply on HN