Skip to content

Conversation

@rogercoll
Copy link
Contributor

@rogercoll rogercoll commented Nov 13, 2025

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.

@rogercoll rogercoll changed the title fix: enable golangci formatters exec chore: enable golangci formatters exec Nov 13, 2025
@rogercoll
Copy link
Contributor Author

Enables gofmt execution with the already configured golangci tool, closes #949

@rogercoll rogercoll marked this pull request as ready for review November 13, 2025 12:27
@rogercoll rogercoll requested review from a team as code owners November 13, 2025 12:27
Copy link
Contributor

@fabled fabled left a 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"
Copy link
Contributor

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.

Copy link
Contributor Author

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]>
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.

3 participants