zealotjx opened a new issue, #11753:
URL: https://github.com/apache/skywalking/issues/11753

   ### 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
   
   When using go agent to enhance a function with multiple parameters of the 
same type, if the following writing method is used in the function: `func 
myFunc(x, y, z string) {}`, it can only be obtained `in invocation.Args() `of 
`Interceptor.BeforeInvoke` a parameter `x`
   
   ### What you expected to happen
   
   I think we should be able to get the three parameters x, y and z
   
   ### How to reproduce
   
   Enhance a function like the following
     `func myFunc(x, y, z string) {}`
   
   ### Anything else
   
   我查看源码发现遍历dst.Field.Names时,使用了break,此处是否应该为continue
   
   `func EnhanceParameterNames(fields *dst.FieldList, fieldType FieldListType) 
[]*ParameterInfo {
        if fields == nil {
                return nil
        }
        result := make([]*ParameterInfo, 0)
        for i, f := range fields.List {
                var defineName string
                switch fieldType {
                case FieldListTypeParam:
                        defineName = fmt.Sprintf("skywalking_param_%d", i)
                case FieldListTypeResult:
                        defineName = fmt.Sprintf("skywalking_result_%d", i)
                case FieldListTypeRecv:
                        defineName = fmt.Sprintf("skywalking_recv_%d", i)
                }
                if len(f.Names) == 0 {
                        f.Names = []*dst.Ident{{Name: defineName}}
                        result = append(result, newParameterInfo(defineName, 
f.Type))
                } else {
                        for _, n := range f.Names {
                                if n.Name == "_" {
                                        *n = *dst.NewIdent(defineName)
                                        break
                                }
                        }
   
                        for _, n := range f.Names {
                                result = append(result, 
newParameterInfo(n.Name, f.Type))
                                break
                        }
                }
        }
        return result
   }`
   
   ### Are you willing to submit a pull request to fix on your own?
   
   - [X] 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: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to