tinygo-org / tinygo

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

make go-cmp Equal succeed #4361

Open ldemailly opened 2 months ago

ldemailly commented 2 months ago

Splitting commits from #4356

ldemailly commented 2 months ago

'Test' is here

https://github.com/grol-io/grol/blob/v0.24.0/ast/modify_test.go#L130

panics without this fix, also

https://github.com/google/go-cmp/blob/v0.6.0/cmp/compare.go#L312-L314

in the comment hopefully makes it clear how this helps (of note, if you do have an equal method it won't be used, yet... still better than panic imo)

aykevl commented 2 months ago

Would it be possible to change go-cmp instead to not call MethodByName?

ldemailly commented 2 months ago

I don't think go-cmp are (or should be, really) concerned with adding special case for incomplete go, so it would need to be on tinygo's side (or users of both like me)

Not sure btw that it's hard to find callers without panic

maybe something with some build tag then?