martinlindhe / unit

Conversion of unit library for golang
MIT License
113 stars 22 forks source link

Use 'go generate' #5

Open martinlindhe opened 8 years ago

martinlindhe commented 8 years ago

It would make sense to generate this code from some tables.

See https://blog.golang.org/generate

soumya92 commented 6 years ago

Do you have a preference/strong inclination to use golang to generate these files? If not, I'd be happy to send you a PR for using ruby/erb to generate the go code.

martinlindhe commented 6 years ago

I do feel the solution should be written in golang too, as this is a go lib. Any particular reason for wanting to use another language?

soumya92 commented 6 years ago

I just find it easier to write template-style programs in ruby, especially since interpolation is easier and map/each blocks are more compact, but that could just be because I haven't tried using go to generate a go program yet. I'll check back when I'm more comfortable writing go template programs and if this still needs work, I can try to put something together.