From 42bc112d18a52424bbf6546a4e0af53f5158bdcc Mon Sep 17 00:00:00 2001 From: Christian Stewart Date: Tue, 20 Feb 2024 15:46:44 -0800 Subject: [PATCH] fix: add shims for GOARCH=wasm with GOOS=js and GOOS=wasip1 Fixes build errors: GOOS=js GOARCH=wasm go build GOOS=wasip1 GOARCH=wasm go build Signed-off-by: Christian Stewart --- enumerator/usb_wasm.go | 11 +++++++++++ enumerator_wasm.go | 15 +++++++++++++++ serial_wasm.go | 15 +++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 enumerator/usb_wasm.go create mode 100644 enumerator_wasm.go create mode 100644 serial_wasm.go diff --git a/enumerator/usb_wasm.go b/enumerator/usb_wasm.go new file mode 100644 index 0000000..3f3b22f --- /dev/null +++ b/enumerator/usb_wasm.go @@ -0,0 +1,11 @@ +// +// Copyright 2014-2024 Cristian Maglie. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// + +package enumerator + +func nativeGetDetailedPortsList() ([]*PortDetails, error) { + return nil, &PortEnumerationError{} +} diff --git a/enumerator_wasm.go b/enumerator_wasm.go new file mode 100644 index 0000000..349d272 --- /dev/null +++ b/enumerator_wasm.go @@ -0,0 +1,15 @@ +// +// Copyright 2014-2024 Cristian Maglie. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// + +package serial + +import ( + "errors" +) + +func nativeGetPortsList() ([]string, error) { + return nil, errors.New("nativeGetPortsList is not supported on wasm") +} diff --git a/serial_wasm.go b/serial_wasm.go new file mode 100644 index 0000000..b2369f1 --- /dev/null +++ b/serial_wasm.go @@ -0,0 +1,15 @@ +// +// Copyright 2014-2024 Cristian Maglie. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// + +package serial + +import ( + "errors" +) + +func nativeOpen(portName string, mode *Mode) (Port, error) { + return nil, errors.New("nativeOpen is not supported on wasm") +}