refactor: modernize Go idioms across codebase

Replace map[string]interface{} with map[string]any, ioutil.ReadAll with
io.ReadAll, and simplify redundant fmt.Sprintf/w.Write calls.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
nemunaire 2026-03-08 10:56:58 +07:00
commit 439dc2cd07
7 changed files with 28 additions and 34 deletions

View file

@ -23,7 +23,7 @@ func securityHeaders(next http.Handler) http.Handler {
//go:embed all:static
var assets embed.FS
func displayTmpl(w http.ResponseWriter, page string, vars map[string]interface{}) {
func displayTmpl(w http.ResponseWriter, page string, vars map[string]any) {
data, err := assets.ReadFile("static/" + page)
if err != nil {
log.Fatalf("Unable to find %q: %s", page, err.Error())
@ -45,7 +45,7 @@ func displayTmpl(w http.ResponseWriter, page string, vars map[string]interface{}
tpl.ExecuteTemplate(w, "page", vars)
}
func displayTmplError(w http.ResponseWriter, statusCode int, page string, vars map[string]interface{}) {
func displayTmplError(w http.ResponseWriter, statusCode int, page string, vars map[string]any) {
w.WriteHeader(statusCode)
displayTmpl(w, page, vars)
}
@ -58,5 +58,5 @@ func displayMsg(w http.ResponseWriter, msg string, statusCode int) {
label = "message"
}
displayTmpl(w, "message.html", map[string]interface{}{label: msg})
displayTmpl(w, "message.html", map[string]any{label: msg})
}