Hacker News new | ask | show | jobs
by TheDong 2992 days ago
> Annotations are used at run-time via reflections

They're called tags, not annotations, per the spec (https://golang.org/ref/spec). I don't know what you're trying to say there, but it's using wrong terminology.

> well it won't blow up, it won't function as intended - much like a logical error

Aka "silently blow up", I could have used a better phrase, but I do indeed know what happens and that's what I meant.

> A linter, like the one that comes with VSCode will catch this error for you.

How is that possible? As you say on the next line, they don't need to conform to any format. How can my linter know that I don't have a package that parses "josn" tags, and that I typoed? Please link me to the lint rule if it exists.

> That's handy, but incompatible with Go 1

So? It is, but the point of the article is that go is badly designed; the fact that they can't change it makes that design all the worse since we must live with it.

Pointing out that go decided to freeze their language is totally irrelevant.

> Rust is more focused on power, while Go has more of a focus on simplicity.

Simplicity and power aren't always opposites, and apply to many different conflicting pieces of a language. This is a massive over-simplification.

Go optimized for simplicity of the language spec and simplicity of the compiler at the expense of the simplicity of writing correct code.

1 comments

> They're called tags, not annotations, per the spec (https://golang.org/ref/spec). I don't know what you're trying to say there, but it's using wrong terminology.

My mistake

> How is that possible? As you say on the next line, they don't need to conform to any format. How can my linter know that I don't have a package that parses "josn" tags, and that I typoed? Please link me to the lint rule if it exists.

https://golang.org/cmd/vet/#hdr-Struct_tags

The struct tags vet will not catch the typo I mentioned.

It would catch `json:"missing closing quote`; it would not catch the "josn" typo.