We have unary negation in Go, it’s ^x, not ~x, also, the linked commit is about using ~ in type sets (for generics), it has nothing to do with bitwise operations. Also the blog post is about contributing to Go, but no such contribution has been made, it’s just clickbait.
This seems brutally negative. Dude made a mistake in missing ^ but the article is clear and thorough.
I don’t think that’s even a mistake. I wrote about adding a print function to nginx when that already exists – the point is just to show off how you can even begin contributing to a large existing project. It’s a challenge for every kind of programmer and there are very few resources out there to help folks new to OSS get started hacking.
I love these kind of articles!
Edit: oh the linked commit is wrong, that was probably the mistake you were referring to.
It’s not clickbait at all. It’s a worked example of how to make a language change from proposal to completion. The author makes no pretense that they have submitted or even intend to submit the change.
It’s definitely not to completion, since no effort at submission has even been made, and yet the post title certainly implies that. But more importantly, the author solves a problem that doesn’t exist because he doesn’t fully grasp the Go language which is the worst possible thing to do if you are trying to contribute to the Go language. And btw, if you want to contribute to the Go language, the first thing to do is not just to write, but more importantly to discuss a proposal, which is exactly what was not done in this case. The author jumped to implementation, and wrote his “proposal” like filing some kind of bureaucratic form. That’s not the point of the proposal process.
“Clickbait” is a judgment laden term. It is definitely a poorly thought through article. Whether the poor thinking is because the author just wanted “clicks” or because the author was careless, I don’t know.
If you just want to show “here’s how to add an operator to a language” you can write that article, and that is almost what this article is. But the article purports to be “here’s how to contribute to Go” which this definitely is not because he opened an issue to contribute to Go a redundant operator, which wasted the time of the Go team to triage the non-issue. Opening a bogus issue to illustrate your blog post is uncool behavior, “clickbait” or not.
It’s an outstanding article. Much appreciated. Definitely not clickbait.
TL;DR: on adding a bitwise unary negation operator to Go.