Skip to content

Comments

log/term: fix build on GOOS=js GOARCH=wasm#993

Merged
peterbourgon merged 1 commit intogo-kit:masterfrom
mvdan:log-term-wasm
Jul 10, 2020
Merged

log/term: fix build on GOOS=js GOARCH=wasm#993
peterbourgon merged 1 commit intogo-kit:masterfrom
mvdan:log-term-wasm

Conversation

@mvdan
Copy link
Contributor

@mvdan mvdan commented Jul 9, 2020

Before this fix, the build would fail, as IsTerminal isn't defined on
that platform:

$ GOOS=js GOARCH=wasm go build
# github.com/go-kit/kit/log/term
./term.go:14:6: undefined: IsTerminal

The reason is pretty simple; js/wasm doesn't have syscalls, and thus it
doesn't have an "is a terminal" syscall.

Grouping it with appengine to always assume that the output is not a
terminal is good enough for now, as it at least makes the package build.

No change is needed in any other file, because none of the other
IsTerminal +build lines include js/wasm in any way.

Before this fix, the build would fail, as IsTerminal isn't defined on
that platform:

	$ GOOS=js GOARCH=wasm go build
	# github.com/go-kit/kit/log/term
	./term.go:14:6: undefined: IsTerminal

The reason is pretty simple; js/wasm doesn't have syscalls, and thus it
doesn't have an "is a terminal" syscall.

Grouping it with appengine to always assume that the output is not a
terminal is good enough for now, as it at least makes the package build.

No change is needed in any other file, because none of the other
IsTerminal +build lines include js/wasm in any way.
@mvdan
Copy link
Contributor Author

mvdan commented Jul 9, 2020

I realise that go-kit probably doesn't support js/wasm explicitly right now, but I have a dependency that indirectly ends up depending on your log packages, for better or worse. And there really isn't a reason why a log package should require an "is a terminal" syscall to work.

@peterbourgon
Copy link
Member

Fine by me!

@peterbourgon peterbourgon merged commit 02c7c01 into go-kit:master Jul 10, 2020
@sagikazarmark sagikazarmark added this to the v0.11.0 milestone Jun 19, 2021
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.

3 participants