-
Notifications
You must be signed in to change notification settings - Fork 11
CHANGELOG
Note: This changelog file lists notable changes in a given tag in comparison to the previous tag.
-
Breaking change:
exhaustive
now strictly follows thego/ast
definition for associated comments. Previously directive comments would have been associated with the switch statement.switch x { //exhaustive:ignore
Now they must be moved like so to have effect:
//exhaustive:ignore switch x { //exhaustive:ignore
-
Add
-explicit-exhaustive-switch
flag. The description for the flag is: only run exhaustive check on switches with "//exhaustive:enforce" comment. -
Fix issue 37. Previously, due to a bug in the comment association logic, exhaustive would have inadvertently missed to check inner (i.e. nested) switch statements if a parent switch statement was marked "//exhaustive:ignore". This has been fixed such that the inner switch statement is now checked. (To ignore the inner switch statement, you should explicitly mark it with "//exhaustive:ignore".)
-
Upgrade to the latest
x/tools
.
- Documentation changes.
- Switch links from pkg.go.dev to godocs.io.
Documentation improvements.
Fix detection of generated files. Account for this requirement:
This line must appear before the first non-comment, non-blank text in the file.
http://golang.org/s/generatedcode
- Dot-imported package constants in case clause work correctly; previously they would be incorrectly reported as missing in the switch.
- Improve support for same-valued type alias constants.
IgnoreDirectivePrefix
constant no longer exported. (Its behavior
still remains the same though.)
Rename PackageScopeOnly
constant to PackageScopeOnlyFlag
.
- Address issue #13: define/implement behavior for checking exhaustiveness of type aliased enums. The related documentation is available in the package comment in file doc.go or can be found on the pkg.go.dev page, under the new section 'Exhaustiveness and type aliases'.
- Fix issue #23: same-named enum type in package scope and in inner scope could produce incorrect diagnostic.
- Address issue #11: The analyzer can now find enums defined in non-package scopes (e.g. inside function body). Switch statements using non-package scoped enums can now be checked for exhaustiveness.
- The new flag
-package-scope-only
controls the behavior described in the previous item. If enabled, only package-scoped enums are detected. The flag is off by default, which means that enums in inner scopes will also be found. If you encounter an issue with the new behavior, set-package-scope-only
and create an issue. - Documentation changes.
- Flag
-checking-strategy
is deprecated and no longer has any effect. The default checking strategy"value"
is the strategy in use and is the only available strategy. - Internal: The analyzer code assumes that constant values can always be determined
for enum members. This should be a valid assumption because only
const
can be enum members.
-
var
declarations cannot be enum members; onlyconst
can be.
- Previously the analzyer incorrectly determined constant values for enum members; this has been fixed. This is noticable in e.g. iota constants.
- Previously the analzyer failed to determine constant values for enum members when it could have; this has been fixed. This is most noticable for iota constants.
- If pass.ImportPackageFact fails, it is reported as a diagnostic via pass.Report. Previously this would result in a returned error from the Analzyer's Run function.
- The
golang.org/x/tools
dependency has been upgraded.
Fixed a bug in detection of generated files; the following comment was incorrectly detected as indicative of a generated file.
// Code generated DO NOT EDIT.
Documentation changes.
Documentation changes.
Documentation changes.
Documentation changes.
- The flag
-ignore-pattern
has no effect and is deprecated. Instead see the new flag-ignore-enum-members
, which has the same syntax and behavior. - A new
-checking-strategy
flag has been added; see package documentation for details. - The analyzer no longer suggests fixes.
(No changelog available.)