diskfs / go-diskfs

MIT License
494 stars 112 forks source link

Be able to compile to webassembly wasm #207

Closed rgl closed 8 months ago

rgl commented 8 months ago

It would be pretty nice to be able to target wasm.

Currently with with go 1.21.5 and go-diskfs 1.4.0. a simple program that creates a FAT32 disk image, is failing as:

GOOS=wasip1 GOARCH=wasm go build -o amt-setupbin-img.wasm
# gopkg.in/djherbis/times.v1
../../../../go/pkg/mod/gopkg.in/djherbis/times.v1@v1.3.0/times.go:11:9: undefined: getTimespec
../../../../go/pkg/mod/gopkg.in/djherbis/times.v1@v1.3.0/times.go:21:9: undefined: getTimespec
# github.com/sirupsen/logrus
../../../../go/pkg/mod/github.com/sirupsen/logrus@v1.9.3/terminal_check_notappengine.go:13:10: undefined: isTerminal
# github.com/diskfs/go-diskfs/filesystem/squashfs
../../../../go/pkg/mod/github.com/diskfs/go-diskfs@v1.4.0/filesystem/squashfs/finalize.go:463:22: undefined: getFileProperties
../../../../go/pkg/mod/github.com/diskfs/go-diskfs@v1.4.0/filesystem/squashfs/finalize.go:1177:25: undefined: getDeviceNumbers
../../../../go/pkg/mod/github.com/diskfs/go-diskfs@v1.4.0/filesystem/squashfs/finalize.go:1202:25: undefined: getDeviceNumbers
deitch commented 8 months ago

It would be nice, indeed, to have a wasm target for it (it also would be nice if this didn't auto-correct "wasm" to "warm" 😁 ).

Of the issues you raised:

rgl commented 8 months ago

Thank you! I will look into your suggestions and will report back!

rgl commented 8 months ago

@deitch got it working at https://github.com/diskfs/go-diskfs/pull/208 :-)

please take a look.