How can I join strings in Go template without template functions?

Viewed 222

I have a string slice, like x := []string{a,b,c}, and eventually I want it to be like a+"/"+b+"/"+c.

The problem I'm trying to deal with is coming from the Go template.
I want to have a solution in Go template.

The following is my current solution, but it's obviously ugly.

res := {{range item := .x}}item+"/"{{end}}
res = res[:len(res)-1]

If you have better approaches, appreciate it!

1 Answers
Related