enable dogsled
Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()). Signed-off-by: Kai Xia <kaix+github@fastmail.com>
This commit is contained in:
parent
bbbe766caa
commit
f15ce0cfa2
2 changed files with 10 additions and 7 deletions
|
|
@ -29,7 +29,6 @@ linters:
|
||||||
|
|
||||||
# TODO: Disabled, because they are failing at the moment, we should fix them and enable (step by step)
|
# TODO: Disabled, because they are failing at the moment, we should fix them and enable (step by step)
|
||||||
- contextcheck
|
- contextcheck
|
||||||
- dogsled
|
|
||||||
- embeddedstructfieldcheck
|
- embeddedstructfieldcheck
|
||||||
- errcheck
|
- errcheck
|
||||||
- errchkjson
|
- errchkjson
|
||||||
|
|
|
||||||
|
|
@ -43,12 +43,18 @@ func TestReadCodexCliCredentials_Valid(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// readCodexCliCredentialsErr calls ReadCodexCliCredentials and returns only the
|
||||||
|
// error, for tests that only need to assert on failure.
|
||||||
|
func readCodexCliCredentialsErr() error {
|
||||||
|
_, _, _, err := ReadCodexCliCredentials() //nolint:dogsled
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
func TestReadCodexCliCredentials_MissingFile(t *testing.T) {
|
func TestReadCodexCliCredentials_MissingFile(t *testing.T) {
|
||||||
tmpDir := t.TempDir()
|
tmpDir := t.TempDir()
|
||||||
t.Setenv("CODEX_HOME", tmpDir)
|
t.Setenv("CODEX_HOME", tmpDir)
|
||||||
|
|
||||||
_, _, _, err := ReadCodexCliCredentials()
|
if err := readCodexCliCredentialsErr(); err == nil {
|
||||||
if err == nil {
|
|
||||||
t.Fatal("expected error for missing auth.json")
|
t.Fatal("expected error for missing auth.json")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -64,8 +70,7 @@ func TestReadCodexCliCredentials_EmptyToken(t *testing.T) {
|
||||||
|
|
||||||
t.Setenv("CODEX_HOME", tmpDir)
|
t.Setenv("CODEX_HOME", tmpDir)
|
||||||
|
|
||||||
_, _, _, err := ReadCodexCliCredentials()
|
if err := readCodexCliCredentialsErr(); err == nil {
|
||||||
if err == nil {
|
|
||||||
t.Fatal("expected error for empty access_token")
|
t.Fatal("expected error for empty access_token")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -80,8 +85,7 @@ func TestReadCodexCliCredentials_InvalidJSON(t *testing.T) {
|
||||||
|
|
||||||
t.Setenv("CODEX_HOME", tmpDir)
|
t.Setenv("CODEX_HOME", tmpDir)
|
||||||
|
|
||||||
_, _, _, err := ReadCodexCliCredentials()
|
if err := readCodexCliCredentialsErr(); err == nil {
|
||||||
if err == nil {
|
|
||||||
t.Fatal("expected error for invalid JSON")
|
t.Fatal("expected error for invalid JSON")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue