func exportable(name string) string { // make sure the symbol is exportable name = strings.ToUpper(name[0:1]) + name[1:] // fix common AWS<->Go bugaboos for regexp, repl := range replacements { name = regexp.ReplaceAllString(name, repl) } return name }
// ExportableName a name which is exportable as a value or name in Go code func (a *API) ExportableName(name string) string { if name == "" { return name } failed := false // make sure the symbol is exportable name = strings.ToUpper(name[0:1]) + name[1:] // inflections are disabled, stop here. if a.NoInflections { return name } // fix common AWS<->Go bugaboos out := "" for _, part := range splitName(name) { if part == "" { continue } if part == strings.ToUpper(part) || part[0:1]+"s" == part { out += part continue } if v, ok := whitelistExportNames[part]; ok { if v != "" { out += v } else { out += part } } else { failed = true inflected := part for regexp, repl := range replacements { inflected = regexp.ReplaceAllString(inflected, repl) } a.unrecognizedNames[part] = inflected } } if failed { return name } return out }