Skip to content

fix: use proto.Merge to avoid copylocks with use_opaque_api=true#6383

Merged
johanbrandhorst merged 1 commit intogrpc-ecosystem:mainfrom
emahiro:fix/opaque-api-copylocks
Feb 19, 2026
Merged

fix: use proto.Merge to avoid copylocks with use_opaque_api=true#6383
johanbrandhorst merged 1 commit intogrpc-ecosystem:mainfrom
emahiro:fix/opaque-api-copylocks

Conversation

@emahiro
Copy link
Copy Markdown
Contributor

@emahiro emahiro commented Feb 19, 2026

Summary

When use_opaque_api=true , the generated protoReq = bodyData copies protoimpl.MessageState (which contains sync.Mutex ), triggering go vet copylocks . Replace with proto.Merge(&protoReq, &bodyData) .

Changes

  • protoc-gen-grpc-gateway/internal/gengateway/template.go: Replace value
    assignment with proto.Merge to avoid copying protoimpl.MessageState
    (which embeds sync.Mutex)
  • Regenerated *.pb.gw.go examples

References to other Issues or PRs

  When use_opaque_api=true, the generated protoReq = bodyData copies
  protoimpl.MessageState (which contains sync.Mutex), triggering
  go vet copylocks. Replace with proto.Merge(&protoReq, &bodyData).

  Fixes grpc-ecosystem#6380
Copy link
Copy Markdown
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants