fatih / errwrap

Go tool to wrap and fix errors with the new %w verb directive
https://arslan.io
Other
371 stars 16 forks source link

Leading whitespace corrupted #3

Closed tmm1 closed 4 years ago

tmm1 commented 4 years ago

        if err := os.Rename(sourceFilename, destinationFilename); err
 != nil {
-               err = fmt.Errorf("Could not move file: %v to %v: %v",
-                       sourceFilename, destinationFilename, err)
+               err = fmt.Errorf("Could not move file: %v to %v: %w",
+       sourceFilename, destinationFilename, err)
                log.Add("err", err)

fatih commented 4 years ago

Thanks, I assume you're meaning that the code is not correctly formatted? This is a valid Go code though. Seems like go/analysis doesn't formatting fixes. I'll ask around whether this is intended or not.

/cc @matloob

fatih commented 4 years ago

@matloob is working on a fix that will format source code that are modified with the -fix flag: https://go-review.googlesource.com/c/tools/+/209861

fatih commented 4 years ago

The latest master includes now the fix. Thank you for your report again. Also released a new version with it: https://github.com/fatih/errwrap/releases/tag/v1.1.0