apache / rocketmq-client-go

Apache RocketMQ go client
https://rocketmq.apache.org/
Apache License 2.0
1.3k stars 416 forks source link

fix some errors reported by go vet #959

Open yandongxiao opened 1 year ago

yandongxiao commented 1 year ago

What is the purpose of the change

fix some errors reported by go vet

Brief changelog

go vet ./...

# github.com/apache/rocketmq-client-go/v2/producer
producer/producer.go:280:23: literal copies lock value from *msg: github.com/apache/rocketmq-client-go/v2/primitive.Message contains sync.RWMutex
# github.com/apache/rocketmq-client-go/v2/internal/remote
internal/remote/codec.go:136:33: method WriteTo(w io.Writer) error should have signature WriteTo(io.Writer) (int64, error)
internal/remote/remote_client_test.go:164:4: call to (*T).Fatalf from a non-test goroutine
internal/remote/remote_client_test.go:340:4: call to (*T).Fatalf from a non-test goroutine
# github.com/apache/rocketmq-client-go/v2/consumer
consumer/lock.go:34:10: fetchLock passes lock by value: github.com/apache/rocketmq-client-go/v2/consumer.QueueLock contains sync.Map contains sync.Mutex
# github.com/apache/rocketmq-client-go/v2/internal
internal/trace.go:246:2: the cancel function is not used on all paths (possible context leak)
internal/trace.go:285:3: this return statement may be reached without using the cancel var defined on line 246
codecov-commenter commented 1 year ago

Codecov Report

Merging #959 (5233fee) into master (6bbfc3f) will decrease coverage by 0.00%. The diff coverage is 25.00%.

@@            Coverage Diff             @@
##           master     #959      +/-   ##
==========================================
- Coverage   23.45%   23.44%   -0.01%     
==========================================
  Files          52       52              
  Lines        7227     7229       +2     
==========================================
  Hits         1695     1695              
- Misses       5300     5301       +1     
- Partials      232      233       +1     
Impacted Files Coverage Δ
consumer/lock.go 40.00% <0.00%> (ø)
internal/trace.go 28.47% <0.00%> (ø)
primitive/ctx.go 0.00% <ø> (ø)
producer/producer.go 28.07% <0.00%> (ø)
internal/remote/codec.go 59.09% <25.00%> (-0.46%) :arrow_down:
internal/remote/remote_client.go 51.53% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more