Re: [I] [Bug] skywalking-go 无法增强返回自定义类型的方法 [skywalking]

2024-01-08 Thread via GitHub


wu-sheng closed issue #11738: [Bug] skywalking-go 无法增强返回自定义类型的方法
URL: https://github.com/apache/skywalking/issues/11738


-- 
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: notifications-unsubscr...@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [I] [Bug] skywalking-go 无法增强返回自定义类型的方法 [skywalking]

2024-01-08 Thread via GitHub


wu-sheng commented on issue #11738:
URL: https://github.com/apache/skywalking/issues/11738#issuecomment-1882349847

   Please submit an issue in English. 
   If you need Chinese discussion, please go to Slack CN Channel.


-- 
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: notifications-unsubscr...@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[I] [Bug] skywalking-go 无法增强返回自定义类型的方法 [skywalking]

2024-01-08 Thread via GitHub


Ruff-nono opened a new issue, #11738:
URL: https://github.com/apache/skywalking/issues/11738

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Apache SkyWalking Component
   
   OAP server (apache/skywalking)
   
   ### What happened
   
   在开发rocketMQ插件时,报错
   /tmp/go-build612827965/b348/skywalking_delegator.go:46:10: cannot use nil as 
ConsumeResult value in return statement
   /tmp/go-build612827965/b348/skywalking_delegator.go:59:9: cannot use nil as 
ConsumeResult value in return statement
   /tmp/go-build612827965/b348/skywalking_delegator.go:80:13: cannot use nil as 
ConsumeResult value in assignment
   
   
   
   ### What you expected to happen
   
   增强方法func (pc *pushConsumer) consumeInner(ctx context.Context, subMsgs 
[]*primitive.MessageExt) (ConsumeResult, error)位于pushconsumer.go
   而type ConsumeResult int定义在consumer.go文件中
   在FilterAndEdit -> 
EnhanceParameterNames时,无法判断出真实类型,DefaultValueAsString返回为"nil"
   
   ### How to reproduce
   
   增强方法返回值为自定义类型且为int时,增强文件的返回默认值会类型错误
   {
PackagePath: "consumer",
At: instrument.NewMethodEnhance("*pushConsumer", 
"consumeInner",
instrument.WithArgsCount(2),
instrument.WithArgType(0, "context.Context"),
instrument.WithArgType(1, 
"[]*primitive.MessageExt"),
instrument.WithResultCount(2),
instrument.WithResultType(0, "ConsumeResult"),
instrument.WithResultType(1, "error")),
Interceptor: "ConsumeInnerInterceptor",
}
   增强返回如
   if invocation.isContinue {
if invocation.returnValues[0] != nil {
*ret_0 = (invocation.returnValues[0]).(ConsumeResult)
} else {
*ret_0 = nil
}
   }
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit a pull request to fix on your own?
   
   - [ ] Yes I am willing to submit a pull request on my own!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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: 
notifications-unsubscr...@skywalking.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org