Skip to content

Commit

Permalink
add the package name to error
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo82148 committed Oct 29, 2022
1 parent f29ece0 commit 3c4353c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func getFileName(f *os.File) (string, error) {
fd := f.Fd()
name, err := os.Readlink(fmt.Sprintf("/proc/%d/fd/%d", os.Getpid(), fd))
if err != nil {
return "", fmt.Errorf("getting path of file descriptor %d: %w", fd, err)
return "", fmt.Errorf("tail: getting path of file descriptor %d: %w", fd, err)
}
return name, nil
}
4 changes: 2 additions & 2 deletions fs_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ func getFileName(f *os.File) (string, error) {
}
}
if err != nil {
return "", err
return "", fmt.Errorf("tail: getting path of file descriptor %d: %w", fd, err)
}

idx := bytes.IndexByte(buf[:], 0)
if idx < 0 {
return "", fmt.Errorf("getting path of file descriptor %d", fd)
return "", fmt.Errorf("tail: getting path of file descriptor %d", fd)
}
return string(buf[:idx]), nil
}

0 comments on commit 3c4353c

Please sign in to comment.