Low Severity The error from loadSettingsFromFile() is wrapped with "reading settings…
- User
Low Severity
The error from loadSettingsFromFile() is wrapped with "reading settings file:" at line 239, then wrapped again with the same prefix at line 84 in LoadEntireSettings(). This produces duplicate error messages like "reading settings file: reading settings file: permission denied" when file read errors occur, making the output confusing for users.
Assistant
Let me look at the code to understand the issue.
Assistant
I can see the issue. Let me look at more context around both locations.
Assistant
The issue is clear. At line 239,
loadSettingsFromFile()wraps the error with "reading settings file:", and then at line 84,LoadEntireSettings()wraps it again with the same prefix. I'll fix this by removing the redundant wrapping inloadSettingsFromFile().Assistant
Let me provide more context to target the specific line.
Assistant
Now let me verify the fix by running the tests and linter.
Assistant
The linter requires wrapping errors from external packages. Let me wrap the error without adding redundant text.
Assistant
Linter passes. Let me run the tests to verify.
Assistant
Fixed. The change at
config.go:239now usesfmt.Errorf("%w", err)which:- Satisfies the wrapcheck linter (errors from external packages must be wrapped)
- Avoids adding the duplicate "reading settings file:" prefix
The error chain is now clean: the caller at line 84 adds the "reading settings file:" context, and the inner function just passes through the underlying error (which already contains the file path from
os.ReadFile).