sprig
sprig copied to clipboard
Useful template functions for Go templates.
:wave: :heart: I looked into Sprig today because it implements many functions my own hand-rolled library was, in most cases with the same name/signature! Thank you for creating such a...
``` $list := list "foo" "bar" $third := gt (len $list) 2 | ternary (index $list 2) "" ``` This code will create an `reflect: slice index out of range`...
Evaluating `"{{duration 95}}"` results in `"0s"`; expected `"1m35s"`. It appears that there's a few cases missing in [date.go](https://github.com/Masterminds/sprig/blob/master/date.go#L89-L92).
It seems like the value 0 is not merged properly. I have created the following test which currently fails. ``` func TestMergeZero(t *testing.T) { dict := map[string]interface{}{ "src2": map[string]interface{}{ "h":...
I am trying to setup CA and server cert for my auth webhook in Helm. I have created following template in ```_helper.tpl```. ``` {{/* Generate certificates for auth */}} {{-...
Hi, the doc to the default function states: > default: Give a default value. Used like this: trim " "| default "empty". Since trim produces an empty string, the default...
Hello all! can you explain why multiplication and division over float numbers was not added initially? and when are you planning to add these features? I planned to create a...
Originally, I was hoping to use Monikers while working with Helm templates. Helm feature request link here: https://github.com/helm/helm/issues/8428 Copy & Pasted from the helm issue: # Reason for Request I...
I don't think this was purposeful, but let me know why if it was a decision made. Given the following go program: ```go package main import ( "fmt" "os" "text/template"...
Add safeEmpty, safeDefault, and safeCoalesce functions which don't consider 0 or false to be empty
As explained in #111, the current implementation of empty, and therefore default and coalesce, fails when attempting to use booleans or certain integers. However, there are many cases where an...