Skip to content

Inconsistency with go fmt when formatting a select statement #473

@mtoader

Description

@mtoader

The following code:

package main

func main() {
select{
case a<-       1       : return a
                        case a,ok:=<-c3     :break
//
        default:return b
}
}

should format like:

package main

func main() {
    select {
    case a <- 1:
        return a
    case a, ok := <-c3:
        break
        //
    default:
        return b
    }
}

but is formatted like:

package main

func main() {
    select {
    case a <- 1:
        return a
    case a , ok := <-c3:
        break
    //
    default:
        return b
    }
}

Note: the comment should align with the break statement and not the default block.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions