5353 altValuesFunc = flag .Bool ("values" , false , "if true, alternative string values method will be generated. Default: false" )
5454 output = flag .String ("output" , "" , "output file name; default srcdir/<type>_string.go" )
5555 transformMethod = flag .String ("transform" , "noop" , "enum item name transformation method. Default: noop" )
56- trimPrefix = flag .String ("trimprefix" , "" , "transform each item name by removing a prefix. Default: \" \" " )
56+ trimPrefix = flag .String ("trimprefix" , "" , "transform each item name by removing a prefix or comma separated list of prefixes . Default: \" \" " )
5757 addPrefix = flag .String ("addprefix" , "" , "transform each item name by adding a prefix. Default: \" \" " )
5858 linecomment = flag .Bool ("linecomment" , false , "use line comment text as printed text when present" )
5959)
@@ -774,9 +774,9 @@ func (g *Generator) buildOneRun(runs [][]Value, typeName string) {
774774}
775775
776776// Arguments to format are:
777- // [1]: type name
778- // [2]: size of index element (8 for uint8 etc.)
779- // [3]: less than zero check (for signed types)
777+ // [1]: type name
778+ // [2]: size of index element (8 for uint8 etc.)
779+ // [3]: less than zero check (for signed types)
780780const stringOneRun = `func (i %[1]s) String() string {
781781 if %[3]si >= %[1]s(len(_%[1]sIndex)-1) {
782782 return fmt.Sprintf("%[1]s(%%d)", i)
@@ -786,10 +786,10 @@ const stringOneRun = `func (i %[1]s) String() string {
786786`
787787
788788// Arguments to format are:
789- // [1]: type name
790- // [2]: lowest defined value for type, as a string
791- // [3]: size of index element (8 for uint8 etc.)
792- // [4]: less than zero check (for signed types)
789+ // [1]: type name
790+ // [2]: lowest defined value for type, as a string
791+ // [3]: size of index element (8 for uint8 etc.)
792+ // [4]: less than zero check (for signed types)
793793const stringOneRunWithOffset = `func (i %[1]s) String() string {
794794 i -= %[2]s
795795 if %[4]si >= %[1]s(len(_%[1]sIndex)-1) {
0 commit comments