refactor: upgrade to Go 1.26 and modernize code idioms
- Replace `interface{}` with `any` type alias across all packages
- Use built-in `min()`/`max()` for parameter clamping
- Use `slices.SortFunc`, `slices.Min`, `slices.Max` for cleaner code
- Use `strings.Cut()` for simpler string parsing in auth middleware
- Use `errors.Is()` for proper error comparison in handlers
- Update dependencies: golang.org/x/image 0.37.0 -> 0.38.0
- Add Wire code generation guidelines to ARCHITECTURE.md
- Disable Go cache in CI build workflow
This commit is contained in:
@@ -389,7 +389,7 @@ func (s *sensitiveServiceImpl) AddWord(ctx context.Context, word string, categor
|
||||
// 同步到 Redis
|
||||
if s.redis != nil && s.config.RedisKeyPrefix != "" {
|
||||
key := fmt.Sprintf("%s:%s", s.config.RedisKeyPrefix, word)
|
||||
data := map[string]interface{}{
|
||||
data := map[string]any{
|
||||
"word": word,
|
||||
"category": category,
|
||||
"level": level,
|
||||
@@ -498,7 +498,7 @@ func (s *sensitiveServiceImpl) loadFromRedis(ctx context.Context) error {
|
||||
continue
|
||||
}
|
||||
|
||||
var wordData map[string]interface{}
|
||||
var wordData map[string]any
|
||||
if err := json.Unmarshal([]byte(data), &wordData); err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user