Input:
// a
// b
// c
func main() {
fmt.Println()
}
gofmt fails appropriately:
$ gofmt x.go
x.go:5:1: expected 'package', found 'func'
goimports inserts a package clause and mangles the comments:
$ goimports x.go
package main // a
import "fmt"
// b
// c
func main() {
fmt.Println()
}