Closed paralin closed 3 months ago
@paralin what's the purpose of this patch? since nativeOpen
is not implemented the library will not be available on wasm
anyway.
When the library is used as a dependency it is best to have it compile cleanly when that GOOS is used with stubs that return errors instead of failing to build entirely. This is for a dependency of https://github.com/aperturerobotics/bifrost
@paralin I'd like to ask you these changes:
Remove the files with the shims for js
and wasip1
.
Since both OS/ARCH pairs wasm/js
and wasm/wasip1
belongs to the same ARCH wasm
, it should be possible to reduce the number of files by simply leveraging the selection on the OS //go:build wasm
.
Remove the go:build
flags.
I think we could avoid the go:build
tags altogether by simply naming the source file with the suffix *_wasm.go
.
If a file's name, after stripping the extension and a possible _test suffix,
matches any of the following patterns:
_GOOS _GOARCH *_GOOS_GOARCH (example: source_windows_amd64.go) where GOOS and GOARCH represent any known operating system and architecture values respectively, then the file is considered to have an implicit build constraint requiring those terms (in addition to any explicit constraints in the file).
3. Please add the license header to all files.
You were right on the build tags, I fixed the PR according to your request.
Fixes build errors:
GOOS=js GOARCH=wasm go build GOOS=wasip1 GOARCH=wasm go build