goleak
goleak copied to clipboard
Provide stub so apps using goleak can build unchanged with tinygo.
Tinygo can build a large subset of go programs already. Unfortunately, tinygo currently does not quite support goleak.
As a temporary measure, use the tinygo build tag to provide a stub for goleak. This will expand the world of go programs that run properly on tinygo, and remove one more obstacle keeping embedded system and wasm users from adopting go and goleak.
This can be reverted if/when tinygo is enhanced to fully support goleak.
Fixes https://github.com/uber-go/goleak/issues/71
Just for my education
This can be reverted if/when tinygo is enhanced to fully support goleak.
Do you know what exactly is missing in tinygo for goleak to run? Is that even on their roadmap?
Either way, I'd probably defer to @abhinav for a stamp here.
Tinygo would have to e.g. implement runtime.Stack().
Whether or not this is on their roadmap, gracefully falling back to a no-op on tinygo feels like the right thing to do until tinygo decides to support goleak.
Tinygo would have to e.g. implement runtime.Stack().
For desktop systems I can see it happening some day, but for WebAssembly and embedded systems it probably won't happen. Because runtime.Stack() requires the presence of a ton of debugging information for which there simply is no space on a microcontroller.
(Background: debugging on a microcontroller normally happens by having the debugger on the host load symbols from a separate ELF file that corresponds to the firmware that's stored on the microcontroller. This avoids the need for debug information on the microcontroller).
Details aside, software that uses goleak is increasingly going to be built with both go and tinygo, may as well make it easy.
I like the idea. The message should probably be suppressed or only shown once on tinygo, though, otherwise it could dominate logs.
2 year old PR and still didn't get merged! 🤷🏻♂️
2 year old PR and still didn't get merged! 🤷🏻♂️
@AbdullahWins, this comment by @prashantv mentions why the PR as it is cannot be merged, and what it'll take for it to get merged.
2 year old PR and still didn't get merged! 🤷🏻♂️
@AbdullahWins, this comment by @prashantv mentions why the PR as it is cannot be merged, and what it'll take for it to get merged.
Thanks for the fast ⏩ response and also the clarification.