Skip to content

syntax: preserve indentation in nested tab heredocs - #1408

Closed
err0r4eve3 wants to merge 1 commit into
mvdan:masterfrom
err0r4eve3:fix/nested-tab-heredoc
Closed

err0r4eve3 wants to merge 1 commit into
mvdan:masterfrom
err0r4eve3:fix/nested-tab-heredoc

Conversation

@err0r4eve3

Copy link
Copy Markdown

Summary

  • route byte-slice writes through extraIndenter.WriteByte, matching its existing string path
  • add a regression case for nested <<- heredocs

The bug is specific to nesting because an inner extraIndenter flushes each completed line with e.bufWriter.Write. When that underlying writer is an outer extraIndenter, its embedded Write method was promoted and bypassed the outer writer's per-line indentation state. Implementing Write on extraIndenter keeps every writer entry point on the same path.

Test

  • go test ./...

Fixes #1403

@milhnl

milhnl commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

?

@mvdan

mvdan commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Let's pretend you did not just copy paste someone else's patch and put your name on it.

@mvdan mvdan closed this Aug 30, 2026
@err0r4eve3

Copy link
Copy Markdown
Author

You are right. This PR reproduced the patch @milhnl had already posted in #1403, including the regression test, and I failed to credit that source before submitting it. I apologize to @milhnl and the maintainers. The attribution failure is entirely mine. The PR is closed, and I will not submit further work to this repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nested tab heredoc formatting bug

3 participants