diff options
Diffstat (limited to 'replacer.go')
-rw-r--r-- | replacer.go | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/replacer.go b/replacer.go index 8ed6d2495..aad13e2a2 100644 --- a/replacer.go +++ b/replacer.go @@ -148,11 +148,10 @@ func (r *Replacer) replace(input, empty string, if errOnUnknown { return "", fmt.Errorf("unrecognized placeholder %s%s%s", string(phOpen), key, string(phClose)) - } else if treatUnknownAsEmpty { - if empty != "" { - sb.WriteString(empty) - } - } else { + } else if !treatUnknownAsEmpty { + // if treatUnknownAsEmpty is true, we'll + // handle an empty val later; so only + // continue otherwise lastWriteCursor = i continue } |