Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion caddy/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.25

require (
github.com/caddyserver/caddy/v2 v2.10.2
github.com/darkweak/wazemmes v0.0.1
github.com/darkweak/wazemmes v0.0.2
go.uber.org/zap v1.27.0
)

Expand Down
2 changes: 1 addition & 1 deletion demo/go/wasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func main() {
}

mw, _ := New(config)
handler.Host.Log(api.LogLevelInfo, fmt.Sprintf("%#v\n", mw))
handler.Host.Log(api.LogLevelInfo, fmt.Sprintf("%#v", mw))
if err != nil {
handler.Host.Log(api.LogLevelError, fmt.Sprintf("Could not load config %v", err))
os.Exit(1)
Expand Down
10 changes: 5 additions & 5 deletions go.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@ func NewWasmHandlerGo(modulepath string, moduleConfig any, poolConfiguration map
wa0Rt := host.NewRuntime(wazero.NewRuntimeWithConfig(ctx, wazero.NewRuntimeConfig().WithCompilationCache(cache).WithCloseOnContextDone(true)))
code, err := os.ReadFile(modulepath)
if err != nil {
logger.Sugar().Infof("impossible to read the custom module: %w", err)
logger.Sugar().Infof("impossible to read the custom module: %v", err)
return nil, err
}

customModule, err := wa0Rt.CompileModule(ctx, code)
if err != nil {
logger.Sugar().Infof("impossible to compile the custom module: %w", err)
logger.Sugar().Infof("impossible to compile the custom module: %v", err)
return nil, err
}

applyCtx, err := hostInstanciation(ctx, wa0Rt, customModule)
if err != nil {
logger.Sugar().Infof("instantiating host module: %w", err)
logger.Sugar().Infof("instantiating host module: %v", err)
return nil, err
}

Expand All @@ -89,15 +89,15 @@ func NewWasmHandlerGo(modulepath string, moduleConfig any, poolConfiguration map

data, err := json.Marshal(moduleConfig)
if err != nil {
logger.Sugar().Infof("marshaling config: %w", err)
logger.Sugar().Infof("marshaling config: %v", err)
return nil, err
}

opts = append(opts, handler.GuestConfig(data))

mw, err := wasm.NewMiddleware(applyCtx(ctx), code, opts...)
if err != nil {
logger.Sugar().Infof("creating middleware: %w", err)
logger.Sugar().Infof("creating middleware: %v", err)
return nil, err
}

Expand Down
Loading