valast
valast copied to clipboard
Convert Go values to their AST
I like this :-) However, currently I am building an app based on a list of records where each record has several time.Time fields. Turns out dumping such fields produces...
Consider the following (minified) example program that tries to print a value of type [`font.Metrics`](https://pkg.go.dev/golang.org/x/image/font#Metrics): ```Go package main import ( "fmt" "log" "github.com/golang/freetype" "github.com/golang/freetype/truetype" "github.com/hexops/valast" "golang.org/x/image/font/gofont/gomono" ) func main() {...
time.Duration will cause ( missing ',' in argument list ) error i wrote a hack and it can work well. change method gofumptFormatExpr ``` func gofumptFormatExpr(w io.Writer, fset *token.FileSet, expr...
Today valast uses a dumb heuristic to determine if a string should be formatting as a Go `"string literal"` or ``` `raw string literal` ```: ``` if len(s) > 40...
Map keys are sorted according to regular Go rules, but a number of Go values cannot be sorted according to those rules. As it stands, valast will produce unstable output...
This change extends https://github.com/hexops/valast/pull/25 to allow _any_ type to be configured with a custom AST representation, and demonstrates this by migrating the existing `time.Time` handling to use this - see...