53
53
altValuesFunc = flag .Bool ("values" , false , "if true, alternative string values method will be generated. Default: false" )
54
54
output = flag .String ("output" , "" , "output file name; default srcdir/<type>_string.go" )
55
55
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: \" \" " )
57
57
addPrefix = flag .String ("addprefix" , "" , "transform each item name by adding a prefix. Default: \" \" " )
58
58
linecomment = flag .Bool ("linecomment" , false , "use line comment text as printed text when present" )
59
59
)
@@ -774,9 +774,9 @@ func (g *Generator) buildOneRun(runs [][]Value, typeName string) {
774
774
}
775
775
776
776
// 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)
780
780
const stringOneRun = `func (i %[1]s) String() string {
781
781
if %[3]si >= %[1]s(len(_%[1]sIndex)-1) {
782
782
return fmt.Sprintf("%[1]s(%%d)", i)
@@ -786,10 +786,10 @@ const stringOneRun = `func (i %[1]s) String() string {
786
786
`
787
787
788
788
// 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)
793
793
const stringOneRunWithOffset = `func (i %[1]s) String() string {
794
794
i -= %[2]s
795
795
if %[4]si >= %[1]s(len(_%[1]sIndex)-1) {
0 commit comments