mdempsky / unconvert

Remove unnecessary type conversions from Go source
BSD 3-Clause "New" or "Revised" License
377 stars 26 forks source link

Thanks for making the exact tool that I wanted! #1

Closed dmitshur closed 8 years ago

dmitshur commented 8 years ago

It's been on my long term TODO list to create exactly this tool, but now I don't have to. I just wanted to say thank you!

My motivation is that after switching between various OpenGL and vector math packages, I had accumulated some number of explicit type conversions, and it was hard to be sure which ones were still necessary. So I wanted to be able to simplify them, and I knew it was possible to write a tool that'd do it automatically and reliably.

Also thanks to @dominikh for sharing it with me.

I have one question so far, does this tool support pure Go packages that import other cgo packages (i.e., Go packages that use cgo, aka import "C")?

dmitshur commented 8 years ago

https://github.com/mdempsky/unconvert/blob/f934f1af1b2d7f6b68b7d344d57bb53c44eb0a94/unconvert.go#L200 may be a hint.

Are there plans to support Cgo in the future?

Would you be willing to accept a patch that adds support, if it's doable?

mdempsky commented 8 years ago

I had set CgoEnabled=false only because I don't have C cross-compilers for all of the target platforms, so I need to disable cgo when running with -all. I don't think there's any reason to disable it normally though.

I did a quick one-off test and it seems to work with cgo now. Let me know if you have any problems.

Cheers!

dmitshur commented 8 years ago

It works great for me, thank you!