Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor and unit test switch.go; various other changes #19

Merged
merged 45 commits into from
Nov 2, 2021

Conversation

nishanths
Copy link
Owner

@nishanths nishanths commented Nov 2, 2021

Switch.go refactor and testing

Refactor code in switch.go to be unit-testable. Add some unit tests in switch_test.go.

Deprecate -ignore-pattern flag

The -ignore-pattern flag is deprecated and has no effect. Add -ignore-enum-members,
which has the same behavior, instead. Update the docs accordingly.

Support checking strategies

The new -checking-strategy flag can be used to specify a checking strategy, one of
"value" or "name". The default strategy is "value", which retains the existing behavior,
of requiring every enum member value to be listed in a switch statement.
The "name" strategy requires every enum member name to be listed in a switch
statement.

Add related docs in doc.go.

Add tests for this change in the testdata packages "duplicateenumvalue/...".

Analyzer does not suggest fixes

The "-fix" flag is now a no-op. The analyzer no longer reports any suggested fixes.
Also remove source code and testdata related to this flag. Update doc.go
accordingly.

CI

Include Go 1.14 explicitly in CI matrix. (This is to match with the go version in go.mod.)

Repo documentation

Add a separate CONTRIBUTING file. General corrections and updates to README.

Other changes

Improve gob-compatibility testing of fact types.

@nishanths nishanths marked this pull request as ready for review November 2, 2021 22:48
@nishanths nishanths merged commit 895760b into master Nov 2, 2021
@nishanths nishanths deleted the nishanth/switch.go-tests branch November 2, 2021 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant