Merge pull request #118066 from BenTheElder/yamlfmt-cleanup

yamlfmt cleanup
This commit is contained in:
Kubernetes Prow Robot 2023-05-17 15:42:33 -07:00 committed by GitHub
commit 9d613da22b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 23 deletions

View File

@ -1,4 +1,10 @@
# See the OWNERS docs at https://go.k8s.io/owners # See the OWNERS docs at https://go.k8s.io/owners
reviewers:
- bentheelder
- dims
approvers: approvers:
- dims - dims
labels:
- sig/testing
- sig/contributor-experience

View File

@ -28,29 +28,26 @@ import (
func main() { func main() {
indent := flag.Int("indent", 2, "default indent") indent := flag.Int("indent", 2, "default indent")
flag.Parse() flag.Parse()
for _, path := range flag.Args() {
if flag.NArg() > 0 { sourceYaml, err := os.ReadFile(path)
for _, path := range flag.Args() { if err != nil {
sourceYaml, err := os.ReadFile(path) fmt.Fprintf(os.Stderr, "%s: %v\n", path, err)
if err != nil { continue
fmt.Fprintf(os.Stderr, "%s: %v\n", path, err) }
continue rootNode, err := fetchYaml(sourceYaml)
} if err != nil {
rootNode, err := fetchYaml(sourceYaml) fmt.Fprintf(os.Stderr, "%s: %v\n", path, err)
if err != nil { continue
fmt.Fprintf(os.Stderr, "%s: %v\n", path, err) }
continue writer, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)
} if err != nil {
writer, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666) fmt.Fprintf(os.Stderr, "%s: %v\n", path, err)
if err != nil { continue
fmt.Fprintf(os.Stderr, "%s: %v\n", path, err) }
continue err = streamYaml(writer, indent, rootNode)
} if err != nil {
err = streamYaml(writer, indent, rootNode) fmt.Fprintf(os.Stderr, "%s: %v\n", path, err)
if err != nil { continue
fmt.Fprintf(os.Stderr, "%s: %v\n", path, err)
continue
}
} }
} }
} }