Skip to content
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

golangci: try to set up golangci #43

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ccoVeille
Copy link
Collaborator

The ebpf libraries are not helping at all.

@ccoVeille ccoVeille force-pushed the golangci-lint branch 6 times, most recently from 8fbbd9c to d59304c Compare September 8, 2024 14:35
The ebpf libraries are not helping at all.

Fix alegrey91#28
@ccoVeille
Copy link
Collaborator Author

@alegrey91 Please review

I suggest you to consider merging it, and fixing the issues one by one

I set up the test as non-blocking, I could separate the golangci-lint in a dedidated jobs, just tell me

if you want to launch golangci-lint locally please use the following command

golangci-lint run internal/analyzer internal/archiver internal/elfreader internal/embeddable internal/executor internal/metadata harpoon/internal/privileged internal/seccomputils internal/w
riter

@alegrey91
Copy link
Owner

This solution doesn't work well. We can't remember to add any new packages to the list of the lint.
Maybe is better to add a non-linting directive on top of the ebpf library functions.

@alegrey91
Copy link
Owner

Additionally, I would keep this job in a dedicated pipeline for linting.

@ccoVeille
Copy link
Collaborator Author

This solution doesn't work well. We can't remember to add any new packages to the list of the lint.
Maybe is better to add a non-linting directive on top of the ebpf library functions.

I know it's a pain.

I wanted to proof it was possible.

We will have to look at GitHub action on how to pass the list of package.

There is unfortunately no way to ask a linter to ignore a file. It reads everything, and any typecheck issue are breaking everything.

It's what is happening with this file depending on the external lib.

There might be a way to refactor, by using distinct modules in the code, but it would need a huge rewrite.

@ccoVeille
Copy link
Collaborator Author

Additionally, I would keep this job in a dedicated pipeline for linting.

Noted. I will split it when I have a chance to look at a way to set a variable by calling a shell command or script

@alegrey91
Copy link
Owner

I know it's a pain.

I wanted to proof it was possible.

We will have to look at GitHub action on how to pass the list of package.

There is unfortunately no way to ask a linter to ignore a file. It reads everything, and any typecheck issue are breaking everything.

It's what is happening with this file depending on the external lib.

There might be a way to refactor, by using distinct modules in the code, but it would need a huge rewrite

What about something like this?
https://stackoverflow.com/questions/65985835/how-skip-file-in-golangci-lint

@ccoVeille
Copy link
Collaborator Author

I don't expect this to work, but they are among the idea I plan to try

@ccoVeille
Copy link
Collaborator Author

Here is it what we could use to store the list of packages by using the grep command you had

thomast1906/thomasthorntoncloud-examples#92

Another solution could be to split the code that can be tested in a package in internal and leave the one that depends on the external lib in another.

Something like:

cmd
internal/ok/
internal/lib/

This way you only test and run golangci-lint-config-examples on internal/ok

@ccoVeille ccoVeille marked this pull request as draft September 12, 2024 17:52
@alegrey91
Copy link
Owner

what if we use something like instead?

skip-dirs:
    - internal/ebpf
    - ebpf/

This would be easier

@ccoVeille
Copy link
Collaborator Author

It cannot work unfortunately. Longtime debated in golangci-lint ecosystem. golangci-lint has to parse everything, but if it finds code that cannot be compiled. It would fail. So using skipdir cannot work.

It's worth trying, but I'm pretty sure it won't work the way we need.

Note: I'm busy with family this weekend, I cannot try it.

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.

2 participants