refactor: rewrite parser mode

main
sudo pacman -Syu 2022-11-28 10:35:50 +07:00
parent a5302aef53
commit 2345460d3d
No known key found for this signature in database
GPG Key ID: D6CB5C6C567C47B0
1 changed files with 4 additions and 2 deletions

View File

@ -191,7 +191,7 @@ func (ft *Formatter) formatFile(path string) error {
return nil
}
// Copy from gofumpt, goimports-reviser
// Copy from goimports, gofumpt, goimports-reviser
func (ft *Formatter) formatImports(
path string,
pathBytes []byte,
@ -200,7 +200,9 @@ func (ft *Formatter) formatImports(
// Parse ast
fset := token.NewFileSet()
parserMode := parser.ParseComments | parser.SkipObjectResolution
parserMode := parser.Mode(0)
parserMode |= parser.ParseComments
parserMode |= parser.SkipObjectResolution
astFile, err := parser.ParseFile(fset, path, pathBytes, parserMode)
if err != nil {