Skip to content

Commit

Permalink
interp: use %w on interp.Dir
Browse files Browse the repository at this point in the history
  • Loading branch information
andreynering authored and mvdan committed Feb 2, 2022
1 parent 3da64ec commit de81db6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions interp/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,18 +208,18 @@ func Dir(path string) RunnerOption {
if path == "" {
path, err := os.Getwd()
if err != nil {
return fmt.Errorf("could not get current dir: %v", err)
return fmt.Errorf("could not get current dir: %w", err)
}
r.Dir = path
return nil
}
path, err := filepath.Abs(path)
if err != nil {
return fmt.Errorf("could not get absolute dir: %v", err)
return fmt.Errorf("could not get absolute dir: %w", err)
}
info, err := os.Stat(path)
if err != nil {
return fmt.Errorf("could not stat: %v", err)
return fmt.Errorf("could not stat: %w", err)
}
if !info.IsDir() {
return fmt.Errorf("%s is not a directory", path)
Expand Down

0 comments on commit de81db6

Please sign in to comment.