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
cmd/gofmt: inconsistent spacing on slice indices #11497
What version of Go are you using (go version)?
These are two lines within the same function. They vary slightly, but the interesting part is the
If this is not a bug, please let me know what difference here is causing the spacing to change.
return "?" + key[1:len(key)-1]
key = key[1 : len(key)-1]
It's working as intended. There's a good explanation here.
@tgrosinger You are correct - they should format the same:
The fix is trivial, but in the interest of not introducing lots of changes over huge amounts of code, we haven't pushed it through, and I suggest leaving it as is for now.
That said, I've been working on a new version of gofmt (long overdue, hopefully after 1.5 I can concentrate on finishing it) which should solve many of the open gofmt issues. This may be a good time to address this one as well.