Skip to content

Commit 42bc112

Browse files
committed
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 <[email protected]>
1 parent 259bdeb commit 42bc112

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

enumerator/usb_wasm.go

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//
2+
// Copyright 2014-2024 Cristian Maglie. All rights reserved.
3+
// Use of this source code is governed by a BSD-style
4+
// license that can be found in the LICENSE file.
5+
//
6+
7+
package enumerator
8+
9+
func nativeGetDetailedPortsList() ([]*PortDetails, error) {
10+
return nil, &PortEnumerationError{}
11+
}

enumerator_wasm.go

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// Copyright 2014-2024 Cristian Maglie. All rights reserved.
3+
// Use of this source code is governed by a BSD-style
4+
// license that can be found in the LICENSE file.
5+
//
6+
7+
package serial
8+
9+
import (
10+
"errors"
11+
)
12+
13+
func nativeGetPortsList() ([]string, error) {
14+
return nil, errors.New("nativeGetPortsList is not supported on wasm")
15+
}

serial_wasm.go

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// Copyright 2014-2024 Cristian Maglie. All rights reserved.
3+
// Use of this source code is governed by a BSD-style
4+
// license that can be found in the LICENSE file.
5+
//
6+
7+
package serial
8+
9+
import (
10+
"errors"
11+
)
12+
13+
func nativeOpen(portName string, mode *Mode) (Port, error) {
14+
return nil, errors.New("nativeOpen is not supported on wasm")
15+
}

0 commit comments

Comments
 (0)