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
Move errcheck package out of internal #185
Conversation
Signed-off-by: Eric Chlebek <eric@sensu.io>
Signed-off-by: Eric Chlebek <eric@sensu.io>
Signed-off-by: Eric Chlebek <eric@sensu.io>
@kisielk @echlebek So, I have tested it with But I see a huge degradation in the performance due to loading the packages twice. @echlebek Could you split the CheckPackages function to two but moving this code: https://github.com/kisielk/errcheck/blob/master/internal/errcheck/errcheck.go#L241-L260 to a separate function. Or I can raise a PR to this branch with the changes |
@SVilgelm glad to hear it works. I think we'll be making some changes to the API as in the comments above, let me know what you think. As far as the performance aspect, I think |
@dtcaciuc do you want to make a PR to this branch with the proposed changes? |
hmm, I just found that you are using the |
found a workaround, @echlebek I will raise a pr to this branch with my changes |
I understand, that you are going to change the configuration, but may I ask you to do it in separate pull request? That changes are backward incompatible and I'm not sure we can easy incorporate new config structure in golangci-lint, but will see |
I understand that, but I don't really want to mKe the API public and then immediately change it afterwards. Apart from naming it shouldn't be that different from the current one so I don't really see why it would be any more difficult to integrate. |
ok, if only naming, then probably we can keep old names in current release and update them in v2 of golangci-lint Making the api public is not backward incompatible, but changing the config structure is |
CheckPackage function
I've taken the liberty of modifying the incoming changes somewhat. The UpdateNonVendoredIgnore function has been renamed, unexported, and made to return data instead of setting it.
Independent of whether go mod is used or not, simply strip off vendor directory prefix from both imports and excludes if it was found.
Simplify vendored package resolution.
Factor out exclusion flags into a separate struct
I've merged Dimitri's PR and I've tagged this branch at v1.5.0-alpha. The errcheck project now has a stable API, in the errcheck package, that can be used by linter aggregators. We don't expect to break this API until v2, once it is published as v1.5.0. The errcheck package stutters a bit, because it is nested in the top level directory of the repository. Since errcheck was originally published as a tool, with package main in the repo root, we felt that it would be a breaking change to move the API to the repository root, even if it would result in a nicer looking import path. The errcheck tool remains the same as before, with no functionality removed. I've reviewed the godoc for the API and it looks fairly usable. More importantly, it is fairly minimal, which should make future expansions less troublesome. |
I've been doing a bit more work on this. We may want to revisit the signature of CheckPackage. It returns I'm about to make a PR to this branch that removes |
Probably would be better to make a |
I've encountered some difficulty with the tests while refactoring. They're tightly coupled to |
Maybe just a helper function for the tests would do the job? |
This commit removes the CheckPaths method of Checker. It also adds a method called LoadPackages, and exports more of the logic that errcheck uses to do aggregation. The UncheckedErrors type has been renamed to Result, and the CheckPackage function now returns a *Result instead of []UncheckedErrors. Signed-off-by: Eric Chlebek <eric@sensu.io>
Signed-off-by: Eric Chlebek <eric@sensu.io>
Signed-off-by: Eric Chlebek <eric@sensu.io>
Signed-off-by: Eric Chlebek <eric@sensu.io>
As suggested by dtcaciuc Signed-off-by: Eric Chlebek <eric@sensu.io>
Signed-off-by: Eric Chlebek <eric@sensu.io>
Remove CheckPaths
Is there anything left to do before this PR could be merged? |
Signed-off-by: Eric Chlebek <eric@sensu.io>
Signed-off-by: Eric Chlebek <eric@sensu.io>
Allows using errcheck as a library. This will be more feasible now that we have versioning.
Signed-off-by: Eric Chlebek eric@sensu.io