Apply go fix modernizations

This commit is contained in:
Ian Gulliver
2026-03-05 11:39:11 -08:00
parent 9fcc19ba9e
commit 3c0648f921

View File

@@ -25,11 +25,11 @@ func (r *ValidationResult) addField(name, value string) {
r.Fields = append(r.Fields, FieldInfo{Name: name, Value: value}) r.Fields = append(r.Fields, FieldInfo{Name: name, Value: value})
} }
func (r *ValidationResult) addError(format string, args ...interface{}) { func (r *ValidationResult) addError(format string, args ...any) {
r.Errors = append(r.Errors, fmt.Sprintf(format, args...)) r.Errors = append(r.Errors, fmt.Sprintf(format, args...))
} }
func (r *ValidationResult) addWarning(format string, args ...interface{}) { func (r *ValidationResult) addWarning(format string, args ...any) {
r.Warnings = append(r.Warnings, fmt.Sprintf(format, args...)) r.Warnings = append(r.Warnings, fmt.Sprintf(format, args...))
} }
@@ -339,21 +339,21 @@ func validateArtPollReply(data []byte, src *net.UDPAddr, result *ValidationResul
// Field 20: PortTypes[4] // Field 20: PortTypes[4]
result.addField("PortTypes", fmt.Sprintf("[0x%02X, 0x%02X, 0x%02X, 0x%02X]", result.addField("PortTypes", fmt.Sprintf("[0x%02X, 0x%02X, 0x%02X, 0x%02X]",
data[174], data[175], data[176], data[177])) data[174], data[175], data[176], data[177]))
for i := 0; i < 4; i++ { for i := range 4 {
validatePortType(data[174+i], i, result) validatePortType(data[174+i], i, result)
} }
// Field 21: GoodInput[4] // Field 21: GoodInput[4]
result.addField("GoodInput", fmt.Sprintf("[0x%02X, 0x%02X, 0x%02X, 0x%02X]", result.addField("GoodInput", fmt.Sprintf("[0x%02X, 0x%02X, 0x%02X, 0x%02X]",
data[178], data[179], data[180], data[181])) data[178], data[179], data[180], data[181]))
for i := 0; i < 4; i++ { for i := range 4 {
validateGoodInput(data[178+i], i, result) validateGoodInput(data[178+i], i, result)
} }
// Field 22: GoodOutputA[4] // Field 22: GoodOutputA[4]
result.addField("GoodOutputA", fmt.Sprintf("[0x%02X, 0x%02X, 0x%02X, 0x%02X]", result.addField("GoodOutputA", fmt.Sprintf("[0x%02X, 0x%02X, 0x%02X, 0x%02X]",
data[182], data[183], data[184], data[185])) data[182], data[183], data[184], data[185]))
for i := 0; i < 4; i++ { for i := range 4 {
validateGoodOutputA(data[182+i], i, result) validateGoodOutputA(data[182+i], i, result)
} }
@@ -413,7 +413,7 @@ func validateArtPollReply(data []byte, src *net.UDPAddr, result *ValidationResul
result.addField("SwRemote", fmt.Sprintf("0x%02X", swRemote)) result.addField("SwRemote", fmt.Sprintf("0x%02X", swRemote))
// Fields 28-30: Spare (should be zero) // Fields 28-30: Spare (should be zero)
for i := 0; i < 3; i++ { for i := range 3 {
if data[197+i] != 0 { if data[197+i] != 0 {
result.addWarning("Spare byte at offset %d is 0x%02X (should be 0)", 197+i, data[197+i]) result.addWarning("Spare byte at offset %d is 0x%02X (should be 0)", 197+i, data[197+i])
} }
@@ -468,7 +468,7 @@ func validateArtPollReply(data []byte, src *net.UDPAddr, result *ValidationResul
// Field 41: GoodOutputB[4] // Field 41: GoodOutputB[4]
result.addField("GoodOutputB", fmt.Sprintf("[0x%02X, 0x%02X, 0x%02X, 0x%02X]", result.addField("GoodOutputB", fmt.Sprintf("[0x%02X, 0x%02X, 0x%02X, 0x%02X]",
data[213], data[214], data[215], data[216])) data[213], data[214], data[215], data[216]))
for i := 0; i < 4; i++ { for i := range 4 {
validateGoodOutputB(data[213+i], i, result) validateGoodOutputB(data[213+i], i, result)
} }
} }