fmt.Warnidf
Logs a suppressible WARNING from a template.
- Syntax
- fmt.Warnidf ID FORMAT [INPUT]
- Returns
- string
- Alias
- warnidf
Usage
The fmt.Warnidf function logs a suppressible WARNING from a template. The function formats INPUT according to FORMAT and writes the result to the WARNING log. The function returns an empty string.
The documentation for Go’s fmt package describes the structure and content of the format string.
Unlike the fmt.Warnf function, you can suppress warnings logged by the fmt.Warnidf function. To suppress a warning, add its ID to the ignoreLogs array in your project configuration.
Examples
{{ fmt.Warnidf "warning-42" "You should consider fixing this." }}The resulting console output:
WARN You should consider fixing this.
You can suppress this warning by adding the following to your project configuration:
ignoreLogs = ['warning-42']Suppressing the warning in your project configuration:
ignoreLogs:
- warning-42
ignoreLogs = ['warning-42']
{
"ignoreLogs": [
"warning-42"
]
}
Last updated:
November 8, 2026
:
content: Remove categories from front matter (1cc1dd83a)
Improve this page