Documentation Index
Fetch the complete documentation index at: https://errand.nuvrel.dev/llms.txt
Use this file to discover all available pages before exploring further.
endswith(str, suffix) returns true if str ends with suffix, and false otherwise.
Signature
endswith(str string, suffix string) bool
Example
Skip the linter when the playbook is loaded outside of a Go project:
variable "module" {
description = "Go module path"
type = string
}
task "lint" {
description = "Run the linter if this is a Go module"
condition = endswith(var.module, "/cmd")
commands = ["golangci-lint run ./..."]
}
Or use it to validate a file path variable before running a task:
variable "tag" {
description = "Release tag"
type = string
}
variable "archive" {
description = "Path to the release archive"
type = string
}
task "publish" {
description = "Publish a release archive"
condition = endswith(var.archive, ".tar.gz")
commands = ["gh release upload ${var.tag} ${var.archive}"]
}
Notes
- The comparison is case-sensitive. Use
lower on both arguments for a case-insensitive check.
- Returns
false when suffix is longer than str.