uber-go/fx

Support wasm

zodiac1214 opened this issue · 3 comments

Describe the bug
I am trying to generate a wasm build with fx:

GOOS=js GOARCH=wasm go build -o ../../dist/backend.wasm main.go                                 2 ↵  7109  21:33:33
# go.uber.org/fx
/Users/dzou/go/pkg/mod/go.uber.org/fx@v1.19.0/shutdown.go:104:13: undefined: _sigTERM
/Users/dzou/go/pkg/mod/go.uber.org/fx@v1.19.0/signal.go:117:42: undefined: _sigINT
/Users/dzou/go/pkg/mod/go.uber.org/fx@v1.19.0/signal.go:117:51: undefined: _sigTERM

Maybe relate to golang/go#28719

To Reproduce
use fx in any project and build with GOOS=js GOARCH=wasm

Expected behavior
It should support wasm build.

Additional context
Add any other context about the problem here.

@zodiac1214 thanks for reporting this issue. #1022 should fix this issue. We probably won't ship a release for this in a while, but you should be able to pin to the master branch of Fx once this gets merged to use that fix. Thanks.

Hi @sywhang !

I checked the fix and wrote the same code "app_wasm.go" in my local directory ~/go/pkg/mod/..../fx@v1.19.2.
But the error logs didn't change. How can I apply it ?

Thanks for your help in advance !

@Hoodie-Kang interesting, I'm not sure why the commit I closed didn't end up shipping with v1.19.2. Let me do a minor release soon (v1.19.3) and that should fix your issue. Thanks for reporting this issue.