I am new to Go. I need to know about the ParseFile function in module go/parser. I see very less information in the documentation. Has anybody know its detailed explanation. This is the link Parser documentation.. Waiting for a good reply.
Thanks
I am new to Go. I need to know about the ParseFile function in module go/parser. I see very less information in the documentation. Has anybody know its detailed explanation. This is the link Parser documentation.. Waiting for a good reply.
Thanks
Hi, @Harshcs517, welcome to the forum.
Did you see/try ParseFile
's example? What additional information are you looking for?
Hi, @skillian I was looking for the for functionalities than import. I can only see the working of one mode. How to see working of other modes and how to depict their outputs?
go/parser.ParseFile
returns an *ast.File
value. The documentation for that type can be found in the go/ast
package. There you can find variable, function and type declarations, etc.
Are you trying to generate code? If so, I highly recommend reviewing the stringer
source code here and if you’re new to it, Francesc Campoy’s Just For Func videos on parsing, here.
Ok, I will see to that. Actually I am trying to parse go source code and need to extract things from that. I was just seeing around the parsers in Go, before implementing my own parser for minework. Is this only parser in Go? Or there some other file parsers implementation there?
The package is specifically for parsing Go source code. It isn’t a parser generator.
Ok I will se to it. thanks.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.