goleak icon indicating copy to clipboard operation
goleak copied to clipboard

Provide stub so apps using goleak can build unchanged with tinygo.

Open dkegel-fastly opened this issue 3 years ago • 9 comments

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

dkegel-fastly avatar Jan 21 '22 18:01 dkegel-fastly

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jan 21 '22 18:01 CLAassistant

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.

rabbbit avatar Jan 21 '22 20:01 rabbbit

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.

dkegel-fastly avatar Jan 21 '22 21:01 dkegel-fastly

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).

aykevl avatar Jan 22 '22 18:01 aykevl

Details aside, software that uses goleak is increasingly going to be built with both go and tinygo, may as well make it easy.

dkegel-fastly avatar Jan 22 '22 18:01 dkegel-fastly

I like the idea. The message should probably be suppressed or only shown once on tinygo, though, otherwise it could dominate logs.

dkegel-fastly avatar Jan 24 '22 15:01 dkegel-fastly

2 year old PR and still didn't get merged! 🤷🏻‍♂️

AbdullahWins avatar Nov 10 '23 12:11 AbdullahWins

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.

abhinav avatar Nov 10 '23 13:11 abhinav

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.

AbdullahWins avatar Nov 10 '23 13:11 AbdullahWins