Skip to content

Conversation

leoparente
Copy link
Contributor

This pull request refactors error handling and logging in the cmd/diode-replay-dryrun/main.go file to improve clarity and consistency. It replaces log with fmt for better control over output streams and updates error messages for improved user feedback.

Error handling improvements:

  • Replaced log.Fatal with fmt.Fprintf to print errors to os.Stderr and explicitly exit the program with os.Exit(1) for better control over error handling.
  • Updated error messages to provide more detailed and user-friendly feedback, such as specifying required arguments and clarifying error contexts. [1] [2]

Logging improvements:

  • Replaced log.Printf with fmt.Fprintf to direct output to the appropriate streams (os.Stderr for errors, os.Stdout for success messages).

Minor updates:

  • Updated the -target flag description to fix a typo in the example URL.
  • Removed the unused log import and replaced it with fmt.

Copy link
Member

@mfiedorowicz mfiedorowicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥦

Copy link

github-actions bot commented Jul 14, 2025

Go test coverage

STATUS ELAPSED PACKAGE COVER PASS FAIL SKIP
🟢 PASS 0.00s github.com/netboxlabs/diode-sdk-go/cmd/diode-replay-dryrun 0.0% 0 0 0
🟢 PASS 1.30s github.com/netboxlabs/diode-sdk-go/diode 20.4% 218 0 0

Total coverage: 76.1%

@leoparente leoparente merged commit 7712ca9 into develop Jul 14, 2025
6 checks passed
@leoparente leoparente deleted the fix/cli branch July 14, 2025 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants