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

Add support for TinyGo #978

Merged
merged 1 commit into from
Feb 18, 2025
Merged

Add support for TinyGo #978

merged 1 commit into from
Feb 18, 2025

Conversation

efraimbart
Copy link
Contributor

Resolves #951

Copy link
Contributor

@VojtechVitek VojtechVitek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you!

Can someone help me test this with TinyGo?
I'll wait for few more reviews and we can merge 👍

cc @angelofallars @cxjava

@cxjava
Copy link
Contributor

cxjava commented Feb 17, 2025

build as expected, no error.


BTW:
when I want to use middleware in tinygo, it will failed because of https://github.com/go-chi/chi/blob/master/middleware/profiler.go, not package net/http/pprof for tinygo.

	r := chi.NewRouter()
	r.Use(middleware.CleanPath)
	r.Use(middleware.RealIP)
	r.Use(middleware.Logger)
	r.Use(middleware.Recoverer)

error output:

../../../go/pkg/mod/github.com/go-chi/chi/[email protected]/middleware/profiler.go:6:2: 
package net/http/pprof is not in std (/Users/user/Library/Caches/tinygo/goroot-598d56643c1f2b0a17cb7ed7f5003addae1fc3ee5af904a1c5356bb7118a4988/src/net/http/pprof)

@efraimbart Maybe we also need to exclude middleware/profiler.go when use tinygo. CC: @VojtechVitek
image

@efraimbart
Copy link
Contributor Author

Unfortunately I'm not familiar with middleware or what would happen if it's excluded.

@cxjava
Copy link
Contributor

cxjava commented Feb 18, 2025

No worry, I can create other PR to fix the middleware build.

Copy link
Contributor

@VojtechVitek VojtechVitek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I'll merge both #978 and #982.

LGTM

@VojtechVitek VojtechVitek merged commit d047034 into go-chi:master Feb 18, 2025
10 checks passed
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

Successfully merging this pull request may close these issues.

type *http.Request has no field or method SetPathValue when use tinygo build to wasm
3 participants