You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to generate some code using dst package.
Part of the code involves multi-line string literal.
I'd like to keep the code prettier by propagating the indentation level into the string literal
funcGeneratedFunc() {
node:=mypackage.MyFunc(`multilineliteral`) // <-- This non-indent looks rather bothering
}
Is it possible that I can make the string literal indent aligned with the caller, or somehow retrieve the 'indentation level' via the dst package, so that I can manually Tweak the literal? e.g.
funcGeneratedFunc() {
node:=mypackage.MyFunc(` multi line literal `)
}
The text was updated successfully, but these errors were encountered:
Aah unfortunately dst knows nothing of the indentation level. When we render the output we just convert the dst nodes to ast nodes and feed the output through the standard Go printer. This automatically adds the indents.
I'm trying to generate some code using dst package.
Part of the code involves multi-line string literal.
I'd like to keep the code prettier by propagating the indentation level into the string literal
The generated code will look like
Is it possible that I can make the string literal indent aligned with the caller, or somehow retrieve the 'indentation level' via the dst package, so that I can manually Tweak the literal? e.g.
The text was updated successfully, but these errors were encountered: