logoalt Hacker News

tptacekyesterday at 10:57 PM4 repliesview on HN

There's nothing unique to Go about this kind of tooling. It exists in C, Java, Rust, Typescript, and probably dozens of other settings as well. It's the standard way of implementing "after-market" opt-in directives.


Replies

dwatttttyesterday at 11:04 PM

Are we referring to 'go fix' as after market tooling?

It's certainly done in many places. JsDoc is the biggest example I can think of. But they're all walking the line of "this doesn't have an impact, except when it does".

It being done by the language owners just makes them the ones walking the line.

show 1 reply
omoikaneyesterday at 11:18 PM

In the listed examples, the compiler will emit a diagnostic upon encountering those comments:

https://go.dev/blog/inliner#example-fixing-api-design-flaws

So these comments carry more weight than how those comment annotations might be consumed by optional tools for other languages.

For most of the listed examples, I think the corresponding C annotation would have been "[[deprecated]]", which has been added to the syntax as of C23.

ternaryoperatoryesterday at 11:35 PM

It does not exist in Java. Comments in Java do not change code.

show 1 reply
Patryk27yesterday at 11:17 PM

There are no comment-based directives in Rust, are there?

show 2 replies