all: Tweak error creation (#6391)
- In the few places where we wrap errors, use the new Go 1.13 "%w" construction instead of %s or %v. - Where we create errors with constant strings, consistently use errors.New and not fmt.Errorf. - Remove capitalization from errors in the few places where we had that.
This commit is contained in:
@@ -508,13 +508,13 @@ func parseIgnoreFile(fs fs.Filesystem, fd io.Reader, currentFile string, cd Chan
|
||||
case strings.HasPrefix(line, "#include"):
|
||||
fields := strings.SplitN(line, " ", 2)
|
||||
if len(fields) != 2 {
|
||||
err = fmt.Errorf("failed to parse #include line: no file?")
|
||||
err = errors.New("failed to parse #include line: no file?")
|
||||
break
|
||||
}
|
||||
|
||||
includeRel := strings.TrimSpace(fields[1])
|
||||
if includeRel == "" {
|
||||
err = fmt.Errorf("failed to parse #include line: no file?")
|
||||
err = errors.New("failed to parse #include line: no file?")
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user