fix: panic if format import spec empty

main
sudo pacman -Syu 2023-01-17 11:47:51 +07:00 committed by sudo pacman -Syu
parent 92bcf25979
commit 02501123af
1 changed files with 4 additions and 0 deletions

View File

@ -334,6 +334,10 @@ func (ft *Formatter) formatDSTImportSpecs(groupedImportSpecs map[string][]*dst.I
appendToResultFn(companyImport)
appendToResultFn(localImport)
if len(result) == 0 {
return result, nil
}
result[len(result)-1].Decs.After = dst.NewLine
return result, nil