Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap Open error and update TestOpen to check for fs.ErrNotExist #1149

Merged
merged 7 commits into from Aug 16, 2022

Commits on Aug 16, 2022

  1. Wrap Open error and update TestOpen to check for fs.ErrNotExist

    This is a prefactor for Windows support (uber-go#621).
    
    `TestOpen` currently relies on a hardcoded error "no such file or
    directory" if a file is not found. However, this error message is
    OS-specific.  We can now rely on `errors.Is(err, fs.ErrNotExist)`
    if we wrap errors using `%w` instead of `%v`.
    prashantv committed Aug 16, 2022
    Copy the full SHA
    76f9a9e View commit details
    Browse the repository at this point in the history
  2. Upgrade to latest testify

    ErrorContains doesn't exist in 1.7.0.
    abhinav committed Aug 16, 2022
    Copy the full SHA
    ea4c596 View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    f73b3a1 View commit details
    Browse the repository at this point in the history
  4. writer/open: Drop "couldn't" from error

    Per [Error Strings][1] guidance, don't add a "couldn't do foo" or
    "failed to do bar" to error messages when wrapping.
    
      [1]: https://github.com/uber-go/guide/blob/master/style.md#error-wrapping
    
    This is to prevent long chains of "failed to x: failed to y: .." as
    these errors tend to get wrapped before they're presented to the user.
    abhinav committed Aug 16, 2022
    Copy the full SHA
    d7237a2 View commit details
    Browse the repository at this point in the history
  5. go mod tidy submodules

    abhinav committed Aug 16, 2022
    Copy the full SHA
    f8e27ff View commit details
    Browse the repository at this point in the history
  6. TestOpen: Split into three tests

    Avoid too many branches in the table test in favor of simpler single
    purpose tables:
    
    - one for success
    - one for not found errors
    - one for other errors matched by message
    abhinav committed Aug 16, 2022
    Copy the full SHA
    eb487b9 View commit details
    Browse the repository at this point in the history
  7. Update copyright headers

    abhinav committed Aug 16, 2022
    Copy the full SHA
    1d77f86 View commit details
    Browse the repository at this point in the history