Copilot commented on code in PR #984:
URL: https://github.com/apache/dubbo-go-pixiu/pull/984#discussion_r3425051557


##########
admin/core/server.go:
##########
@@ -64,23 +63,27 @@ func RunServer() {
 
        s := initServer(address, router)
 
-       var wg util.WaitGroupWrapper
+       var wg sync.WaitGroup
 
-       wg.AddAndRun(func() {
+       wg.Add(1)
+       go func() {
+               defer wg.Done()
                global.LOG.Info("server run success on ", zap.String("address", 
address))
                fmt.Printf(helperInfo, address)
 
                if err := s.ListenAndServe(); err != nil && err != 
http.ErrServerClosed {
                        global.LOG.Error(err.Error())
                }

Review Comment:
   Using `err != http.ErrServerClosed` can incorrectly log an error if the 
returned error wraps `http.ErrServerClosed`. Prefer `!errors.Is(err, 
http.ErrServerClosed)` (with the standard `errors` package) to avoid 
false-positive error logs during normal shutdown.



##########
admin/core/server.go:
##########
@@ -24,8 +24,7 @@ import (
 
 import (
        "go.uber.org/zap"
-
-       "v.marlon.life/toolkit/util"
+       "sync"
 )
 
 import (

Review Comment:
   This introduces (or preserves) multiple separate `import` blocks next to 
each other, which is non-idiomatic in Go and can cause churn and merge 
conflicts. Consider merging imports into a single `import (...)` block (and 
running `gofmt`) so the import section is normalized and consistently ordered.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to