chore: remove useless check import empty

main
sudo pacman -Syu 2022-11-27 00:33:37 +07:00
parent c0206fbef4
commit 5e87f5eca8
No known key found for this signature in database
GPG Key ID: D6CB5C6C567C47B0
1 changed files with 2 additions and 6 deletions

View File

@ -170,13 +170,9 @@ func (ft *Formatter) formatImports(
// Extract imports
importSpecs := make([]ast.Spec, 0, len(astFile.Imports))
for _, importSpec := range astFile.Imports {
if importSpec.Path.Value == "" {
continue
}
ft.log("formatImports: importSpec: %+v %+v\n", importSpec.Name.String(), importSpec.Path.Value)
importSpecs = append(importSpecs, importSpec)
}
ft.mustLogImportSpecs("formatImports: importSpecs", importSpecs)
groupedImportSpecs, err := ft.groupImportSpecs(importSpecs, moduleName)
if err != nil {
@ -254,7 +250,7 @@ func (ft *Formatter) groupImportSpecs(
}
// "github.com/abc/xyz" -> github.com/abc/xyz
importPath := strings.Trim(importSpec.Path.Value, "\"")
importPath := strings.Trim(importSpec.Path.Value, `"`)
if _, ok := ft.stdPackages[importPath]; ok {
result[stdImport] = append(result[stdImport], importSpec)