-
Notifications
You must be signed in to change notification settings - Fork 8
golangci-lint multi-module: Use $CURDIR to pin down execdir #40
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
Conversation
Signed-off-by: Thomas Stromberg <t+github@chainguard.dev>
| } | ||
|
|
||
| return fmt.Sprintf(`find . -name go.mod -execdir "$(GOLANGCI_LINT_BIN)" run -c "$(GOLINT_CONFIG)"%s \;`, suffix) | ||
| return fmt.Sprintf(`find . -name go.mod -execdir "$(CURDIR)/$(GOLANGCI_LINT_BIN)" run -c "$(GOLINT_CONFIG)"%s \;`, suffix) |
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.
We already have LINT_ROOT which I think we should use instead of CURDIR, to avoid having 2 variables with similar values. Also, I think it would be better to update the TOOL_BIN variable(s) in Makefile.tmpl instead of fixing here. That way the Makefiles are where most of the logic lives and the go binary is mostly just dealing with enabling certain functionality. We wouldn't be mixing logic among 2 different processes/times ("buildtime" and "runtime"). We should probably just do this for all the 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.
@tstromberg thoughts on this?
With fixes from tinkerbell/lint-install#40 applied manually. Signed-off-by: Manuel Mendez <github@i.m.mmlb.dev>
With fixes from tinkerbell/lint-install#40 applied manually. Signed-off-by: Manuel Mendez <github@i.m.mmlb.dev>
With fixes from tinkerbell/lint-install#40 applied manually. Signed-off-by: Manuel Mendez <github@i.m.mmlb.dev>
With fixes from tinkerbell/lint-install#40 applied manually. Signed-off-by: Manuel Mendez <github@i.m.mmlb.dev>
|
Hey @tstromberg I've opened up #45 with my version of these fixes. I also noticed that in multi-module mode no config file is actually used so fixed that too. I say lets go with #45 over this one, wdyt? |
## Description * Uses full paths to executables, so changed dirs don't matter * Switches to always using `find -execdir` to run golangci-lint to avoid an seldomly used corner case bit rotting * Uses the correct variable name for the golangci-lint config file ## Why is this needed Fixes: #39 Closes: #40 ## How Has This Been Tested? Ran `make lint` a bunch in hook to make sure it works. ## How are existing users impacted? What migration steps/scripts do we need? golangci-lint will actually run if multiple modules are detected (or added w/o having to re-run lint-install).
With fixes from tinkerbell/lint-install#40 applied manually. Signed-off-by: Manuel Mendez <github@i.m.mmlb.dev>
With fixes from tinkerbell/lint-install#40 applied manually. Signed-off-by: Manuel Mendez <github@i.m.mmlb.dev>
With fixes from tinkerbell/lint-install#40 applied manually. Signed-off-by: Manuel Mendez <github@i.m.mmlb.dev>
Signed-off-by: Thomas Stromberg t+github@chainguard.dev
Description
Fixes broken behavior with repositories containing multiple go packages. This change ensures that the successive find command are able to locate the path to golangci-lint properly.
Why is this needed
Fixes: #39
How Has This Been Tested?
Ran
make golangci-lint-lintin a repo containing ~40 go packages