Skip to content

Conversation

tommysitu
Copy link
Member

No description provided.

@stuioco stuioco changed the title Templating header manipulation Templating functions - setHeader, initArray, variadic concat Aug 27, 2025
Comment on lines 81 to 98
//helperMethodMap["concat"] = t.concat

// Register concatMany to accept a slice of interface{}
raymond.RemoveHelper("concat")
raymond.RegisterHelper("concat", func(args ...interface{}) string {
var parts []string
for _, arg := range args {
// If arg is a slice, flatten it
if s, ok := arg.([]interface{}); ok {
for _, v := range s {
parts = append(parts, fmt.Sprint(v))
}
} else {
parts = append(parts, fmt.Sprint(arg))
}
}
return strings.Join(parts, "")
})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this? you have already defined a concat function: bbd9d32#diff-794c9f946ba3753b6d7e501b54401cd2a6029c65ea921f46104e3b3b29c6102fR120

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed the duplication - the manually registered helper now calls the function in template_helpers

} else {
// @todo Maybe we can panic on that
return reflect.Zero(strType)
if funcType.IsVariadic() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have we manually updated this file in vendor package?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in order to support variadic template helpers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants