Skip to main content
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:
With the default value, the command becomes go build ./cmd/api ./cmd/worker ./cmd/scheduler.

Notes

  • If all lists are empty, join returns 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 to join(", ", concat(list1, list2)).