Hacker News new | ask | show | jobs
by rank0 1591 days ago
I think Golang is awesome, but I have two major gripes that I hope can be fixed:

Dependency management:

Go mods is a dumpster fire. `go get` and `go install` is finicky and inconsistent across systems.

It's difficult to import local code as a dependency. Using mods with replace feels like a shitty hack, and requires me to maintain a public repo for something I may not want to be public. I end up using ANOTHER hack that replaces mod references to private repos and I have to mess with my git config to properly authenticate.

I've never used another language that made it so difficult to import local code. Rust's cargo is so much easier to use!

Sane dynamic json parsing:

Having to create a perfectly specified struct for every single json object I need to touch is terrible UX. Using `map[string]interface{}` is just gross.

Again, I think Go should copy the existing rust solution from serde. With serde, I define the struct I need, and when I parse an object, the extra fields just get thrown out.

If anyone thinks I'm misunderstanding something, please enlighten me. I hope reasonable solutions already exist and I just haven't found them yet.

2 comments

> It's difficult to import local code as a dependency. Using mods with replace feels like a shitty hack, and requires me to maintain a public repo for something I may not want to be public. I end up using ANOTHER hack that replaces mod references to private repos and I have to mess with my git config to properly authenticate.

With regards to this concern at least go 1.18 is adding workspaces, which should help (https://sebastian-holstein.de/post/2021-11-08-go-1.18-featur...).

What you describe for JSON is already the case in Go; the stdlib json parser does simply throw out any extra fields on deserialisation.
In fact it's difficult-to-impossible to get the opposite (only json.Decoder supports a strict mode, and as soon as one intermediate type implements UnmarshalJSON it stops getting propagated).