troubleshoot icon indicating copy to clipboard operation
troubleshoot copied to clipboard

Remove errors package in favour of the standard library approach

Open banjoh opened this issue 2 years ago • 0 comments

Describe the rationale for the suggested feature.

The go errors package we use in troubleshoot was deprecated in favour of golang's native error handling which was introduced in go 1.13. Lets remove any references of this library in the code base

Describe the feature

Remove any references of errors.* and replace them with fmt.Errorf(.... Here are some before/after examples

// Before: Wrapping errors
errors.Wrap(err, "failed to create directory")

// After: Wrapping errors. NOTE the newly introduced %w formatting verb
fmt.Errorf("failed to create directory: %w", err)
// before
errors.Errorf("cannot create symlink, result in %q not found", relativeFilePath)

// after
fmt.Errorf("cannot create symlink, result in %q not found", relativeFilePath)

Describe alternatives you've considered

Leave the deprecated dependency in the code base

banjoh avatar Mar 22 '23 12:03 banjoh