4 ms·
I don't really agree. I don't see any substantial difference between //go: and #go: except that programs using the # syntax would not build on older versions o
by nulltype 11y ago
I don't really agree. I don't see any substantial difference between //go: and #go: except that programs using the # syntax would not build on older versions of go. I haven't really run across any issues with the current syntax. What kind of issues are you having?
- masklinn 11y agoThe difference is that an innocuous comment can (and inevitably will, especially since Go apparently does not actually care about comments, only that a line starts with //go:[0]) match the directive syntax at some point and then it's a right pain in the ass to debug, if that doesn't break anything. [0] https://news.ycombinator.com/item?id=9523187 https://news.ycombinator.com/item?id=9523187
- nulltype 11y agoI think they should fix that bug where it's not actually looking at the comments. However, with the exception of that bug, I don't think I have ever made a comment that started with "//go:" and was not a directive. It seems kind of hard to make one of those by accident.
- threeseed 11y agoDoesn't Go complain about unused imports ? So what if you have a bit of code that you are half way through and you want to comment it out as well as the imports. I've done this countless times over the years.
- nulltype 11y agoYeah me too, and I can't recall that ever causing an issue with these comment directives.