Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not compilable with tinygo v0.35.0 (or any lower) #2729

Open
eliezedeck opened this issue Jan 6, 2025 · 2 comments
Open

Not compilable with tinygo v0.35.0 (or any lower) #2729

eliezedeck opened this issue Jan 6, 2025 · 2 comments

Comments

@eliezedeck
Copy link

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.

@aldas
Copy link
Contributor

aldas commented Jan 7, 2025

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

@aldas
Copy link
Contributor

aldas commented Jan 7, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants