mirror of
https://github.com/mgechev/revive.git
synced 2025-11-23 22:04:49 +02:00
feature: detect identical-branches in switch statements (#1448)
This commit is contained in:
@@ -480,8 +480,8 @@ func checkURLTag(checkCtx *checkContext, tag *structtag.Tag, _ ast.Expr) (messag
|
||||
var delimiter = ""
|
||||
for _, opt := range tag.Options {
|
||||
switch opt {
|
||||
case "int", "omitempty", "numbered", "brackets":
|
||||
case "unix", "unixmilli", "unixnano": // TODO : check that the field is of type time.Time
|
||||
case "int", "omitempty", "numbered", "brackets",
|
||||
"unix", "unixmilli", "unixnano": // TODO : check that the field is of type time.Time
|
||||
case "comma", "semicolon", "space":
|
||||
if delimiter == "" {
|
||||
delimiter = opt
|
||||
@@ -597,9 +597,7 @@ func typeValueMatch(t ast.Expr, val string) bool {
|
||||
case "int":
|
||||
_, err := strconv.ParseInt(val, 10, 64)
|
||||
typeMatches = err == nil
|
||||
case "string":
|
||||
case "nil":
|
||||
default:
|
||||
default: // "string", "nil", ...
|
||||
// unchecked type
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user