Open josharian opened 6 years ago
As another bonus, we could generate String methods at the same time. stringer (go/types) doesn't play nicely with cgo, and probably won't any time soon.
Any opinions on this? I'm willing to work on it, but only if it has a chance of flying.
It appears that some parts of git2go, such as enums, could be fairly straightforwardly autogenerated from the C headers. This would make them easier to maintain (instead of pulling in additions one at a time, when I need them, like #425), and allow bringing comments along for the ride.
I've hacked together enough of a proof-of-concept to convince myself that this is not totally unreasonable: https://gist.github.com/josharian/54b2268af5792ff0e62f06437f28a8c9. It includes a pile of hacks to work around inconsistent naming conventions and the like, but still seems better than the status quo.
How do you feel about this? Would you be ok with pulling enums out into their own files, so the entire file could be autogenerated, to simplify the scripting? (Probably one go file per c header.) Relatedly (vis-a-vis inconsistent naming conventions), what are git2go's backward compat goals?