Skip to content

Commit b44ade7

Browse files
fix(lint): resolve goconst and shadow lint errors
- Add boolTrue/boolFalse constants for string "true"/"false" values - Rename shadowed err variable to writeErr in test file Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 3e999df commit b44ade7

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

internal/cmd/docs_write_update_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ func TestDocsWriteUpdate_FileInputErrors(t *testing.T) {
303303
// Test with empty file
304304
tmpDir := t.TempDir()
305305
emptyFile := filepath.Join(tmpDir, "empty.txt")
306-
if err := os.WriteFile(emptyFile, []byte(""), 0o600); err != nil {
307-
t.Fatalf("write empty temp file: %v", err)
306+
if writeErr := os.WriteFile(emptyFile, []byte(""), 0o600); writeErr != nil {
307+
t.Fatalf("write empty temp file: %v", writeErr)
308308
}
309309
err = runKong(t, &DocsWriteCmd{}, []string{"doc1", "--file", emptyFile}, ctx, flags)
310310
if err == nil {
@@ -316,8 +316,8 @@ func TestDocsWriteUpdate_FileInputErrors(t *testing.T) {
316316

317317
// Test that --text and --file are mutually exclusive
318318
testFile := filepath.Join(tmpDir, "test.txt")
319-
if err := os.WriteFile(testFile, []byte("content"), 0o600); err != nil {
320-
t.Fatalf("write test temp file: %v", err)
319+
if writeErr := os.WriteFile(testFile, []byte("content"), 0o600); writeErr != nil {
320+
t.Fatalf("write test temp file: %v", writeErr)
321321
}
322322
err = runKong(t, &DocsWriteCmd{}, []string{"doc1", "--text", "hello", "--file", testFile}, ctx, flags)
323323
if err == nil {

internal/cmd/root.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import (
2121
const (
2222
colorAuto = "auto"
2323
colorNever = "never"
24+
boolTrue = "true"
25+
boolFalse = "false"
2426
)
2527

2628
type RootFlags struct {
@@ -163,9 +165,9 @@ func envOr(key, fallback string) string {
163165

164166
func boolString(v bool) string {
165167
if v {
166-
return "true"
168+
return boolTrue
167169
}
168-
return "false"
170+
return boolFalse
169171
}
170172

171173
func newParser(description string) (*kong.Kong, *CLI, error) {

0 commit comments

Comments
 (0)