v1.4.0
This release is hot ๐ฅ like a torrid summer sun! ๐๏ธ
Let us all rejoyce: Go 1.21 is out!! We are now promoting the existing CI tests against the Go development branch to tests against the 1.21
stable release (#1616).
As you know may already know, we follow the Go support policy: i.e., we support each major Go release until there are two newer major releases: this means starting with the next release we will drop support for 1.18
!
In case you missed it, WasmCon 2023 is taking place in Bellevue, 5-6 September so if you happen to be there, you might bump into @evacchi, who will be there to deliver a talk on your favorite zero-dependency Wasm runtime for Go (yes, that's wazero).
If you won't be there, don't forget we always hang out in the gophers slack #wazero channel. Note: You may need an invite to join gophers. Regardless, if you like what we are doing, remember to star our repo because that's what the cool kids do ๐
In the meantime, let's take a look at what is new with this release. We have the usual influx of fixes and improvements and a major feature in experimental state: enter the Virtual File System API!
Virtual File System API
Thanks to a final spike before the release @codefromthecrypt, with a lil' help from @evacchi, completed this long-awaited feature, closing issue #1013.
It is now possible to configure a virtual file system using a lower-level API under experimental/sysfs
, experimental/sys
. In order to configure a custom file system you can type:
import(
"github.com/tetratelabs/wazero/experimental/sys"
"github.com/tetratelabs/wazero/experimental/sysfs"
)
...
cfg := wazero.NewModuleConfig().
WithFSConfig(wazero.NewFSConfig().(sysfs.FSConfig).
WithSysFSMount(<experimentalsys.FS>, <guestPath>))
This lower-level API gives a higher degree of control over lower-level FS operations, as compared to fs.FS
, and ensure cross-platform portability. It handles experimentalsys.File
instances (instead fs.File
or os.File
) and returns experimentalsys.Errno
in case of error.
For instance, sysfs.DirFS
is equivalent to os.DirFS
and may be instantiated with:
fs := sysfs.DirFS("/some/path")
AdaptFS
adapts an fs.FS
:
adapted = &sysfs.AdaptFS{FS: fs}
You can also embed most of these types in your struct to provide default behavior to your own implemementation; for instance ReadFS
provides a read-only view over a file system; there is also an experimentalsys.UnimplementedFS
(returning experimentalsys.ENOSYS
for most operations) that should be always embedded in your own implementation for forward compatibility. You can find examples under experimental/sysfs
.
Notably, the Virtual File System implementation does not currently expose methods to override blocking/nonblocking behavior; during this release @evacchi and @codefromthecrypt collaborated on these internals (#1596, #1597, #1599, #1604, #1612, #1613), including the wasip1
poll_oneoff
implementation, which was improved and simplified. Related File
APIs may eventually be exposed to the VFS layer as well.
Cross-Compilation Improvements
It is now possible to build wazero successfully on GOOS=plan9
(@codefromthecrypt #1603), incidentally, this also makes it possible to build on GOOS=js
(@mathetake, #1614) and GOOS=wasip1
: yes we heard you like wazero, so now you can put wazero in your wazero so YOU CAN WASM WHILE YOU WASM.
Other Contributions
-
@panchen66 discovered a memory leak (#1600) happening when repeatedly re-instantiating a module. @ncruces and @achille-roussel tag-teamed (#1608, #1609) a simplified reproducer and a solution. Huge thanks!
-
@anuraaga contributed a fix to the amd64 compiler in case of error, and some doc corrections (#1593, #1593)
-
Other fixes to the documentation
- TinyGo docs (@codefromthecrypt, #1590)
- Updated specs.md with
sock_*
(@evacchi, #1598) - Fixed paths in README.md (sho-hata, #1591)