fix(scep-probe): satisfy staticcheck QF1008 in describeCertAlgorithm

CI flagged QF1008 on the chained selector pub.Curve.Params() — the
linter wants the promoted-method form pub.Params() (Curve is embedded
in ecdsa.PublicKey, so Params is reachable via promotion). Restructure
the nil check so the embedded interface still gets validated before the
promoted call, then invoke pub.Params() once and reuse the result.

Verification:
  * gofmt clean
  * staticcheck on internal/service/...: clean
  * 6/6 TestProbeSCEP_* tests still pass
This commit is contained in:
shankar0123
2026-04-29 19:00:05 +00:00
parent 506cff137d
commit 84fac19f98
+9 -2
View File
@@ -322,8 +322,15 @@ func describeCertAlgorithm(c *x509.Certificate) string {
case *rsa.PublicKey:
return fmt.Sprintf("RSA-%d", pub.N.BitLen())
case *ecdsa.PublicKey:
if pub.Curve != nil && pub.Curve.Params() != nil {
return "ECDSA-" + pub.Curve.Params().Name
// Curve is embedded in ecdsa.PublicKey; check the interface
// itself for nil before calling Params() via promotion (QF1008
// — staticcheck wants the promoted-method form, not the
// chained selector). Still need the nil check because
// calling Params() on a nil embedded interface would panic.
if pub.Curve != nil {
if params := pub.Params(); params != nil {
return "ECDSA-" + params.Name
}
}
return "ECDSA"
}