-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
exhaustive: upgrade to v0.3.6; add new flags and deprecate old ones (#…
- Loading branch information
Showing
12 changed files
with
93 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
linters-settings: | ||
exhaustive: | ||
checking-strategy: "name" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
linters-settings: | ||
exhaustive: | ||
checking-strategy: "value" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
linters-settings: | ||
exhaustive: | ||
ignore-enum-members: "West$" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//args: -Eexhaustive | ||
//config_path: testdata/configs/exhaustive_checking_strategy_name.yml | ||
package testdata | ||
|
||
type AccessControl string | ||
|
||
const ( | ||
AccessPublic AccessControl = "public" | ||
AccessPrivate AccessControl = "private" | ||
AccessDefault AccessControl = AccessPublic | ||
) | ||
|
||
func example(v AccessControl) { | ||
switch v { // ERROR "missing cases in switch of type AccessControl: AccessDefault" | ||
case AccessPublic: | ||
case AccessPrivate: | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//args: -Eexhaustive | ||
//config_path: testdata/configs/exhaustive_checking_strategy_value.yml | ||
package testdata | ||
|
||
type AccessControl string | ||
|
||
const ( | ||
AccessPublic AccessControl = "public" | ||
AccessPrivate AccessControl = "private" | ||
AccessDefault AccessControl = AccessPublic | ||
) | ||
|
||
// Expect no diagnostics for this switch statement, even though AccessDefault is | ||
// not listed, because AccessPublic (which is listed) has the same value as | ||
// AccessDefault. | ||
|
||
func example(v AccessControl) { | ||
switch v { | ||
case AccessPublic: | ||
case AccessPrivate: | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//args: -Eexhaustive | ||
//config_path: testdata/configs/exhaustive_ignore_enum_members.yml | ||
package testdata | ||
|
||
type Direction int | ||
|
||
const ( | ||
North Direction = iota | ||
East | ||
South | ||
West | ||
) | ||
|
||
// Should only report East as missing because the enum member West is ignored | ||
// using the ignore-enum-members setting. | ||
|
||
func processDirectionIgnoreEnumMembers(d Direction) { | ||
switch d { // ERROR "missing cases in switch of type Direction: East" | ||
case North, South: | ||
} | ||
} |