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:
@@ -56,7 +56,7 @@ type GroupService interface {
|
||||
// 群组管理
|
||||
CreateGroup(ownerID string, name string, description string, memberIDs []string) (*model.Group, error)
|
||||
GetGroupByID(id string) (*model.Group, error)
|
||||
UpdateGroup(userID string, groupID string, updates map[string]interface{}) error
|
||||
UpdateGroup(userID string, groupID string, updates map[string]any) error
|
||||
DissolveGroup(userID string, groupID string) error
|
||||
TransferOwner(userID string, groupID string, newOwnerID string) error
|
||||
GetUserGroups(userID string, page, pageSize int) ([]model.Group, int64, error)
|
||||
@@ -300,7 +300,7 @@ func (s *groupService) GetMemberCount(groupID string) (int, error) {
|
||||
}
|
||||
|
||||
// UpdateGroup 更新群组信息
|
||||
func (s *groupService) UpdateGroup(userID string, groupID string, updates map[string]interface{}) error {
|
||||
func (s *groupService) UpdateGroup(userID string, groupID string, updates map[string]any) error {
|
||||
// 检查群组是否存在
|
||||
group, err := s.groupRepo.GetByID(groupID)
|
||||
if err != nil {
|
||||
@@ -448,7 +448,7 @@ func (s *groupService) broadcastMemberJoinNotice(groupID string, targetUserID st
|
||||
ConversationID: conv.ID,
|
||||
SenderID: model.SystemSenderIDStr,
|
||||
Segments: model.MessageSegments{
|
||||
{Type: "text", Data: map[string]interface{}{"text": noticeContent}},
|
||||
{Type: "text", Data: map[string]any{"text": noticeContent}},
|
||||
},
|
||||
Status: model.MessageStatusNormal,
|
||||
Category: model.CategoryNotification,
|
||||
@@ -1360,7 +1360,7 @@ func (s *groupService) MuteMember(userID string, groupID string, targetUserID st
|
||||
ConversationID: conv.ID,
|
||||
SenderID: model.SystemSenderIDStr,
|
||||
Segments: model.MessageSegments{
|
||||
{Type: "text", Data: map[string]interface{}{"text": noticeContent}},
|
||||
{Type: "text", Data: map[string]any{"text": noticeContent}},
|
||||
},
|
||||
Status: model.MessageStatusNormal,
|
||||
Category: model.CategoryNotification,
|
||||
|
||||
Reference in New Issue
Block a user