tinygo-org / tinygo

Go compiler for small places. Microcontrollers, WebAssembly (WASM/WASI), and command-line tools. Based on LLVM.
https://tinygo.org
Other
15.2k stars 892 forks source link

Enhancement request: replace Go's deadcode linter #2562

Open jzabinski-dolios opened 2 years ago

jzabinski-dolios commented 2 years ago

When I write Go functions in a main package and add the export keyword, Go's deadcode linter warns that the code is unused. Normally this happens when the code is not otherwise used in the package. But exported functions are intentionally unused.

It would be great to have a deadcode linter intended for TinyGo that makes an exception for exported functions.

aykevl commented 2 years ago

I think this is a bug in the deadcode linter, not in TinyGo. It should recognize //export and not treat those functions as unused.

jzabinski-dolios commented 2 years ago

I would be happy to submit the issue to the deadcode linter itself.

Is //export syntax exclusive to the TinyGo compiler? Just want to be informed before I submit it to them. After a little digging, I don't find documentation for it outside tinygo.org.