Skip to content

Commit

Permalink
Fix bug when handling file paths on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
meiping committed Aug 24, 2023
1 parent 8ec65d1 commit 31bb086
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions reviser/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"go/token"
"io"
"os"
"path"
"path/filepath"
"regexp"
"sort"
"strings"
Expand Down Expand Up @@ -460,7 +460,7 @@ func (f *SourceFile) parseImports(file *ast.File) (map[string]*commentsMetadata,
var err error

if shouldRemoveUnusedImports || shouldUseAliasForVersionSuffix {
packageImports, err = astutil.LoadPackageDependencies(path.Dir(f.filePath), astutil.ParseBuildTag(file))
packageImports, err = astutil.LoadPackageDependencies(filepath.Dir(f.filePath), astutil.ParseBuildTag(file))
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 31bb086

Please sign in to comment.