From 7165f5e779a587f37fff841ecbae4d6bce9a2aa1 Mon Sep 17 00:00:00 2001 From: Flavio Castelli Date: Wed, 31 May 2023 19:17:20 +0200 Subject: [PATCH 1/2] Add WASI wasip1 support Fix building when the new `wasip1` port is being used. This is a new target that will be introduced by go 1.21. For more details https://github.com/golang/go/issues/58141 Signed-off-by: Flavio Castelli --- terminal_check_wasip1.go | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 terminal_check_wasip1.go diff --git a/terminal_check_wasip1.go b/terminal_check_wasip1.go new file mode 100644 index 0000000..108a6be --- /dev/null +++ b/terminal_check_wasip1.go @@ -0,0 +1,8 @@ +//go:build wasip1 +// +build wasip1 + +package logrus + +func isTerminal(fd int) bool { + return false +} From 032a334035bf4a394f36d66e2bfb144b000ebb41 Mon Sep 17 00:00:00 2001 From: Flavio Castelli Date: Tue, 6 Jun 2023 11:51:37 +0200 Subject: [PATCH 2/2] Support building with Tinygo and target `wasi` Enable building using the tinygo compiler, together with the `wasi` target. This combination requires different handling compared to go >= 1.21 and the `wasip1` target. That's because Tinygo compiles using the GOOS set to `linux` and the `GOARCH` set to `wasi`. Signed-off-by: Flavio Castelli --- terminal_check_unix.go | 2 ++ terminal_check_wasi.go | 8 ++++++++ 2 files changed, 10 insertions(+) create mode 100644 terminal_check_wasi.go diff --git a/terminal_check_unix.go b/terminal_check_unix.go index 04748b8..c9aed26 100644 --- a/terminal_check_unix.go +++ b/terminal_check_unix.go @@ -1,5 +1,7 @@ +//go:build (linux || aix || zos) && !js && !wasi // +build linux aix zos // +build !js +// +build !wasi package logrus diff --git a/terminal_check_wasi.go b/terminal_check_wasi.go new file mode 100644 index 0000000..2822b21 --- /dev/null +++ b/terminal_check_wasi.go @@ -0,0 +1,8 @@ +//go:build wasi +// +build wasi + +package logrus + +func isTerminal(fd int) bool { + return false +}