From f242df27aacad7ea6c4394d494d93fedc44b46db Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 14:24:52 +0100 Subject: [PATCH] ax(mining): replace description comments with usage examples on InitRouter and SetupRoutes AX Principle 2: comments show HOW with real values, not WHAT the signature already says. Co-Authored-By: Charon --- pkg/mining/service.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pkg/mining/service.go b/pkg/mining/service.go index 9b3685d..8d88b5d 100644 --- a/pkg/mining/service.go +++ b/pkg/mining/service.go @@ -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)