github.com/wasilibs/wazerox@v0.0.0-20240124024944-4923be63ab5f/experimental/gojs/README.md (about)

     1  # Overview
     2  
     3  When `GOOS=js` and `GOARCH=wasm`, Go's compiler targets WebAssembly Binary
     4  format (%.wasm).
     5  
     6  Wazero's "github.com/wasilibs/wazerox/experimental/gojs" package allows you to run
     7  a `%.wasm` file compiled by Go.  This is similar to what is implemented in
     8  [wasm_exec.js][1]. See https://wazero.io/languages/go/ for more.
     9  
    10  ## Example
    11  
    12  wazero includes an [example](example) that implements the `cat` utility.
    13  
    14  ## Experimental
    15  
    16  Go defines js "EXPERIMENTAL... exempt from the Go compatibility promise."
    17  Accordingly, wazero cannot guarantee this will work from release to release,
    18  or that usage will be relatively free of bugs. Moreover, [`GOOS=wasip1`][2]
    19  will be shipped in Go 1.21. wazero will remove this package after Go 1.22 is
    20  released.
    21  
    22  Due to these concerns and the relatively high implementation overhead, most
    23  will choose TinyGo instead of gojs.
    24  
    25  [1]: https://github.com/golang/go/blob/go1.20/misc/wasm/wasm_exec.js
    26  [2]: https://github.com/golang/go/issues/58141