go-gorm / go-gorm/cli

fix: route diagnostic output to stderr in generator

Open
#56 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
108
Forks
15
PR merge metrics
No merged PRs in 30d

Description

## Summary

The generator prints diagnostic messages to stdout via `fmt.Printf`:

```go
// internal/gen/generator.go:212
fmt.Printf("Generating file %s from %s...\n", outPath, file.inputPath)

// internal/gen/generator.go:236
fmt.Printf("Skipping generated file: %s\n", inputFile)
```

These are log/diagnostic messages, not program output. They should go to stderr so they don't corrupt piped output when the CLI is used in scripts or CI pipelines.

## Fix

```go
fmt.Fprintf(os.Stderr, "Generating file %s from %s...\n", outPath, file.inputPath)
fmt.Fprintf(os.Stderr, "Skipping generated file: %s\n", inputFile)
```

## References

- [Go CLI best practices: stdout vs stderr](https://github.com/golang/go/wiki/CodeReviewComments#stdout-vs-stderr)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.