fastly / compute-sdk-go

Go SDK for building Fastly Compute applications
https://developer.fastly.com/learning/compute/go/
Apache License 2.0
80 stars 9 forks source link

fsthttp/{transport,adapter}.go imports net/http, breaking native mac build? #31

Open dkegel-fastly opened 1 year ago

dkegel-fastly commented 1 year ago

An app that imports fsthttp, and which builds in both go, tinygo native, and tinygo wasm (with -tag nofastlyhostcalls) stopped building on tinygo native when we upgraded it to v0.1.2; wrapping fsthttp/{transport,adapter}.go in another build tag seems to resolve the problem.

So adding a build tag to disable the net/http dependency seems like a good thing to add... maybe named fastly.compute.nostdhttp for clarity.

dgryski commented 1 year ago

This seems reasonable. The net/http package is also a large dependency, and people who are only using C@E won't need it. That's probably easier than moving those two files to their own subpackage.

dgryski commented 1 year ago

I wonder if we should actually go the other way and require opting in to the net/http dependency? Although if we're going to break the API, having it in a separate package is probably nicer.

dgryski commented 1 month ago

https://github.com/tinygo-org/tinygo/pull/4502 should fix the Mac build but doesn't solve the issue of adding in a net/http for everybody who doesn't need it.