more TODOs, and especially clarify the situation for input type names

This commit is contained in:
Ben Kraft
2021-03-22 18:45:52 -07:00
parent 088ec53ad5
commit 17a95fd4de
10 changed files with 115 additions and 22 deletions
+15
View File
@@ -29,6 +29,21 @@ func upperFirst(s string) string {
return changeFirst(strings.TrimLeft(s, "_"), unicode.ToUpper)
}
func matchFirst(s, tmpl string) string {
c, n := utf8.DecodeRuneInString(s)
t, _ := utf8.DecodeRuneInString(tmpl)
if c == utf8.RuneError || n == utf8.RuneError { // empty or invalid
return s
}
if unicode.IsUpper(t) {
c = unicode.ToUpper(c)
} else {
c = unicode.ToLower(c)
}
return string(c) + s[n:]
}
func goConstName(s string) string {
if strings.TrimLeft(s, "_") == "" {
return s