-
Notifications
You must be signed in to change notification settings - Fork 354
chore: enable golangci formatters exec #960
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
base: main
Are you sure you want to change the base?
Conversation
|
Enables |
fabled
left a comment
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.
Thank you!
Makefile
Outdated
| lint: generate vanity-import-check pprof-execs | ||
| $(MAKE) lint -C support/ebpf | ||
| docker run --rm -t -v $$(pwd):/app -w /app golangci/golangci-lint:$(GOLANGCI_LINT_VERSION) sh -c "golangci-lint version && golangci-lint config verify && golangci-lint run --max-issues-per-linter -1 --max-same-issues -1" | ||
| docker run --rm -t -v $$(pwd):/app -w /app golangci/golangci-lint:$(GOLANGCI_LINT_VERSION) sh -c "golangci-lint version && golangci-lint config verify && golangci-lint run --max-issues-per-linter -1 --max-same-issues -1 && golangci-lint fmt" |
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.
As docker in docker is always a painful experience, should we just use golangci-lint as part of go tool?
# One time setup:
go mod init -modfile=tools.mod go.opentelemetry.io/ebpf-profiler
go get -tool -modfile=tools.mod github.com/golangci/golangci-lint/v2/cmd/[email protected]
# Run golangci-lint
make generate
make generate pprof-execs
go tool -modfile=tools.mod golangci-lint run && go tool -modfile=tools.mod golangci-lint fmt
This would also speed up CI, as pulling docker images is no longer required. With the dedicated tools.mod file, tooling like that is also separated from the rest of the project.
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.
Yes, I am in favor of using Go's tools chain tools. Changed in 28d1206
Co-authored-by: Florian Lehner <[email protected]>
Golangci formatters were not running. This PR adds a command to format the code using golangci and making the CI fail if not formatted accordingly.