From 5511caae23f705a8dd71c1eb32ffe5fe6c2cef1f Mon Sep 17 00:00:00 2001 From: Luca Osti Date: Fri, 22 Mar 2019 11:36:16 +0100 Subject: [PATCH] Add prefix after transform --- README.md | 3 +-- stringer.go | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5ad10be..ccd9920 100644 --- a/README.md +++ b/README.md @@ -158,8 +158,7 @@ The default value for `transform` flag is `noop` which means no transformation w If a prefix is provided via the `trimprefix` flag, it will be trimmed from the start of each name (before it is transformed). If a name doesn't have the prefix it will be passed unchanged. -If a prefix is provided via the `addprefix` flag, it will be added to the start of each name (before -it is transformed and after trimming). +If a prefix is provided via the `addprefix` flag, it will be added to the start of each name (after trimming and after transforming). ## Inspiring projects diff --git a/stringer.go b/stringer.go index d194a8b..62a7725 100644 --- a/stringer.go +++ b/stringer.go @@ -330,10 +330,10 @@ func (g *Generator) generate(typeName string, includeJSON, includeYAML, includeS g.trimValueNames(values, trimPrefix) - g.prefixValueNames(values, addPrefix) - g.transformValueNames(values, transformMethod) + g.prefixValueNames(values, addPrefix) + runs := splitIntoRuns(values) // The decision of which pattern to use depends on the number of // runs in the numbers. If there's only one, it's easy. For more than