blizzy78 / varnamelen

Go analyzer checking that the length of a variable's name matches its usage scope

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ok pattern

1995parham opened this issue · comments

There are cases like:

id, ok := claims["user_id"].(int)
if !ok {
}

which ok is a known pattern.

Good point. I've just added the -ignoreTypeAssertOk flag that will allow to ignore ok variables that hold the bool return value of a type assertion.

I will also add similar flags for the bool return values of channel receive and map index.

The ok variable name will be hard-coded for the time being.

Thank you for your attention and work 👍