From badc8817fa6d9a683a2e966c338966ed0557ef70 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 11 Aug 2016 17:01:46 -0700 Subject: [PATCH] Elide empty variations Don't add a "_" to the variant name if the variation name is empty. For example, when splitting a variant with name "foo" into variations "" and "bar", the new variants would be named "foo" and "foo_bar" instead of "foo_" and "foo_bar". Change-Id: I82342d57e2a8e9f2d65a7d8d2872dcb7b3512899 --- context.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/context.go b/context.go index 60a4363..d9529fb 100644 --- a/context.go +++ b/context.go @@ -1000,10 +1000,12 @@ func (c *Context) createVariations(origModule *moduleInfo, mutatorName string, newModule.dependencyVariant = origModule.dependencyVariant.clone() newModule.moduleProperties = newProperties - if newModule.variantName == "" { - newModule.variantName = variationName - } else { - newModule.variantName += "_" + variationName + if variationName != "" { + if newModule.variantName == "" { + newModule.variantName = variationName + } else { + newModule.variantName += "_" + variationName + } } newModules = append(newModules, newModule)