logoalt Hacker News

thayne • yesterday at 7:14 PM • 1 reply • view on HN

It could be if go had a more powerful type system.


Replies

hnlmorg • yesterday at 7:19 PM

This isn’t a type system problem. It’s a data origin problem. Ie it could be any random JSON blob a user entered. The compiler doesn’t know this ahead of time.

If you wanted type safety with JSON in Go then don’t use the marshal interface. Period.

➕ show 1 reply