feat: ignore empty import

main
sudo pacman -Syu 2022-11-27 01:20:35 +07:00
parent 57e4bbd4d7
commit 7bb5fc7d63
No known key found for this signature in database
GPG Key ID: D6CB5C6C567C47B0
1 changed files with 6 additions and 0 deletions

View File

@ -219,10 +219,16 @@ func (ft *Formatter) formatImports(
continue
}
// Ignore second import decl and more
if isExistFirstImportDecl {
continue
}
// Ignore empty import
if len(genDecl.Specs) == 0 {
continue
}
// First import decl take all
isExistFirstImportDecl = true
genDecl.Specs = formattedImportSpecs