Skip to content

Commit

Permalink
fix: add shims for GOARCH=wasm with GOOS=js and GOOS=wasip1
Browse files Browse the repository at this point in the history
Fixes build errors:

GOOS=js GOARCH=wasm go build
GOOS=wasip1 GOARCH=wasm go build

Signed-off-by: Christian Stewart <[email protected]>
  • Loading branch information
paralin committed Mar 1, 2024
1 parent 259bdeb commit 42bc112
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
11 changes: 11 additions & 0 deletions enumerator/usb_wasm.go
Original file line number Diff line number Diff line change
@@ -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{}
}
15 changes: 15 additions & 0 deletions enumerator_wasm.go
Original file line number Diff line number Diff line change
@@ -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")
}
15 changes: 15 additions & 0 deletions serial_wasm.go
Original file line number Diff line number Diff line change
@@ -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")
}

0 comments on commit 42bc112

Please sign in to comment.