Apply go fix modernizations
This commit is contained in:
14
validate.go
14
validate.go
@@ -25,11 +25,11 @@ func (r *ValidationResult) addField(name, value string) {
|
||||
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...))
|
||||
}
|
||||
|
||||
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...))
|
||||
}
|
||||
|
||||
@@ -339,21 +339,21 @@ func validateArtPollReply(data []byte, src *net.UDPAddr, result *ValidationResul
|
||||
// Field 20: PortTypes[4]
|
||||
result.addField("PortTypes", fmt.Sprintf("[0x%02X, 0x%02X, 0x%02X, 0x%02X]",
|
||||
data[174], data[175], data[176], data[177]))
|
||||
for i := 0; i < 4; i++ {
|
||||
for i := range 4 {
|
||||
validatePortType(data[174+i], i, result)
|
||||
}
|
||||
|
||||
// Field 21: GoodInput[4]
|
||||
result.addField("GoodInput", fmt.Sprintf("[0x%02X, 0x%02X, 0x%02X, 0x%02X]",
|
||||
data[178], data[179], data[180], data[181]))
|
||||
for i := 0; i < 4; i++ {
|
||||
for i := range 4 {
|
||||
validateGoodInput(data[178+i], i, result)
|
||||
}
|
||||
|
||||
// Field 22: GoodOutputA[4]
|
||||
result.addField("GoodOutputA", fmt.Sprintf("[0x%02X, 0x%02X, 0x%02X, 0x%02X]",
|
||||
data[182], data[183], data[184], data[185]))
|
||||
for i := 0; i < 4; i++ {
|
||||
for i := range 4 {
|
||||
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))
|
||||
|
||||
// Fields 28-30: Spare (should be zero)
|
||||
for i := 0; i < 3; i++ {
|
||||
for i := range 3 {
|
||||
if data[197+i] != 0 {
|
||||
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]
|
||||
result.addField("GoodOutputB", fmt.Sprintf("[0x%02X, 0x%02X, 0x%02X, 0x%02X]",
|
||||
data[213], data[214], data[215], data[216]))
|
||||
for i := 0; i < 4; i++ {
|
||||
for i := range 4 {
|
||||
validateGoodOutputB(data[213+i], i, result)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user