Skip to content

cmd/gofmt: nonidempotent format of expression #8021

@dvyukov

Description

@dvyukov
go version devel +386c6757d94c Sat May 17 00:06:56 2014 +0000 + darwin/amd64

source is:
package main
func main() {
    _ = ([]bool{})[([]int{})[((1) + (((((1) + (((((((1) * (((((1) + (1))) + (1))))) + (1))) * (1))))) + (1))))]]
}

The following line:
_ = ([]bool{})[([]int{})[((1) + (((((1) + (((((((1) * (((((1) + (1))) + (1))))) + (1)))
* (1))))) + (1))))]]
transforms to the following after first gofmt:
_ = ([]bool{})[([]int{})[((1)+(((1) + ((((1) * (((1) + (1)) + (1))) + (1)) * (1))) +
(1)))]]
and to the following after second gofmt:
_ = ([]bool{})[([]int{})[((1)+(((1)+((((1)*(((1)+(1))+(1)))+(1))*(1)))+(1)))]]

Second gofmt must not change source.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions