News for hackers. Stuff that matters.
Re:The ups and downs of porting 50k lines of C++ to Go (2015) by stock_toaster on Thursday March 14, 2019 @03:10AM (#19387080)
Go is not especially friendly when dealing with lots of similar, but different, json though. Lots of boilerplate and overhead (more code) there.
Re:The ups and downs of porting 50k lines of C++ to Go (2015) by jerf on Thursday March 14, 2019 @09:50AM (#19389174)
A lot of that isn't so much "Go" as "statically typed language".

I say this not to defend Go, but to encourage anyone creating a JSON-based API to at least test with a statically-typed language. It's too easy in a dynamically-typed language to create a field that is either a number or a list of numbers, but you just boned all the static languages in the process. Unless you know you're only talking internally, and you're never going to change to a static language of any kind, JSON APIs should generally be written in a subset of JSON that is static-friendly.

It's not that crazy of a requirement anyhow; it's not really a great plan in dynamic languages either because it complexifies the code there, too, just not as much. It's a bit of discipline, yeah, but it's good for you even in a purely-dynamic environment.

Re:The ups and downs of porting 50k lines of C++ to Go (2015) by stock_toaster on Saturday March 16, 2019 @02:11AM (#19406582)
Do note that Go also heavily uses reflection (from what I recall) for parsing json, so it can be a bit slower than one would expect.
Re:The ups and downs of porting 50k lines of C++ to Go (2015) by ilovecaching on Thursday March 14, 2019 @03:16AM (#19387108)
In some ways Go is a litmus test. Do you have a simple, consistent schema? Are you trying to overload the types of fields and making parsing more difficult? I have run into this problem myself, but I realized that Go was pushing me to simplify and make things uniform which actually made my life way easier in the long run.
Re:The ups and downs of porting 50k lines of C++ to Go (2015) by jcelerier on Thursday March 14, 2019 @07:26AM (#19388233)
nice, I'm just going to send mails to the various creators of the JSONs I consume to ask them to change their protocols because it's not simple enough and solve world hunger while I'm at it
Re:The ups and downs of porting 50k lines of C++ to Go (2015) by stock_toaster on Thursday March 14, 2019 @04:26AM (#19387377)
Most of my struggles here have been when consuming /existing/ json blobs, specified elsewhere: 3rd parties, other internal services, "versioned" json blobs, and the big one... consuming json structured logging.

So I think we could both be right.