fix: use tagged switch statements to satisfy staticcheck QF1002

Convert `switch { case r.URL.Path == ... }` to `switch r.URL.Path { ... }`
in Vault and DigiCert connector tests to pass golangci-lint CI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Shankar
2026-03-30 17:25:11 -04:00
parent 078ba5ab7b
commit 3044ddc171
2 changed files with 14 additions and 14 deletions
@@ -317,10 +317,10 @@ func TestVaultConnector(t *testing.T) {
t.Run("RevokeCertificate_Success", func(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch {
case r.URL.Path == "/v1/sys/health":
switch r.URL.Path {
case "/v1/sys/health":
w.WriteHeader(http.StatusOK)
case r.URL.Path == "/v1/pki/revoke":
case "/v1/pki/revoke":
// Verify token
if r.Header.Get("X-Vault-Token") == "" {
w.WriteHeader(http.StatusForbidden)
@@ -356,10 +356,10 @@ func TestVaultConnector(t *testing.T) {
t.Run("RevokeCertificate_ServerError", func(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch {
case r.URL.Path == "/v1/sys/health":
switch r.URL.Path {
case "/v1/sys/health":
w.WriteHeader(http.StatusOK)
case r.URL.Path == "/v1/pki/revoke":
case "/v1/pki/revoke":
w.WriteHeader(http.StatusBadRequest)
w.Write([]byte(`{"errors":["serial not found"]}`))
default:
@@ -390,8 +390,8 @@ func TestVaultConnector(t *testing.T) {
expectedPEM := "-----BEGIN CERTIFICATE-----\nTESTCA\n-----END CERTIFICATE-----\n"
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch {
case r.URL.Path == "/v1/pki/ca/pem":
switch r.URL.Path {
case "/v1/pki/ca/pem":
w.WriteHeader(http.StatusOK)
w.Write([]byte(expectedPEM))
default: