superfly / flyctl

switch with single case can be rewritten as if or if-else CRT-A0014
Anti-pattern
Minor
a month ago4 years old
should rewrite switch statement to if statement
51
52func describeRedisPlan(ctx context.Context, p plan.RedisPlan, org *fly.Organization) (string, error) {
53
54	switch provider := p.Provider().(type) {55	case *plan.UpstashRedisPlan:
56		return describeUpstashRedisPlan(ctx, provider, org)
57	}
should rewrite switch statement to if statement
 92	}
 93
 94	toks, err := macaroon.Parse(token)
 95	switch { 96	case errors.Is(err, macaroon.ErrUnrecognizedToken):
 97		return nil, fmt.Errorf("unable to parse token: %w", err)
 98	}
should rewrite switch statement to if statement
 7
 8func containsCommonSecretSubstring(s string) bool {
 9	// Allowlist for strings which contain a substring but are not secrets.
10	switch s {11	case "AWS_ACCESS_KEY_ID":
12		return false
13	}