mvdan / sh

A shell parser, formatter, and interpreter with bash support; includes shfmt
https://pkg.go.dev/mvdan.cc/sh/v3
BSD 3-Clause "New" or "Revised" License
6.97k stars 332 forks source link

DebugPrint: Print the string value of tokens #1075

Closed theclapp closed 2 months ago

theclapp commented 2 months ago

In DebugPrint, if a value implements fmt.Stringer, and isn't a zero value, display its string value in addition to the default %#v format.

For the most part, this prints the string value of "tokens", e.g. for a syntax.Redirect.Op, instead of "Op: 0x3b", you get "Op: 0x3b (>&)".