Skip to content

Commit

Permalink
refactor: rewrite parser mode
Browse files Browse the repository at this point in the history
  • Loading branch information
haunt98 committed Nov 28, 2022
1 parent a5302ae commit 2345460
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/imports/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 {
Expand Down

0 comments on commit 2345460

Please sign in to comment.