From 182a40d21980c96e76d361d47c74b8ccdfef2ce6 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 13:11:10 +0100 Subject: [PATCH] ax(mining): replace prose struct comments with usage examples Four type comments in mining.go restated the type name in prose ("represents a ...", "provides ..."), violating AX Principle 2. Replaced with concrete usage examples showing realistic field values. Co-Authored-By: Charon --- pkg/mining/mining.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/mining/mining.go b/pkg/mining/mining.go index 2934da0..f75815a 100644 --- a/pkg/mining/mining.go +++ b/pkg/mining/mining.go @@ -54,7 +54,7 @@ type InstallationDetails struct { ConfigPath string `json:"config_path,omitempty"` // Add path to the miner-specific config } -// SystemInfo provides general system and miner installation information. +// info := SystemInfo{OS: "linux", Architecture: "amd64", AvailableCPUCores: 8} type SystemInfo struct { Timestamp time.Time `json:"timestamp"` OS string `json:"os"` @@ -246,20 +246,20 @@ type PerformanceMetrics struct { ExtraData map[string]interface{} `json:"extraData,omitempty"` } -// HashratePoint represents a single hashrate measurement at a specific time. +// point := HashratePoint{Timestamp: time.Now(), Hashrate: 1500} type HashratePoint struct { Timestamp time.Time `json:"timestamp"` Hashrate int `json:"hashrate"` } -// API represents the miner's API configuration. +// api := API{Enabled: true, ListenHost: "127.0.0.1", ListenPort: 18080} type API struct { Enabled bool `json:"enabled"` ListenHost string `json:"listenHost"` ListenPort int `json:"listenPort"` } -// XMRigSummary represents the full JSON response from the XMRig API. +// summary := XMRigSummary{}; json.Unmarshal(body, &summary); fmt.Println(summary.Hashrate.Highest) type XMRigSummary struct { ID string `json:"id"` WorkerID string `json:"worker_id"` @@ -337,7 +337,7 @@ type XMRigSummary struct { Hugepages []int `json:"hugepages"` } -// AvailableMiner represents a miner that is available for use. +// miner := AvailableMiner{Name: "xmrig", Description: "CPU/GPU miner for RandomX"} type AvailableMiner struct { Name string `json:"name"` Description string `json:"description"`