fmt.Warnidf
Logs a suppressible WARNING from a template.
- Syntax
- fmt.Warnidf ID FORMAT [INPUT]
- Returns
- string
- Alias
- warnidf
The documentation for Go’s fmt package describes the structure and content of the format string.
The warnidf function evaluates the format string, then prints the result to the WARNING log. Unlike the warnf function, you may suppress warnings logged by the warnidf function by adding the message ID to the ignoreLogs array in your project configuration.
This template code:
{{ warnidf "warning-42" "You should consider fixing this." }}Produces this console log:
WARN You should consider fixing this.
You can suppress this warning by adding the following to your project configuration:
ignoreLogs = ['warning-42']To suppress this message:
ignoreLogs:
- warning-42
ignoreLogs = ['warning-42']
{
"ignoreLogs": [
"warning-42"
]
}
Last updated:
September 11, 2026
:
content: Comply with function/method description guidance in style guide (76fa3fc9e)
Improve this page