mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2026-07-11 04:00:38 +02:00
Fix golangci-lint checks
This commit is contained in:
@@ -110,7 +110,7 @@ func (m *LenovoDensePowerCollector) readEnergy() (float64, time.Time, error) {
|
|||||||
return 0, time.Unix(0, 0), fmt.Errorf("result must be 14 bytes as specified in the documentation")
|
return 0, time.Unix(0, 0), fmt.Errorf("result must be 14 bytes as specified in the documentation")
|
||||||
}
|
}
|
||||||
|
|
||||||
// data is layed out like this:
|
// data is laid out like this:
|
||||||
// data[0 to 1]: FIFO index of value (for debug only)
|
// data[0 to 1]: FIFO index of value (for debug only)
|
||||||
// data[2 to 5]: Integer part of energy in J (little endian)
|
// data[2 to 5]: Integer part of energy in J (little endian)
|
||||||
// data[6 to 7]: Fraction part of energy in mJ (little endian)
|
// data[6 to 7]: Fraction part of energy in mJ (little endian)
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ func (m *MegwareEurekaCollector) Init(config json.RawMessage) error {
|
|||||||
|
|
||||||
data, err := m.readMpsData()
|
data, err := m.readMpsData()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Energy reading test failed: %w", err)
|
return fmt.Errorf("energy reading test failed: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
m.energyValLast = data.Energy
|
m.energyValLast = data.Energy
|
||||||
@@ -115,16 +115,16 @@ func (m *MegwareEurekaCollector) readMpsData() (*mpsData, error) {
|
|||||||
|
|
||||||
err := cmd.Run()
|
err := cmd.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("Failed to run u20: %w (stdout=%s stderr=%s)", err, stdout.String(), stderr.String())
|
return nil, fmt.Errorf("failed to run u20: %w (stdout=%s stderr=%s)", err, stdout.String(), stderr.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
var u20output struct {
|
var u20output struct {
|
||||||
GetMpsPollValues mpsData `json:"GET_MPS_POLL_VALUES"`
|
GetMpsPollValues mpsData `json:"GET_MPS_POLL_VALUES"`
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(stdout.String()), &u20output)
|
err = json.Unmarshal(stdout.Bytes(), &u20output)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("Unable to decode u20 JSON output: %w (stdout=%s)", err, stdout.String())
|
return nil, fmt.Errorf("unable to decode u20 JSON output: %w (stdout=%s)", err, stdout.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("string: %+v\n", stdout.String())
|
fmt.Printf("string: %+v\n", stdout.String())
|
||||||
|
|||||||
Reference in New Issue
Block a user