Skip to content

Commit 3ad6ea2

Browse files
Fix lint
1 parent 93ab8c1 commit 3ad6ea2

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

handlers.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,6 @@ import (
1414
"time"
1515
)
1616

17-
// cleanPath is a helper to clean and normalize URL paths for FS lookup.
18-
// It removes the base path and ensures the result is relative and uses '/'.
19-
func cleanPath(basePath, requestPath string) string {
20-
if basePath != "/" && strings.HasPrefix(requestPath, basePath) {
21-
requestPath = strings.TrimPrefix(requestPath, basePath)
22-
}
23-
// Ensure leading slash is removed for relative FS lookup
24-
cleaned := path.Clean(requestPath) // Clean removes trailing slash, handles .. etc.
25-
return strings.TrimPrefix(cleaned, "/")
26-
}
27-
2817
// --- Base Path Handler ---
2918

3019
type basePathHandler struct {

handlers_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ func TestBasePathHandler(t *testing.T) {
117117
t.Errorf("Expected path %q, got %q", tt.expectedPath, r.URL.Path)
118118
w.WriteHeader(http.StatusInternalServerError)
119119
}
120-
w.Write([]byte(r.URL.Path))
120+
if _, err := w.Write([]byte(r.URL.Path)); err != nil {
121+
t.Errorf("Unexpected error: %v", err)
122+
}
121123
})
122124
handler := newBasePathHandler(nextHandler, tt.basePath)
123125
rr := httptest.NewRecorder()

logger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func newLogger(logger *slog.Logger) *servespaLogger {
1414
return &servespaLogger{logger: logger}
1515
}
1616

17-
func (l servespaLogger) logContext(ctx context.Context, level slog.Level, msg string, attrs ...slog.Attr) {
17+
func (l *servespaLogger) logContext(ctx context.Context, level slog.Level, msg string, attrs ...slog.Attr) {
1818
if l.logger == nil {
1919
return
2020
}

0 commit comments

Comments
 (0)