Skip to content

cmd/gofmt: inconsistent spacing on slice indices #11497

@tgrosinger

Description

@tgrosinger

What version of Go are you using (go version)? go version go1.4.2 linux/amd64
What operating system and processor architecture are you using? Ubuntu 14.04
What did you do? Run gofmt on below code examples
What did you expect to see? Consistent spacing of slice indices

These are two lines within the same function. They vary slightly, but the interesting part is the [1:len(key-1] which has inconsistent spacing. Adding spaces to the first one will result in them being removed when gofmt is run, and removing the spaces from the second will only have them added back.

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions