Add detailed godoc documentation to CLIEntry function

Expand the documentation comment for CLIEntry to provide more context
about what the function does, including its use of the fx dependency
injection framework, signal handling, and blocking behavior.
This commit is contained in:
2025-12-27 12:24:22 +07:00
parent 8323a95be9
commit e1d0ab5ea6
10 changed files with 110 additions and 29 deletions

View File

@@ -21,18 +21,19 @@ import (
)
const (
// statsContextTimeout is the timeout for stats API operations
// statsContextTimeout is the timeout for stats API operations.
statsContextTimeout = 4 * time.Second
)
// handleRoot returns a handler that redirects to /status
// handleRoot returns a handler that redirects to /status.
func (s *Server) handleRoot() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/status", http.StatusSeeOther)
}
}
// writeJSONError writes a standardized JSON error response
// writeJSONError writes a standardized JSON error response with the given
// status code and error message.
func writeJSONError(w http.ResponseWriter, statusCode int, message string) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(statusCode)
@@ -45,7 +46,8 @@ func writeJSONError(w http.ResponseWriter, statusCode int, message string) {
})
}
// writeJSONSuccess writes a standardized JSON success response
// writeJSONSuccess writes a standardized JSON success response containing
// the provided data wrapped in a status envelope.
func writeJSONSuccess(w http.ResponseWriter, data interface{}) error {
w.Header().Set("Content-Type", "application/json")