fix(lint): exclude common fire-and-forget patterns from errcheck

This commit is contained in:
Deivid Soto 2026-03-30 23:34:36 +02:00
parent 104820f4fe
commit c0fd8d3818
8 changed files with 25 additions and 12 deletions

View file

@ -171,7 +171,7 @@ func Save(cfg Config, path string) error {
}
if err := os.Rename(tmpPath, path); err != nil {
_ = os.Remove(tmpPath)
os.Remove(tmpPath)
return fmt.Errorf("rename config: %w", err)
}

View file

@ -93,7 +93,7 @@ func TestLoadPreservesDefaults(t *testing.T) {
path := filepath.Join(tmp, "config.toml")
// Write partial config (only auth section)
_ = os.WriteFile(path, []byte(`[auth]
os.WriteFile(path, []byte(`[auth]
api_key = "tc_partial"
`), 0o644)
@ -193,7 +193,7 @@ func TestParseSpeed(t *testing.T) {
func TestLoadInvalidTOML(t *testing.T) {
tmp := t.TempDir()
path := filepath.Join(tmp, "config.toml")
_ = os.WriteFile(path, []byte(`not valid toml [[[`), 0o644)
os.WriteFile(path, []byte(`not valid toml [[[`), 0o644)
_, err := Load(path)
if err == nil {

View file

@ -43,7 +43,7 @@ func TestDirOverrideEnv(t *testing.T) {
func TestDirXDGOverride(t *testing.T) {
// Clear the custom env so XDG takes effect
_ = os.Unsetenv("UNARR_CONFIG_DIR")
os.Unsetenv("UNARR_CONFIG_DIR")
t.Setenv("XDG_CONFIG_HOME", "/xdg/config")
dir := Dir()