package mime import ( "fmt" "strings" "unicode" "github.com/achiku/varfmt" ) func VarName(prefix, name string) string { rules := map[string]string{ "+": "_plus", "-": "_dash_", "/": "_", ".": "_dot_", } for old, new := range rules { name = strings.ReplaceAll(name, old, new) } if unicode.IsUpper(rune(name[0])) { name = " " + name } return varfmt.PublicVarName(prefix + "_" + name) } func Value(val []string) string { return fmt.Sprintf("%#v", val) }