mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-15 17:51:20 +00:00
a4b889de63
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
16 lines
348 B
Go
16 lines
348 B
Go
package yaml
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
// IsEmptyDocument checks if a yaml document is empty (contains only comments)
|
|
func IsEmptyDocument(document document) bool {
|
|
for _, line := range strings.Split(string(document), "\n") {
|
|
line := strings.TrimSpace(line)
|
|
if line != "" && !strings.HasPrefix(line, "#") {
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
}
|