tinygo-org / net

Port of Go's "net" package to work with TinyGo on embedded processors.
https://tinygo.org
BSD 2-Clause "Simplified" License
23 stars 9 forks source link

adding httptrace package #26

Open rajatjindal opened 7 months ago

rajatjindal commented 7 months ago

hello folks,

Thank you for your wonderful work on TinyGo.

I am trying to update one of my app from TinyGo 1.29 to 1.31.x, and running into a problem because package net/http/httptrace no longer exists. an issue in TinyGo repo has been reported for this here: https://github.com/tinygo-org/tinygo/issues/4186

is there any objection (or obvious known blockers) to adding the package in this repo? I am happy to try to submit a PR for that if this is ok to add.

many thanks for considering Rajat Jindal

rajatjindal commented 7 months ago

to implement this, I was thinking of doing following:

  1. add /src/internal/nettrace/nettrace.go - this just has some type definitions, so should be straightforward to add
  2. add /http/httptrace/trace.go - bring the code over from official golang net package and verify the tests.

There is a possibility that this might not work, in which case, I was thinking we can just stub out the exported functions. This will atleast allow the compilation to succeed.

Also happy to hear if there are other approaches we can take for making progress on this issue.

thank you

endocrimes commented 6 months ago

There is a possibility that this might not work, in which case, I was thinking we can just stub out the exported functions. This will atleast allow the compilation to succeed.

This does introduce the problem that code that works with Big Go will compile but fail to actually work with TinyGo, which seems more dangerous than having to reimplement bits of httputil/httptrace in your own code though 😅

deadprogram commented 5 months ago

I would not mind a stubbed version of httptrace. we have other stubs, and so far I have also run into it as a dependency in packages that would otherwise work, such as upgrading to the latest paho mqtt package.