Merge commit '35dec7c96f7ee3eb17dd444f7067f0c776fb56ae'

This commit is contained in:
Bjørn Erik Pedersen
2023-12-04 15:24:01 +01:00
810 changed files with 24147 additions and 7766 deletions

View File

@@ -1,30 +1,22 @@
---
title: fmt.Warnf
linkTitle: warnf
description: Log a WARNING from a template.
categories: [functions]
categories: []
keywords: []
menu:
docs:
parent: functions
function:
action:
aliases: [warnf]
related:
- functions/fmt/Errorf
- functions/fmt/Erroridf
returnType: string
signatures: ['fmt.Warnf FORMAT [INPUT]']
relatedFunctions:
- fmt.Errorf
- fmt.Erroridf
- fmt.Warnf
aliases: [/functions/warnf]
---
The documentation for [Go's fmt package] describes the structure and content of the format string.
{{% include "functions/fmt/_common/fmt-layout.md" %}}
Like the [`printf`] function, the `warnf` function evaluates the format string. It then prints the result to the WARNING log. Hugo prints each unique message once to avoid flooding the log with duplicate warnings.
The `warnf` function evaluates the format string, then prints the result to the WARNING log. Hugo prints each unique message once to avoid flooding the log with duplicate warnings.
```go-html-template
{{ warnf "Copyright notice missing from site configuration" }}
{{ warnf "The %q shortcode was unable to find %s. See %s" .Name $file .Position }}
```
[`printf`]: /functions/fmt/printf
[Go's fmt package]: https://pkg.go.dev/fmt