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:
@@ -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")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user