Re: [I] [Bug] skywalking-go enhance method reports error [skywalking]

2024-01-09 Thread via GitHub


wu-sheng closed issue #11739: [Bug] skywalking-go enhance method reports error
URL: https://github.com/apache/skywalking/issues/11739


-- 
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 enhance method reports error [skywalking]

2024-01-08 Thread via GitHub


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

   ### 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
   
   I try to develop a plugin for rocketMQ,there is an error when i build the 
file
   /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
   
   The enhanced method is in the`pushconsumer.go`
   `func (pc *pushConsumer) consumeInner(ctx context.Context, subMsgs 
[]*primitive.MessageExt) (ConsumeResult, error)`
   and `type ConsumeResult int` defined in the `consumer.go`,
   so when FilterAndEdit -> EnhanceParameterNames,  
MethodEnhance.ParameterInfo.DefaultValueAsString will be "nil" because it 
cannot determine the real type of the custom type.
   
   ### How to reproduce
   
   the enhanced file's default return value will result in a type error when 
custom type  is an integer
   such as
   ```
   {
   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",
   }
   ```
   and the enhanced file like 
   ```
   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