diff --git a/internal/imports/formatter.go b/internal/imports/formatter.go index 3f7bded..19cb064 100644 --- a/internal/imports/formatter.go +++ b/internal/imports/formatter.go @@ -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