71779310b71df38193baa7b05bdb0a8de6722407
A <<- heredoc nested inside a command substitution that is itself inside another <<- heredoc was printed with its body fully deindented and its end marker pushed one extra tab further per body line. When both heredocs use tab indentation, the printer wraps each body in an extraIndenter. In the nested case the inner extraIndenter writes to the outer one. Its computed indentation was emitted via WriteByte (which the outer extraIndenter processes line by line), but the line content was emitted via Write, whose method set is promoted straight to the embedded writer and so bypassed the outer extraIndenter entirely. The content reached the tab writer without the outer indentation, while the orphaned indentation bytes stayed buffered and leaked onto the following end-marker line. Emit the trimmed content through WriteString so nested extraIndenters compose, keeping both the body and the end marker correctly indented. Add printer golden tests for single- and multi-line nested tab heredocs.
Languages
Go
100%