join(separator, lists...) concatenates all elements of one or more lists into a single string, with separator placed between each element.
Signature
Example
Build a space-separated list of Go packages and pass it to a build command:go build ./cmd/api ./cmd/worker ./cmd/scheduler.
Notes
- If all lists are empty,
joinreturns an empty string. - If the combined list has one element, no separator is added.
- Multiple lists are concatenated before joining:
join(", ", list1, list2)is equivalent tojoin(", ", concat(list1, list2)).