This repository was archived by the owner on Jun 19, 2025. It is now read-only.
This repository was archived by the owner on Jun 19, 2025. It is now read-only.
Helpers dont seem to work with variadic parameters #14
Closed
Description
raymond.RegisterHelper("addParamsToLink", func(link string, params ...string) string {
// details not important
return "banana"
})
template, _ := raymond.Parse(`{{addParamsToLink baseLink parameter second}}`)
// and a test
t.Run("adds two parameters to url with parameter", func(t *testing.T) {
context := map[string]string{
"baseLink": "localhost:8080/?time=now",
"parameter": "drink=beer",
"second": "place=bar",
}
result, _ := template.Exec(context)
assert.Equal(t, "localhost:8080/?time=now&drink=beer&place=bar", result, "adds two parameters simple url")
})
The test fails because the helper seems to return an empty string. I suspect it is panic-ing silently.
If I remove the vararg-ness it returns banana