fix: resolve all golangci-lint issues (fixes #32)

This commit is contained in:
clawbot 2026-02-15 22:09:59 -08:00
parent f596990d9d
commit 8417f8f795
2 changed files with 19 additions and 8 deletions

View File

@ -0,0 +1,9 @@
package handlers
// ExportedSanitizeTail wraps sanitizeTail for external tests.
func ExportedSanitizeTail(input string) string {
return sanitizeTail(input)
}
// ExportedDefaultLogTail exports defaultLogTail for external tests.
const ExportedDefaultLogTail = defaultLogTail

View File

@ -1,7 +1,9 @@
package handlers
package handlers_test
import (
"testing"
"git.eeqj.de/sneak/upaas/internal/handlers"
)
func TestSanitizeTail(t *testing.T) {
@ -12,16 +14,16 @@ func TestSanitizeTail(t *testing.T) {
input string
expected string
}{
{"empty uses default", "", defaultLogTail},
{"empty uses default", "", handlers.ExportedDefaultLogTail},
{"valid small number", "50", "50"},
{"valid max boundary", "500", "500"},
{"exceeds max clamped", "501", "500"},
{"very large clamped", "999999", "500"},
{"non-numeric uses default", "abc", defaultLogTail},
{"all keyword uses default", "all", defaultLogTail},
{"negative uses default", "-1", defaultLogTail},
{"zero uses default", "0", defaultLogTail},
{"float uses default", "1.5", defaultLogTail},
{"non-numeric uses default", "abc", handlers.ExportedDefaultLogTail},
{"all keyword uses default", "all", handlers.ExportedDefaultLogTail},
{"negative uses default", "-1", handlers.ExportedDefaultLogTail},
{"zero uses default", "0", handlers.ExportedDefaultLogTail},
{"float uses default", "1.5", handlers.ExportedDefaultLogTail},
{"one is valid", "1", "1"},
}
@ -29,7 +31,7 @@ func TestSanitizeTail(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
got := sanitizeTail(tc.input)
got := handlers.ExportedSanitizeTail(tc.input)
if got != tc.expected {
t.Errorf("sanitizeTail(%q) = %q, want %q", tc.input, got, tc.expected)
}