-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Makefile: add faillint to lint target - Issue 2142 #2143
Conversation
This is the output of the command:
All these packages import "errors", so they should be updated before merging this PR or builds will fail. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Some suggestions.
Makefile
Outdated
@@ -283,14 +285,18 @@ web: web-pre-process $(HUGO) | |||
# TODO(bwplotka): Make it --gc | |||
@cd $(WEB_DIR) && HUGO_ENV=production $(HUGO) --config hugo.yaml --minify -v -b $(WEBSITE_BASE_URL) | |||
|
|||
.PHONY: failint | |||
failint: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please let's add this to lint
command. We already have too many commands ;p
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I I know you added this as lint dep, but I think it might be more explicit when inlined in lint
command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense moving it inside of the lint
command although then we would have to wait for the whole linting to complete whenever we want to test (not a huge deal).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's ok (:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can put it in front of it if you think it's fast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I've fixed this, please let me know if you were thinking something different when you said to put it in front.
Makefile
Outdated
.PHONY: failint | ||
failint: | ||
@echo ">> verifying packages being imported" | ||
@faillint -paths $(IMPORTS_TO_AVOID) ./... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also let's install failint
as we do for other Go binaries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've followed the "Dependency management" section under the contributing guide. I've realized that if I run make deps
it removes the faillint
entries from go.sum
and go.mod
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And that's ok - check the binaries like $(MINIO_SERVER)
and how it install it and version. (: Can we mimic that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done (but check it, please)!
Would it be better to change pr title as "Makefile: add faillint to lint target"? |
Yeah, I like it better. Should I keep the reference to the issue No.? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall good, thanks for this! Some comments.
CHANGELOG.md
Outdated
@@ -678,3 +678,4 @@ Initial version to have a stable reference before [gossip protocol removal](/doc | |||
- Bucket commands. | |||
- Downsampling support for UI. | |||
- Grafana dashboards for Thanos components. | |||
- Failint for imported packages verification. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should not touch 0.1.0 release ;p
Also this is a tooling, not really relevant for Thanos users, so we don't need changelog entry. (:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was following the guide :) Removed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About not touching the 0.1.0 version, should I change the PR to a different branch instead of master?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Master is fine. Just you put the changelog entry at the bottom, but actually releases goes from newest to oldest.
Anyway, there should be no entry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, this should work I believe. But CI and DCO fails. You can click on those to learn why.
Thanks!
Curious, have you tested it? e.g put some not allowed imports and run it?
One of the tests was failing because of incorrect signing off of commits. The other test fails because of what I've mentioned in my second comment on this PR. There are 7 packages importing Also, yes, I've tested the correct behavior of the code (with different modules and also placing them under a directory called |
If I update this line: Then, in the output we get a suggestion of the correct module to import: Should we add the recommended modules for each of the ones to avoid? |
That would be amazing! Nice idea @kadern0! But please let's use the full path for imports if we can? Looks like we detected errors!
Do you mind changing those? Good job, can't wait to merge it! (: |
309c4d1
to
81b27b7
Compare
I've changed all the imports but now circleci is failing for some reason I don't understand. Could you please have a look? |
Signed-off-by: Pablo Caderno <[email protected]>
Signed-off-by: kaderno <[email protected]> Signed-off-by: Pablo Caderno <[email protected]>
Signed-off-by: Pablo Caderno <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the great work! @kadern0
CI failed but unrelated.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
LGTM! Let's merge on green!
* Added faillint Signed-off-by: Pablo Caderno <[email protected]> * Added faillint Signed-off-by: kaderno <[email protected]> Signed-off-by: Pablo Caderno <[email protected]> * Added faillint Signed-off-by: Pablo Caderno <[email protected]>
Fixes #2142
(I've included a line at the bottom of the Added section)
Changes
Added failint package with the paths specified within the issue description to 'make lint'
Verification
Manual execution of the command and output verification.