Skip to content

Comments

Update sample.go#33

Open
purevoice wants to merge 1 commit intoLayer-Edge:mainfrom
purevoice:main
Open

Update sample.go#33
purevoice wants to merge 1 commit intoLayer-Edge:mainfrom
purevoice:main

Conversation

@purevoice
Copy link

This pull request improves the resilience and maintainability of the proof submission CLI tool. Key updates include:

-Structured error handling for user input and channel operations.
-JSON formatting of proof data for better interoperability and debugging.
-Graceful shutdown handling via OS signals (e.g., Ctrl+C).
-Configuration of the endpoint via an environment variable (PROOF_ENDPOINT).
-Consistent logging with log.Printf instead of fmt.Printf.

These changes make the codebase safer, cleaner, and easier to deploy in real-world environments.

added input validation, graceful shutdown, and structured JSON proof

- Added error handling for user input with `bufio.ReadString`.
- Wrapped proof data in a JSON struct for clarity and future extensibility.
- Replaced `fmt.Printf` with structured `log.Printf` for consistent logging.
- Made endpoint configurable via `PROOF_ENDPOINT` environment variable.
- Added graceful shutdown on SIGINT (Ctrl+C).
- Used a `select` with timeout for non-blocking channel send.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant