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

Feature/deal with swtch stmt #2

Merged
merged 6 commits into from Mar 22, 2019

Conversation

Matts966
Copy link

@Matts966 Matts966 commented Mar 7, 2019

fix #1

@@ -50,7 +70,56 @@ func run(pass *analysis.Pass) (interface{}, error) {
return
}

pass.Reportf(node.Pos(), "do not compare error with \"==\" or \"!=\"")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests didn't pass in my local environment maybe because the format of the report.

var causeFuncs = []string{
"TestCauseFunc", // For test

"github.com/pkg/errors.Cause",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to focus on xerrors only, in this project.
So please remove this one.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

var errType = types.Universe.Lookup("error").Type().Underlying().(*types.Interface)

var causeFuncs = []string{
"TestCauseFunc", // For test
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can test with xerrors.Unwrap.
So please remove this one.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@sachaos sachaos merged commit f193773 into sachaos:master Mar 22, 2019
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.

Deal with the edge case in switch-case syntax.
2 participants