Skip to content

chore: remove github.com/buger/goterm dependency - #14180

Open
thaJeztah wants to merge 1 commit into
docker:mainfrom
thaJeztah:drop_goterm
Open

chore: remove github.com/buger/goterm dependency#14180
thaJeztah wants to merge 1 commit into
docker:mainfrom
thaJeztah:drop_goterm

Conversation

@thaJeztah

Copy link
Copy Markdown
Member

Replace goterm's terminal size detection with golang.org/x/term, which provides the same functionality and is already an indirect dependency.

Use the existing github.com/morikuni/aec dependency for clearing the current terminal line.

What I did

Related issue

(not mandatory) A picture of a cute animal, if possible in relation to what you did

Replace goterm's terminal size detection with golang.org/x/term, which
provides the same functionality and is already an indirect dependency.

Use the existing github.com/morikuni/aec dependency for clearing the
current terminal line.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah
thaJeztah requested review from a team as code owners September 4, 2026 17:57
@thaJeztah
thaJeztah requested review from glours and ndeloof September 4, 2026 17:57

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assessment: 🟢 APPROVE

This PR cleanly removes the github.com/buger/goterm dependency by substituting:

  • golang.org/x/term for terminal size detection (term.GetSize)
  • github.com/morikuni/aec for line erasure (aec.EraseLine(aec.EraseModes.Tail))

The replacement is functionally equivalent:

  • aec.EraseLine(aec.EraseModes.Tail) emits \033[K which, combined with the explicit \r, produces the same \r\033[K sequence as goterm.RESET_LINE
  • The combined fallback to 80×24 when term.GetSize fails is a reasonable policy (previously width and height were guarded independently, but both falling back was already the expected behaviour)
  • Division-by-zero in extraLines() is guarded by the width <= 0 check in getTermSize()
  • golang.org/x/term is correctly promoted from indirect to direct dependency in go.mod

No bugs were introduced.

@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 30.76923% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/formatter/shortcut.go 0.00% 9 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

2 participants