Skip to content

Select the fallback on wasip1/wasip2 - #213

Open
calvinrp wants to merge 1 commit into
muesli:masterfrom
calvinrp:wasip1-fallback
Open

Select the fallback on wasip1/wasip2#213
calvinrp wants to merge 1 commit into
muesli:masterfrom
calvinrp:wasip1-fallback

Conversation

@calvinrp

Copy link
Copy Markdown

Hi, and thanks for maintaining termenv!

Since Go 1.21 added GOOS=wasip1 (WASI preview 1), building termenv for the WASI platforms fails, because none of the per-platform files is selected there:

output.go:143:11: undefined: (Output).foregroundColor
output.go:162:11: undefined: (Output).backgroundColor
termenv.go:36:15: undefined: (Output).ColorProfile
termenv.go:103:9: undefined: EnableVirtualTerminalProcessing

termenv_unix.go/termenv_solaris.go/termenv_windows.go cover the concrete OSes, and the fallback termenv_other.go is gated js || plan9 || aix only. This breaks downstream users on wasip1 — for example gh (github.com/cli/cli) and the glow/bubbletea stack.

WASI has no terminal status queries either, so the existing fallback (ANSI256 profile, default fg/bg, no-op VT toggle) is the correct behavior there as well. This PR just adds wasip1 and wasip2 to the fallback's build tags, matching the file's existing tag style.

Verified:

  • GOOS=wasip1 GOARCH=wasm go build ./... now succeeds, selecting termenv_other.go
  • file selection on linux/darwin/windows/js is unchanged

🤖 Generated with Claude Code

Building termenv for GOOS=wasip1 (added in Go 1.21) fails with
undefined ColorProfile/foregroundColor/backgroundColor/
EnableVirtualTerminalProcessing: the per-GOOS files cover the concrete
OSes and termenv_other.go is gated js || plan9 || aix only. WASI has
no terminal control either, so the same fallback is correct there; add
wasip1 and wasip2 to its build tags, matching the file's tag style.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant