all repos

json2go @ 34a739e4ce1653e6e79b023d22dfd9a923a2f21c

convert json to go type annotations
1 files changed, 3 insertions(+), 3 deletions(-)
feat: write errors to stderr
Author: Oleksandr Smirnov olexsmir@gmail.com
Committed at: 2025-12-07 16:48:44 +0200
Change ID: uoztvpmkmmnzntkuqnslpoqkqlxyrwsl
Parent: 4585e71
M cmd/json2go/main.go

@@ -24,7 +24,7 @@ args := flag.Args()

stat, err := os.Stdin.Stat() if err != nil { - fmt.Printf("Failed to get stdin stat: %v\n", err) + fmt.Fprintf(os.Stderr, "Failed to get stdin stat: %v\n", err) os.Exit(1) }

@@ -37,7 +37,7 @@ input = args[0]

case isPiped: data, rerr := io.ReadAll(os.Stdin) if rerr != nil { - fmt.Printf("Failed to read piped input: %v\n", rerr) + fmt.Fprintf(os.Stderr, "Failed to read piped input: %v\n", rerr) os.Exit(1) } input = string(data)

@@ -49,7 +49,7 @@

transformer := json2go.NewTransformer() type_, err := transformer.Transform(*typeName, input) if err != nil { - fmt.Printf("Failed to transform json to type annotation: %v\n", err) + fmt.Fprintf(os.Stderr, "Failed to transform json to type annotation: %v\n", err) os.Exit(1) }