←back to thread

316 points thunderbong | 3 comments | | HN request time: 0.435s | source
Show context
fullstackchris ◴[] No.42202291[source]
Sure... but this is why we have sem versioning and release notes. It's always nice to try and support all users but sometimes you just need to ship breaking changes...
replies(2): >>42202386 #>>42205535 #
1. Cthulhu_ ◴[] No.42202386[source]
While in principle you're correct, Go the language is very dedicated to backwards and forwards compatibility; while there's been talk of a Go 2 for a long time now, they're not eager to go there and if they do, they intend to make the transition low impact.

That said, I'd say this is an excellent candidate to deprecate or warn about now, and to make impossible in a version 2. Then again, how would you even stop this? A string representation of an error is common in any language, you need it to log things.

I think at best there will be a static analysis rule (in e.g. go vet) that tries to figure out if any matching is done on the string representation of an error.

replies(2): >>42202406 #>>42202755 #
2. TheDong ◴[] No.42202406[source]
> I think at best there will be a static analysis rule (in e.g. go vet) that tries to figure out if any matching is done on the string representation of an error.

First they'd need to export the errors the stdlib returns https://news.ycombinator.com/item?id=41507714

I wouldn't hold my breath on that one.

3. fullstackchris ◴[] No.42202755[source]
I'm not talking about Go itself, I'm talking about building an API. All this talk of "string vs type" is not the solution to the root problem - sure, types can be better to return but what if the type changes? You still have breaking changes.