Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
cmd/gofmt: don't remove spaces when combining binary and unary * #40288
What version of Go are you using (
If we rewrite your example as desired, we get:
fmt.Println(10 * *p1 * *p2 + 1)
which is better for the multiplications, but worse for the addition as it lost its difference from the multiplications which have higher precedence. As has been pointed out above, this was discussed almost 10 years ago and we decided to leave it alone. The better solution is to introduce parentheses to increase readability when it's problematic. Also, this is not a very common situation.