I'm walking around syntax tree in Go, trying to find all calls to some particular function and then get its string argument (it's a file name, and should be string literal, not any other identifier). I'm succeeded with this, and now I have ast.BasicLit
node with Kind == token.STRING
, but its value is Go code, not a value of the string that it should have.
I found question that answers how to do reverse transformation - from string to go code it represents: golang: given a string, output an equivalent golang string literal
But I want the opposite - something like eval function (but just for Go string literals).