diff --git a/dnsping.go b/dnsping.go index edc596c..6e84fd2 100644 --- a/dnsping.go +++ b/dnsping.go @@ -28,6 +28,7 @@ import ( "fortio.org/cli" "fortio.org/fortio/stats" "fortio.org/log" + "fortio.org/safecast" "github.com/miekg/dns" ) @@ -178,9 +179,9 @@ func DNSPing(cfg *DNSPingConfig) *DNSPingResults { } switch { case cfg.FixedID != 0: - m.Id = uint16(cfg.FixedID) + m.Id = safecast.MustConvert[uint16](cfg.FixedID) case cfg.SequentialIDs: - m.Id = uint16(i) // might wrap but it's fine + m.Id = uint16(i) //nolint:gosec we do want to wrap, it's fine. default: m.Id = dns.Id() } diff --git a/go.mod b/go.mod index 983f1f0..058281a 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( fortio.org/cli v1.9.0 fortio.org/fortio v1.66.3 fortio.org/log v1.16.0 + fortio.org/safecast v0.1.1 fortio.org/testscript v0.3.2 github.com/miekg/dns v1.1.61 ) diff --git a/go.sum b/go.sum index 9ae2bbf..5c2be75 100644 --- a/go.sum +++ b/go.sum @@ -6,6 +6,8 @@ fortio.org/fortio v1.66.3 h1:N/Ic9W2tVoJ5LAcr8ZjcF3mNb2ftCw77ZtKF02jwf8Q= fortio.org/fortio v1.66.3/go.mod h1:+W7ooyLn/Fp3h0UF9JclFEJN50EOvelO6c+VhCYGwnM= fortio.org/log v1.16.0 h1:GhU8/9NkYZmEIzvTN/DTMedDAStLJraWUUVUA2EbNDc= fortio.org/log v1.16.0/go.mod h1:t58Spg9njjymvRioh5F6qKGSupEsnMjXLGWIS1i3khE= +fortio.org/safecast v0.1.1 h1:lKSckzBVCbeJXTNUiAvBdplYUafEHM9BahrP46WgPEQ= +fortio.org/safecast v0.1.1/go.mod h1:xZmcPk3vi4kuUFf+tq4SvnlVdwViqf6ZSZl91Jr9Jdg= fortio.org/struct2env v0.4.1 h1:rJludAMO5eBvpWplWEQNqoVDFZr4RWMQX7RUapgZyc0= fortio.org/struct2env v0.4.1/go.mod h1:lENUe70UwA1zDUCX+8AsO663QCFqYaprk5lnPhjD410= fortio.org/testscript v0.3.2 h1:ks5V+Y6H6nmeGqnVlZuLdiFwpqXemDkEnyGgCZa/ZNA=