ax(mining): replace description comments with usage examples on InitRouter and SetupRoutes
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

AX Principle 2: comments show HOW with real values, not WHAT the signature already says.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 14:24:52 +01:00
parent ff7acab30e
commit f242df27aa
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -489,9 +489,8 @@ func NewService(manager ManagerInterface, listenAddr string, displayAddr string,
}, nil
}
// InitRouter initializes the Gin router and sets up all routes without starting an HTTP server.
// Use this when embedding the mining service in another application (e.g., Wails).
// After calling InitRouter, you can use the Router field directly as an http.Handler.
// svc.InitRouter()
// http.Handle("/", svc.Router) // embed as handler in Wails or another HTTP server
func (s *Service) InitRouter() {
s.Router = gin.Default()
@ -622,9 +621,8 @@ func (s *Service) ServiceStartup(ctx context.Context) error {
return fmt.Errorf("server failed to start listening on %s within timeout", s.Server.Addr)
}
// SetupRoutes configures all API routes on the Gin router.
// This is called automatically by ServiceStartup, but can also be called
// manually after InitRouter for embedding in other applications.
// svc.InitRouter()
// svc.SetupRoutes() // re-call after adding middleware manually
func (s *Service) SetupRoutes() {
apiGroup := s.Router.Group(s.APIBasePath)