Replace interface{} with any

This commit is contained in:
2025-02-24 21:42:39 +01:00
parent 96284c3dbd
commit d3ffcfbb53
11 changed files with 76 additions and 76 deletions

View File

@@ -308,7 +308,7 @@ func (h *Handler) AdminUpdateUser() http.HandlerFunc {
}
// Track what's being updated for logging
updates := make(map[string]interface{})
updates := make(map[string]any)
if req.Email != "" {
user.Email = req.Email

View File

@@ -192,7 +192,7 @@ func TestFileHandlers_Integration(t *testing.T) {
name string
method string
path string
body interface{}
body any
}{
{"list files", http.MethodGet, baseURL, nil},
{"get file", http.MethodGet, baseURL + "/test.md", nil},

View File

@@ -123,7 +123,7 @@ func TestGitHandlers_Integration(t *testing.T) {
name string
method string
path string
body interface{}
body any
}{
{
name: "commit without token",

View File

@@ -37,7 +37,7 @@ func NewHandler(db db.Database, s storage.Manager) *Handler {
}
// respondJSON is a helper to send JSON responses
func respondJSON(w http.ResponseWriter, data interface{}) {
func respondJSON(w http.ResponseWriter, data any) {
w.Header().Set("Content-Type", "application/json")
if err := json.NewEncoder(w).Encode(data); err != nil {
respondError(w, "Failed to encode response", http.StatusInternalServerError)

View File

@@ -195,7 +195,7 @@ func (h *testHarness) createTestUser(t *testing.T, email, password string, role
}
}
func (h *testHarness) newRequest(t *testing.T, method, path string, body interface{}) *http.Request {
func (h *testHarness) newRequest(t *testing.T, method, path string, body any) *http.Request {
t.Helper()
var reqBody []byte
@@ -246,7 +246,7 @@ func (h *testHarness) addCSRFCookie(t *testing.T, req *http.Request) string {
}
// makeRequest is the main helper for making JSON requests
func (h *testHarness) makeRequest(t *testing.T, method, path string, body interface{}, testUser *testUser) *httptest.ResponseRecorder {
func (h *testHarness) makeRequest(t *testing.T, method, path string, body any, testUser *testUser) *httptest.ResponseRecorder {
t.Helper()
req := h.newRequest(t, method, path, body)