Home > Software engineering >  Go: Get filepath from ast.File
Go: Get filepath from ast.File

Time:07-12

Assume I have:

f, err := parser.ParseFile(fset, srcPath, nil, 0)

How can I get back the srcPath from f?

CodePudding user response:

Use fset.Position(f.Package).Filename to get srcPath from f.

  • Related