Skip to content

Commit

Permalink
Removed some unnecessary fallthrough statements (#1253)
Browse files Browse the repository at this point in the history
  • Loading branch information
toqueteos authored Aug 5, 2024
1 parent 72eb462 commit 83631c7
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 30 deletions.
12 changes: 3 additions & 9 deletions console/openapi-gen-angular/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,19 +382,15 @@ func convertType(prefixesToRemove []string, convertRefToClassName func(string) s
switch prop.Type {
case "string":
return "string"
case "integer":
fallthrough
case "number":
case "integer", "number":
return "number"
case "boolean":
return "boolean"
case "array":
switch prop.Items.Type {
case "string":
return "Array<string>"
case "integer":
fallthrough
case "number":
case "integer", "number":
return "Array<number>"
case "boolean":
return "Array<boolean>"
Expand All @@ -405,9 +401,7 @@ func convertType(prefixesToRemove []string, convertRefToClassName func(string) s
switch prop.AdditionalProperties.Type {
case "string":
return "Map<string, string>"
case "integer":
fallthrough
case "number":
case "integer", "number":
return "Map<string, number>"
case "boolean":
return "Map<string, boolean>"
Expand Down
9 changes: 1 addition & 8 deletions iap/iap.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,7 @@ func ValidateReceiptAppleWithUrl(ctx context.Context, httpc *http.Client, url, r
return sort.StringsAreSorted([]string{out.LatestReceiptInfo[j].ExpiresDateMs, out.LatestReceiptInfo[i].ExpiresDateMs})
})

switch out.Status {
case AppleReceiptIsFromTestSandbox:
fallthrough
case AppleReceiptIsValid:
fallthrough
default:
return &out, buf, nil
}
return &out, buf, nil
default:
return nil, nil, &ValidationError{
Err: ErrNon200ServiceApple,
Expand Down
4 changes: 1 addition & 3 deletions migrate/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,7 @@ func (ms *migrationService) parseParams(logger *zap.Logger, cmd, loggerFormat st

ms.loggerFormat = server.JSONFormat
switch strings.ToLower(loggerFormat) {
case "":
fallthrough
case "json":
case "", "json":
ms.loggerFormat = server.JSONFormat
case "stackdriver":
ms.loggerFormat = server.StackdriverFormat
Expand Down
4 changes: 1 addition & 3 deletions server/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ func SetupLogging(tmpLogger *zap.Logger, config Config) (*zap.Logger, *zap.Logge

format := JSONFormat
switch strings.ToLower(config.GetLogger().Format) {
case "":
fallthrough
case "json":
case "", "json":
format = JSONFormat
case "stackdriver":
format = StackdriverFormat
Expand Down
6 changes: 2 additions & 4 deletions server/socket_ws.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,10 @@ func NewSocketWsAcceptor(logger *zap.Logger, config Config, sessionRegistry Sess
// Check format.
var format SessionFormat
switch r.URL.Query().Get("format") {
case "", "json":
format = SessionFormatJson
case "protobuf":
format = SessionFormatProtobuf
case "json":
fallthrough
case "":
format = SessionFormatJson
default:
// Invalid values are rejected.
http.Error(w, "Invalid format parameter", 400)
Expand Down
4 changes: 1 addition & 3 deletions social/social.go
Original file line number Diff line number Diff line change
Expand Up @@ -886,9 +886,7 @@ func (c *Client) CheckFacebookLimitedLoginToken(ctx context.Context, appId strin

// Verify the issuer.
switch iss, _ := claims["iss"].(string); iss {
case "https://www.facebook.com":
fallthrough
case "https://facebook.com":
case "https://www.facebook.com", "https://facebook.com":
break
default:
return nil, fmt.Errorf("unexpected issuer: %v", claims["iss"])
Expand Down

0 comments on commit 83631c7

Please sign in to comment.