Skip to main content
concat(seqs...) appends all given lists or tuples together and returns the combined result. If all inputs are lists of the same element type, the result is a list. Otherwise, the result is a tuple.

Signature

concat(seqs... list | tuple) list | tuple

Example

Combine a fixed set of required linting steps with an optional set of extra checks passed as a variable:
variable "extra_checks" {
  description = "Additional linting targets to include"
  type        = list(string)
  default     = []
}

computed "all_checks" {
  description = "Full set of linting targets"
  expression  = concat(["./internal/...", "./pkg/...", "./cmd/..."], var.extra_checks)
}

task "lint" {
  description = "Lint all packages"
  commands    = ["golangci-lint run ${join(" ", computed.all_checks)}"]
}
When extra_checks is empty, only the base packages are linted. When --var 'extra_checks=["./tool/..."]' is passed, the extra path is appended.

Notes

  • concat preserves order and duplicates. Use distinct afterward if uniqueness is required.
  • When mixing lists of different types or including tuples, the result is a tuple rather than a list.