chore: run go fix for Go 1.26 modernization
CI / Go vulnerabilities (push) Successful in 1m10s
CI / Build & Vet (push) Successful in 1m39s
CI / Frontend build (gate) (push) Successful in 1m42s
CI / Frontend QC (audit) (push) Successful in 56s
CI / Frontend QC (typecheck) (push) Successful in 1m36s
CI / Frontend QC (lint) (push) Successful in 1m51s
CI / Tests (prod) (push) Has been cancelled
CI / Tests (dev) (push) Has been cancelled
CI / Race (prod) (push) Has been cancelled
CI / Race (dev) (push) Has been cancelled
CI / Go vulnerabilities (push) Successful in 1m10s
CI / Build & Vet (push) Successful in 1m39s
CI / Frontend build (gate) (push) Successful in 1m42s
CI / Frontend QC (audit) (push) Successful in 56s
CI / Frontend QC (typecheck) (push) Successful in 1m36s
CI / Frontend QC (lint) (push) Successful in 1m51s
CI / Tests (prod) (push) Has been cancelled
CI / Tests (dev) (push) Has been cancelled
CI / Race (prod) (push) Has been cancelled
CI / Race (dev) (push) Has been cancelled
106 files: interface{}→any, strings.Split→SplitSeq, CutPrefix/Cut, strings.Builder, slices.Contains, remove redundant // +build directives, gofmt import ordering and indentation.
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
+2
-7
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"log"
|
||||
"net/http"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"crussell/auth"
|
||||
@@ -77,13 +78,7 @@ func RequireRole(allowedRoles ...string) func(http.Handler) http.Handler {
|
||||
}
|
||||
|
||||
// Check if user has one of the allowed roles
|
||||
hasRole := false
|
||||
for _, allowedRole := range allowedRoles {
|
||||
if role == allowedRole {
|
||||
hasRole = true
|
||||
break
|
||||
}
|
||||
}
|
||||
hasRole := slices.Contains(allowedRoles, role)
|
||||
|
||||
if !hasRole {
|
||||
http.Error(w, "forbidden", http.StatusForbidden)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//go:build test
|
||||
// +build test
|
||||
|
||||
package mw
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//go:build test
|
||||
// +build test
|
||||
|
||||
package mw
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//go:build !dev
|
||||
// +build !dev
|
||||
|
||||
package mw
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//go:build dev
|
||||
// +build dev
|
||||
|
||||
package mw
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//go:build test && dev
|
||||
// +build test,dev
|
||||
|
||||
package mw
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//go:build test && !dev
|
||||
// +build test,!dev
|
||||
|
||||
package mw
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//go:build test && !dev
|
||||
// +build test,!dev
|
||||
|
||||
package mw
|
||||
|
||||
|
||||
Reference in New Issue
Block a user