Fix golangci-lint checks

This commit is contained in:
Michael Panzlaff
2026-07-07 16:51:06 +02:00
parent 025a5c2861
commit f6d33fb29f
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -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")
}
// data is layed out like this:
// data is laid out like this:
// data[0 to 1]: FIFO index of value (for debug only)
// data[2 to 5]: Integer part of energy in J (little endian)
// data[6 to 7]: Fraction part of energy in mJ (little endian)
+4 -4
View File
@@ -88,7 +88,7 @@ func (m *MegwareEurekaCollector) Init(config json.RawMessage) error {
data, err := m.readMpsData()
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
@@ -115,16 +115,16 @@ func (m *MegwareEurekaCollector) readMpsData() (*mpsData, error) {
err := cmd.Run()
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 {
GetMpsPollValues mpsData `json:"GET_MPS_POLL_VALUES"`
}
err = json.Unmarshal([]byte(stdout.String()), &u20output)
err = json.Unmarshal(stdout.Bytes(), &u20output)
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())