This is an automated email from the ASF dual-hosted git repository.

LinkinStars pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/answer.git


The following commit(s) were added to refs/heads/dev by this push:
     new 37d73fa9 fix(lint): modernize notification test and transaction 
callback
37d73fa9 is described below

commit 37d73fa9f5fa1fa2f4fe25842f8ef70ef1d9baad
Author: LinkinStars <[email protected]>
AuthorDate: Tue Nov 3 17:18:38 2026 +0800

    fix(lint): modernize notification test and transaction callback
---
 internal/cli/fix_post.go                          | 2 +-
 internal/repo/repo_test/notification_repo_test.go | 8 +++-----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/internal/cli/fix_post.go b/internal/cli/fix_post.go
index 8a313983..8396c839 100644
--- a/internal/cli/fix_post.go
+++ b/internal/cli/fix_post.go
@@ -257,7 +257,7 @@ func applyUnitFix(x *xorm.Engine, result *fixResult, opts 
*FixURLPrefixOptions,
        if opts.DryRun {
                return nil
        }
-       _, err := x.Transaction(func(session *xorm.Session) (interface{}, 
error) {
+       _, err := x.Transaction(func(session *xorm.Session) (any, error) {
                for _, item := range fixable {
                        if err := item.update(session); err != nil {
                                return nil, err
diff --git a/internal/repo/repo_test/notification_repo_test.go 
b/internal/repo/repo_test/notification_repo_test.go
index 9bd640d9..5517ec27 100644
--- a/internal/repo/repo_test/notification_repo_test.go
+++ b/internal/repo/repo_test/notification_repo_test.go
@@ -82,10 +82,8 @@ func Test_notificationRepo_ClearIDUnReadConcurrent(t 
*testing.T) {
                errs      []error
        )
        start := make(chan struct{})
-       for i := 0; i < requestCount; i++ {
-               waitGroup.Add(1)
-               go func() {
-                       defer waitGroup.Done()
+       for range requestCount {
+               waitGroup.Go(func() {
                        <-start
                        rows, err := 
notificationRepo.ClearIDUnRead(context.TODO(), ent.UserID, ent.ID)
                        mutex.Lock()
@@ -95,7 +93,7 @@ func Test_notificationRepo_ClearIDUnReadConcurrent(t 
*testing.T) {
                                return
                        }
                        affected += rows
-               }()
+               })
        }
        close(start)
        waitGroup.Wait()

Reply via email to