From a6cf03a6ae98e4fb675da25046d148e92bcf7206 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Wed, 16 Sep 2026 15:00:46 -0400 Subject: chore: staticcheck and gofmt cleanups --- internal/admin/api_colors.go | 34 ++++++++-------------------------- 1 file changed, 8 insertions(+), 26 deletions(-) (limited to 'internal/admin/api_colors.go') diff --git a/internal/admin/api_colors.go b/internal/admin/api_colors.go index 876656d..b57ad82 100644 --- a/internal/admin/api_colors.go +++ b/internal/admin/api_colors.go @@ -3,7 +3,6 @@ package admin import ( "net/http" "os" - "sort" "strings" "gopkg.in/yaml.v3" @@ -185,11 +184,6 @@ func knownConstantColor(name string) bool { return false } -// knownColor returns true if name is editable in either section. -func knownColor(name string) bool { - return knownPlayerColor(name) || knownConstantColor(name) -} - // seg is a small constructor helper for the inline preview builder. func seg(t, cat string) colorSegment { return colorSegment{T: t, C: cat} @@ -280,7 +274,6 @@ func buildPreview() []colorSection { ln(seg("Oh dear, you are dead!", "death")), txt(""), txt(""), - }, }) @@ -479,20 +472,20 @@ func (s *AdminServer) getColors(w http.ResponseWriter, _ *http.Request) { } writeJSON(w, map[string]any{ - "colors": live, - "default_colors": def, - "categories": colorCategories, - "constant_colors": liveConst, + "colors": live, + "default_colors": def, + "categories": colorCategories, + "constant_colors": liveConst, "default_constant_colors": defConst, - "constant_categories": constantCategories, - "preview": buildPreview(), + "constant_categories": constantCategories, + "preview": buildPreview(), }) } func (s *AdminServer) saveColors(w http.ResponseWriter, r *http.Request) { var body struct { - Colors map[string]string `json:"colors"` - ConstantColors map[string]string `json:"constant_colors"` + Colors map[string]string `json:"colors"` + ConstantColors map[string]string `json:"constant_colors"` } if err := readJSON(r, &body); err != nil { writeJSONError(w, "invalid request body", http.StatusBadRequest) @@ -593,14 +586,3 @@ func (s *AdminServer) writeConfigFile() error { } return os.WriteFile(s.configPath, out, 0644) } - -// sortedKeys is a small helper retained in case future code wants a stable -// iteration order over the category names. -func sortedKeys(m map[string]string) []string { - keys := make([]string, 0, len(m)) - for k := range m { - keys = append(keys, k) - } - sort.Strings(keys) - return keys -} -- cgit v1.2.3