total rewrite to interface handling; not complete but it compiles

This commit is contained in:
Ben Kraft
2020-07-16 13:28:43 -07:00
parent af4a765a32
commit cf7136ca65
33 changed files with 712 additions and 173 deletions
+5 -4
View File
@@ -29,14 +29,15 @@ func upperFirst(s string) string {
}
func goConstName(s string) string {
if strings.TrimLeft(s, "_") == "" {
return s
}
var prev rune
return strings.Map(func(r rune) rune {
var ret rune
if prev == 0 && r == '_' {
return '_' // still treat next char as first
} else if r == '_' {
if r == '_' {
ret = -1
} else if prev == '_' {
} else if prev == '_' || prev == 0 {
ret = unicode.ToUpper(r)
} else {
ret = unicode.ToLower(r)