Skip to content

Remove empty lines in if and for similar to functions #284

@flan6

Description

@flan6
// code before formating
func main() {

  for i := 0; i < 5; i++ {

    err := doSomething()

    if  err != nil {

      fmt.Println(err)

    } 
    
    doAnotherThingVoid()
    
  }
  
}

would become

// code after formating
func main() {
  for i := 0; i < 5; i++ {

    err := doSomething()
    if  err != nil {

      fmt.Println(err)

    }
    
    doAnotherThingVoid()

  }
}

my proposal is to remove same empty lines in if and for statement as well

// my proposal
func main() {
  for i := 0; i < 5; i++ {
    err := doSomething()
    if  err != nil {
      fmt.Println(err)
    }
    
    doAnotherThingVoid()
  }
}

note that the empty lines between different instructions in same level doesn't get removed. Same way as empty lines between function declarations.
this behavior is more consistent and better to read.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions