mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-16 23:29:21 +00:00
drop redundant NArg check when looping Args
This commit is contained in:
parent
02f4d643ea
commit
e0ebac6c9c
@ -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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user