How to generate a Go parameter name?
MartyHub opened this issue · 5 comments
MartyHub commented
Hello,
I'm using caps
to generate some Go code and I was wondering if there was a way to achieve the following behavior:
caps.ToLowerCamel("entity id") // entityID
caps.ToLowerCamel("id") // id
Actually, the second example generates "ID"
And if I use the caps.WithReplaceStyleLower()
option, the first example is not right anymore
Thanks and regards
chanced commented
Hmm, that's definitely a bug. The second should have been "id"
..
I'll fix it but in the meantime, this works:
caps.ToLowerCamel("entity id") // entityID
caps.ToLowerCamel("id", caps.WithReplaceStyleLower()) // id
https://go.dev/play/p/K5r_72rYHDx
Thank you for reporting it.
chanced commented
Oh wait, I see the problem. If you use WithReplaceStyleLower
then the first wouldn't be correct.
chanced commented
I released version 1.0.1
which should fix this. Sorry about that.
MartyHub commented
It's working great, thank you!
chanced commented
Awesome, glad to hear it!