Skip to content

Commit

Permalink
fix: use filepath.Dir instead of path.Dir (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
tlipoca9 authored and micaelmalta committed May 27, 2024
1 parent 38044e6 commit 6a29e6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ func main() {
log.Fatalf("Failed to find unformatted files %s: %+v\n", originPath, err)
}
fmt.Printf("%s\n", unformattedFiles.String())
if *setExitStatus && unformattedFiles != nil {
os.Exit(1)
}
return
}
err := reviser.NewSourceDir(originProjectName, originPath, *isRecursive, excludes).Fix(options...)
Expand Down
3 changes: 2 additions & 1 deletion reviser/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"io"
"os"
"path"
"path/filepath"
"regexp"
"sort"
"strings"
Expand Down Expand Up @@ -438,7 +439,7 @@ func (f *SourceFile) parseImports(file *ast.File) (map[string]*commentsMetadata,

if shouldRemoveUnusedImports || shouldUseAliasForVersionSuffix {
var err error
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 6a29e6e

Please sign in to comment.