Not compilable with tinygo v0.35.0 (or any lower)
Issue Description
Currently, echo depends on golang.org/x/net I believe for its HTTP2 stuffs (?). For tinygo compilations (such as for Cloudflare Workers using the package github.com/syumai/workers, it is currently failing with package net/http/httptrace is not in std error.
Working code to debug
package main
import (
"net/http"
"github.com/labstack/echo/v4"
"github.com/syumai/workers"
)
func main() {
e := echo.New()
e.DisableHTTP2 = true
e.GET("/", func(c echo.Context) error {
return c.String(http.StatusOK, "Hello, World!")
})
workers.Serve(e.Server.Handler)
}
Version/commit
Any version of echo v4.
I really like echo, and I'd like to keep using it on my WASM projects. But this issue is blocking the usage right now. Any possibility of suggestion? Thanks.
I think this is question for TinyGO repo. As golang.org/x/net quite popular and they probably have dealt with things like that already.
I think you could add replace directive in go.mod file and provide very basic - empty implementation for this struct and function
h2s *http2.Server
and
h2c.NewHandler(e, h2s)
in go.mod
replace golang.org/x/net => github.com/your-username/net v0.0.0-20231002123456-deadbeef9999
also - we probably would move StartH2CServer method to separate file and add build flag that excludes wasm.
//go:build !wasm
@eliezedeck would you like to test is out in your own fork-repo and if it works we probably can merge this