Ethan-Xingyue opened a new issue, #1178:
URL: https://github.com/apache/incubator-seata-go/issues/1178

   ## 🚀 Go Version
   
   go1.24.3 darwin/arm64
   
   ## 📦 Seata-go Version
   
   master, commit 3bf73586af81db1bd428982c93d82000d80cb1c8 (fetched 2026-09-02)
   
   ## 💾 Operating System
   
   macOS
   
   ## 📝 Bug Description
   
   `go vet ./...` does not pass on master. The RocketMQ test helper 
`newTransactionMessageExt` builds a `primitive.MessageExt` with `Message: 
*msg`, copying a `primitive.Message` by value:
   
   
https://github.com/apache/incubator-seata-go/blob/3bf73586af81db1bd428982c93d82000d80cb1c8/pkg/integration/rocketmq/transaction_listener_test.go#L148-L157
   
   `primitive.Message` embeds a `sync.RWMutex`, so the copy also copies lock 
state (`copylocks`). Today the problem is confined to a test, but it blocks 
turning `go vet` into a CI gate and gives the test object different concurrency 
behaviour from a real message.
   
   Suggested priority: P2.
   
   ## 🔄 Steps to Reproduce
   
   ```bash
   git clone https://github.com/apache/incubator-seata-go.git
   cd incubator-seata-go
   git checkout 3bf73586af81db1bd428982c93d82000d80cb1c8
   go vet ./...
   echo "exit=$?"
   ```
   
   Minimal triggering code (from the test helper):
   
   ```go
   msg := primitive.NewMessage("topic", []byte("body"))
   _ = &primitive.MessageExt{Message: *msg}
   ```
   
   ## ✅ Expected Behavior
   
   `go vet ./...` exits 0; no helper copies a value that contains a lock.
   
   ## ❌ Actual Behavior
   
   ```text
   # seata.apache.org/seata-go/v2/pkg/integration/rocketmq
   # [seata.apache.org/seata-go/v2/pkg/integration/rocketmq]
   pkg/integration/rocketmq/transaction_listener_test.go:156:40: literal copies 
lock value from *msg: github.com/apache/rocketmq-client-go/v2/primitive.Message 
contains sync.RWMutex
   exit=1
   ```
   
   ## 💡 Possible Solution
   
   - Build the `MessageExt` through the RocketMQ client API, or copy only the 
lock-free fields the test needs. Do not work around it with a zero-value mutex, 
`//nolint`, or by disabling `copylocks`.
   - Add a dedicated `go vet ./...` CI job so vet failures are not buried in 
test output.
   
   Acceptance criteria:
   
   - [ ] `go vet ./...` passes for the whole repository.
   - [ ] RocketMQ tests pass and `go test -race` shows no new warnings.
   - [ ] No `//nolint`, disabled vet check, or copy of another lock-bearing 
struct is used to get there.


-- 
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