From 7a78d76d85fb3347493c8b23639c4006515da781 Mon Sep 17 00:00:00 2001 From: Calvin Prewitt Date: Wed, 12 Aug 2026 16:56:09 -0500 Subject: [PATCH] Define terminalWidth on GOOS=wasip1 via the appengine/js stub On wasip1 (supported since Go 1.21), none of the existing terminalWidth implementations is selected: pb_x.go, pb_win.go, and pb_plan9.go are all gated to other platforms, and pb_appengine.go is limited to appengine and js. As a result any build of package pb for GOOS=wasip1 fails with: pb.go:427:9: undefined: terminalWidth pb.go:436:18: undefined: terminalWidth WASI preview 1 has no terminal-size API, so the appengine/js stub (return 0, "Not supported") is the correct behavior there too: callers such as GetWidth already fall back to the default width when terminalWidth returns an error. Verified with Go 1.21+: GOOS=wasip1 GOARCH=wasm now selects pb_appengine.go and 'go build' succeeds; file selection on all other platforms is unchanged. Co-Authored-By: Claude Fable 5 --- pb_appengine.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pb_appengine.go b/pb_appengine.go index 17168f3..e8dd9ea 100644 --- a/pb_appengine.go +++ b/pb_appengine.go @@ -1,11 +1,12 @@ -// +build appengine js +// +build appengine js wasip1 package pb import "errors" // terminalWidth returns width of the terminal, which is not supported -// and should always failed on appengine classic which is a sandboxed PaaS. +// and should always failed on appengine classic which is a sandboxed PaaS, +// and on wasip1 which has no terminal-size API. func terminalWidth() (int, error) { return 0, errors.New("Not supported") }