Add the sprig functions in the template engine

This commit is contained in:
thomasbach76 2017-08-10 20:42:39 +02:00 committed by Ludovic Fernandez
parent ff11467022
commit 7ff6c32452
42 changed files with 5671 additions and 50 deletions

25
vendor/github.com/huandu/xstrings/common.go generated vendored Normal file
View file

@ -0,0 +1,25 @@
// Copyright 2015 Huan Du. All rights reserved.
// Licensed under the MIT license that can be found in the LICENSE file.
package xstrings
import (
"bytes"
)
const _BUFFER_INIT_GROW_SIZE_MAX = 2048
// Lazy initialize a buffer.
func allocBuffer(orig, cur string) *bytes.Buffer {
output := &bytes.Buffer{}
maxSize := len(orig) * 4
// Avoid to reserve too much memory at once.
if maxSize > _BUFFER_INIT_GROW_SIZE_MAX {
maxSize = _BUFFER_INIT_GROW_SIZE_MAX
}
output.Grow(maxSize)
output.WriteString(orig[:len(orig)-len(cur)])
return output
}