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:
@@ -94,7 +94,7 @@ func (r *commentRepository) Delete(id string) error {
|
||||
// 减少帖子的评论数并同步热度分
|
||||
// 评论数属于统计字段,不应影响帖子内容更新时间(updated_at)
|
||||
if err := tx.Model(&model.Post{}).Where("id = ?", comment.PostID).
|
||||
UpdateColumns(map[string]interface{}{
|
||||
UpdateColumns(map[string]any{
|
||||
"comments_count": gorm.Expr("comments_count - 1"),
|
||||
"updated_at": gorm.Expr("updated_at"),
|
||||
}).Error; err != nil {
|
||||
|
||||
Reference in New Issue
Block a user