Copilot commented on code in PR #1111:
URL: https://github.com/apache/dubbo-go-samples/pull/1111#discussion_r3400176001
##########
task/shop/frontend/server_v1/server.go:
##########
@@ -126,22 +126,22 @@ func (s *ShopServiceProvider) CheckItem(sku int64,
username string) (*detailAPI.
Sku: sku,
UserName: username,
}
- // add tag
- ctx := context.Background()
- atm := map[string]string{
- "dubbo.tag": "gray",
- "dubbo.force.tag": "true",
- }
- ctx = context.WithValue(ctx, constant.AttachmentKey, atm)
- return s.detailService.GetItem(ctx, req)
+ return s.detailService.GetItem(context.Background(), req)
}
func (s *ShopServiceProvider) CheckItemGray(sku int64, username string)
(*detailAPI.Item, error) {
req := &detailAPI.GetItemReq{
Sku: sku,
UserName: username,
}
- return s.detailService.GetItem(context.Background(), req)
+ // add tag for gray routing
+ ctx := context.Background()
+ atm := map[string]string{
+ "dubbo.tag": "gray",
+ "dubbo.force.tag": "true",
+ }
Review Comment:
Tag routing attachments use hard-coded keys ("dubbo.tag" /
"dubbo.force.tag"). This is easy to mistype and diverges from other tag-router
samples in this repo which use dubbo-go constants (e.g., constant.Tagkey /
constant.ForceUseTag). Using the constants improves consistency and protects
against future key changes.
--
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]