Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
lthibault committed Oct 15, 2024
1 parent be9c98e commit c3a4d80
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 27 deletions.
9 changes: 6 additions & 3 deletions cmd/internal/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,15 @@ func run() cli.ActionFunc {
}
defer d.Close()

// fetches <path> for `ww run <path>`
bootloader := unixFSNode{
Name: c.Args().First(),
Unix: ipfs.Unixfs()}

return ww.Env{
IPFS: ipfs,
Host: h,
Boot: unixFSNode{
Name: c.Args().Get(1),
Unix: ipfs.Unixfs()},
Boot: bootloader,
WASM: wazero.NewRuntimeConfig().
WithDebugInfoEnabled(c.Bool("debug")).
WithCloseOnContextDone(true),
Expand Down
3 changes: 2 additions & 1 deletion examples/hello-world/main.go → examples/echo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
package main

import (
"io"
"os"
)

func main() {
os.Exit(0)
io.Copy(os.Stdout, os.Stdin)
}
Binary file added examples/echo/main.wasm
Binary file not shown.
Binary file removed examples/hello-world/main.wasm
Binary file not shown.
20 changes: 0 additions & 20 deletions testdata/main.go

This file was deleted.

Binary file removed testdata/main.wasm
Binary file not shown.
6 changes: 3 additions & 3 deletions ww_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
ww "github.com/wetware/go"
)

//go:embed testdata/main.wasm
//go:embed examples/echo/main.wasm
var fileContent []byte

func TestEcho(t *testing.T) {
Expand Down Expand Up @@ -42,12 +42,12 @@ func TestEcho(t *testing.T) {
// WithDebugInfoEnabled(true).
WithCloseOnContextDone(true),
Module: wazero.NewModuleConfig().
WithArgs("/testdata/main.wasm").
WithArgs("/examples/echo/main.wasm").
WithStdin(stdin).
WithStdout(stdout).
WithStderr(stderr).
WithFSConfig(wazero.NewFSConfig().
WithDirMount("testdata", "/testdata/")),
WithDirMount("examples/echo", "/examples/echo/")),
}.Serve(ctx)

require.NoError(t, err, "server failed")
Expand Down

0 comments on commit c3a4d80

Please sign in to comment.