golangci-lint should ignore node_modules #8576

Closed
opened 2025-11-02 08:11:32 -06:00 by GiteaMirror · 8 comments
Owner

Originally created by @silverwind on GitHub (Feb 18, 2022).

CI failure seen on https://drone.gitea.io/go-gitea/gitea/51286/1/6

It seems golangi-lint tries to access files in node_modules which is completely unnecessary and likely a reason for its long runtime. It might be possible to pass a list of files to it via https://github.com/golangci/golangci-lint/issues/301#issuecomment-441311986, thought I'm not sure whether that usage actually works (https://github.com/golangci/golangci-lint/issues/2568).

I recently added the skip-dirs option at https://github.com/go-gitea/gitea/blob/1ab88da0e460a076a95dcd2cad812e707da3acc9/.golangci.yml#L27-L30 but it does not seem to help because not all of their "linters" seem to honour the option (https://github.com/golangci/golangci-lint/issues/913).

Originally created by @silverwind on GitHub (Feb 18, 2022). CI failure seen on https://drone.gitea.io/go-gitea/gitea/51286/1/6 It seems golangi-lint tries to access files in `node_modules` which is completely unnecessary and likely a reason for its long runtime. It might be possible to pass a list of files to it via https://github.com/golangci/golangci-lint/issues/301#issuecomment-441311986, thought I'm not sure whether that usage actually works (https://github.com/golangci/golangci-lint/issues/2568). I recently added the `skip-dirs` option at https://github.com/go-gitea/gitea/blob/1ab88da0e460a076a95dcd2cad812e707da3acc9/.golangci.yml#L27-L30 but it does not seem to help because not all of their "linters" seem to honour the option (https://github.com/golangci/golangci-lint/issues/913).
GiteaMirror added the type/testingtype/bug labels 2025-11-02 08:11:32 -06:00
Author
Owner

@lunny commented on GitHub (Feb 18, 2022):

So maybe we could run backend lint before frontend lint in CI to avoid that?

@lunny commented on GitHub (Feb 18, 2022): So maybe we could run backend lint before frontend lint in CI to avoid that?
Author
Owner

@silverwind commented on GitHub (Feb 18, 2022):

That sounds like a workaround that will only work on CI. It needs to work locally too. Also, generally we want to run frontend/backend targets in parallel so folder absence can not be guaranteed.

@silverwind commented on GitHub (Feb 18, 2022): That sounds like a workaround that will only work on CI. It needs to work locally too. Also, generally we want to run frontend/backend targets in parallel so folder absence can not be guaranteed.
Author
Owner

@stale[bot] commented on GitHub (Apr 19, 2022):

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

@stale[bot] commented on GitHub (Apr 19, 2022): This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.
Author
Owner

@lunny commented on GitHub (Apr 19, 2022):

I think this has been resolved. If it's not, please feel free to reopen it.

@lunny commented on GitHub (Apr 19, 2022): ~I think this has been resolved. If it's not, please feel free to reopen it.~
Author
Owner

@zeripath commented on GitHub (Apr 19, 2022):

Fixed by #18708

@zeripath commented on GitHub (Apr 19, 2022): Fixed by #18708
Author
Owner

@silverwind commented on GitHub (Apr 20, 2022):

Not really fixed with that, skip-dirs only has effect on some linters, and those rare CI failures should still be able to happen currently.

@silverwind commented on GitHub (Apr 20, 2022): Not really fixed with that, `skip-dirs` only has effect on some linters, and those rare CI failures should still be able to happen currently.
Author
Owner

@taagomag commented on GitHub (Feb 7, 2023):

So is there any solution to skip node_modules? It seems that this issue is turning in circles since 2 years 😂

@taagomag commented on GitHub (Feb 7, 2023): So is there any solution to skip node_modules? It seems that this issue is turning in circles since 2 years 😂
Author
Owner

@silverwind commented on GitHub (Feb 7, 2023):

No, it needs to happen in golang first: https://github.com/golang/go/issues/42965.

@silverwind commented on GitHub (Feb 7, 2023): No, it needs to happen in golang first: https://github.com/golang/go/issues/42965.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#8576