Each gofmt and gofumpt producing the next, inconsistent spacing for some arithmetic expressions.
var butteryPalettedsLen int
change o.Sew {
case Mirror:
butteryPalettedsLen = 2*clonePalettedsLen - 1
case FlipH:
butteryPalettedsLen = 2 * clonePalettedsLen
case FlipV:
butteryPalettedsLen = 2 * clonePalettedsLen
default:
butteryPalettedsLen = clonePalettedsLen
}
The multiplication asterisks (*
) ought to both all exhibit an ASCII house earlier than and after, or else none of them ought to. I consider the previous is simpler to learn and scale to longer, intricate expressions. Regardless, at the least be constant within the styling.
This bug occurs when utilizing the corresponding CLI instruments. It additionally occurs when utilizing the identical instruments by way of Go’s official VSCode Go plugin. Like loads of different programming languages, I discover the bug triggered by autosave and different frequent actions, intractable and so elect to disable the plugin completely. Not that even VSCode primary syntax highlighting is especially dependable.
This isn’t a bug in any respect; it’s a function. It looks like you aren’t acquainted with the order of operations. Once you added multiplication and subtraction on the identical line, the formatter grouped them appropriately so you possibly can visually see the order of operations.
Think about the next remark from rsc:
We labored onerous on this. Placing areas all over the place signifies that you
can’t see issues like operator priority at a look. Examine
x + y * z + w
x * y + z * w
x + y*z + w
x*y + z*w
It’s completely being constant; and really helpful. Once I use different languages, I virtually all the time use parens to cut back the psychological load of studying capabilities (even when not wanted). Grouping them visually with out parens is superior.
I’ve additionally discovered VSCode syntax highlighting to work reliably (similar with the vim plugin). This criticism is extremely imprecise. When you have an actual downside/bug you possibly can most likely get assist for it on github. I do know lots of people actually love goland; you possibly can give {that a} strive. Additionally – within the olden occasions, earlier than VSCode ate the whole lot, quite a lot of us used LiteIDE.
1 Like
I discover the nonuniform spacing so distracting that I can now not think about operator priority.
An attacker might abuse spacing to indicate a distinction priority.
Somebody who doesn’t perceive primary arithmetic order shouldn’t code.
You can’t be honest. That is changing into a meme of you complaining concerning the Go toolchain in methods which might be more and more nonsensical. Is that this an April Fools joke? In that case, you bought me.
What?? If an attacker is checking in code to your repository you could have bigger points. This makes zero sense. Additionally – given that almost all go tasks implement gofmt this argument is much more ridiculous.
- Kids can (and may!) write code. Don’t be a gatekeeper.
- I imply – you’re the one who didn’t instantly see the spacing and assume “order of operations”. The primary time I ever noticed gofmt do that, it was instantly apparent to me that it was on account of order of operations.
I believe that is the tip of my replies to you. I’m coming at this from a honest angle and I simply don’t assume you might be. It looks like you could have some ax to grind and you might be posting issues which might be more and more nonsensical to get some kind of response. Possibly you possibly can strive the go discord or subreddit. Good luck!
1 Like