Skip to content

Commit ce343fc

Browse files
committed
lint: core/wire icmp header Stringer
1 parent 6b7e548 commit ce343fc

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

intra/core/wire/icmp6.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (t ICMP6Type) String() string {
4949
case ICMP6EchoReply:
5050
return "EchoReply"
5151
default:
52-
return "Unknown"
52+
return "Unknown " + string(t)
5353
}
5454
}
5555

intra/core/wire/parsed.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,10 +388,11 @@ func (q *Parsed) IP6Header() IP6Header {
388388
}
389389

390390
func (q *Parsed) ICMPHeaderString() string {
391-
if q.IPProto == ICMPv4 {
392-
return fmt.Sprint("%s", q.ICMP4Header())
393-
} else if q.IPProto == ICMPv6 {
394-
return fmt.Sprint("%s", q.ICMP6Header())
391+
switch q.IPProto {
392+
case ICMPv4:
393+
return fmt.Sprintf("%v", q.ICMP4Header())
394+
case ICMPv6:
395+
return fmt.Sprintf("%v", q.ICMP6Header())
395396
}
396397
return "ICMP{???}"
397398
}

0 commit comments

Comments
 (0)