Oh yes! Thank you so much :)

On Saturday, 18 September 2021 at 19:23:17 UTC+1 seank...@gmail.com wrote:

> I believe the Recv field does what you want?
>
> On Saturday, September 18, 2021 at 8:20:19 PM UTC+2 tjgur...@gmail.com 
> wrote:
>
>> Hi,
>>
>> I was working on a tool for internal use where I had to work with the 
>> go's abstract syntax tree specially with the FuncDecls. I wanted to filter 
>> the ast to only function declarations without methods. I was wondering if 
>> there is a way to distinguish between normal functions and structure 
>> methods. I'm sure there must be a way since the godoc distinguishes them 
>> but don't know if they had to implement it in a certain way.
>>
>> Currently my code uses AST's inspect function and traverses the tree. 
>> Example, 
>>
>> ```Go
>> ast.Inspect(syntaxtTree,  func(n *ast.Node) bool {
>>     ...
>>     switch x := n.(type) {
>>     case *ast.FuncDecl:
>>         ...    
>> }
>> ```
>>
>> If anyone knows a way to distinguish these, please do let me know. Thanks!
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/78d31310-6863-4c3a-8451-64a4e9bf44c4n%40googlegroups.com.

Reply via email to