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

Support custom plugins #690

Closed
2 tasks done
connorszczepaniak-wk opened this issue Mar 1, 2023 · 4 comments
Closed
2 tasks done

Support custom plugins #690

connorszczepaniak-wk opened this issue Mar 1, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@connorszczepaniak-wk
Copy link

Welcome

  • Yes, I understand that the GitHub action repository is not the repository of golangci-lint itself.
  • Yes, I've searched similar issues on GitHub and didn't find any.

Your feature request related to a problem? Please describe.

I'd like to be able to use custom golangci-lint plugins with the GitHub action. I can almost achieve this with the following steps:

  • Build a docker container with a pre-built golangci-lint
  • Also build my custom plugins and put them in this docker container
  • Use this container in the GitHub action with container: my-golangci-container
  • Missing capability: tell the action to skip downloading the asset and point to the pre-installed version on my container instead

Since plugins need to be built from the same go.mod that the tool itself is built from, I need a way to point the action to my binary.

Describe the solution you'd like.

#676 Is achieving something similar, but for this use-case it can be even simpler: if I can specify the path to golangci-lint on the running container and tell the action to skip downloading the asset (and just use the one I'm pointing to instead), everything would work well.

Describe alternatives you've considered.

I can currently run golangci-lint as a separate action on my own container, but then I miss out on getting comments on my PR, caching, etc.

Additional context.

No response

@ldez
Copy link
Member

ldez commented Mar 20, 2023

Feels like a duplicate of #631

@connorszczepaniak-wk
Copy link
Author

@ldez yes, it seems like it. I see there is a bit of a chain of duplicates, ending with #540. These issues are closed, but I don't see a PR referencing them. Maybe I missed it -- is this already supported?

@ldez
Copy link
Member

ldez commented Jun 6, 2023

I think an idea can be to build golangci-lint (through go install see #540 with CGO_ENABLED=1) and add an extra configuration for plugins.

The with of GitHub Action only supports first-level key-value then it's not the right solution for the extra configuration.

with:
  foo: bar

Then maybe the extra configuration can be provided via a dedicated file, something like that:

plugins:
  - path: /path/to/plugin/sources/
    destination: ./example/foo.so
  - path: /path/to/another/plugin/sources/
    destination: ./example/bar.so

related to golangci/golangci-lint#2566

FYI #540 is not closed.

@ldez ldez added the enhancement New feature or request label Jun 6, 2023
@ldez
Copy link
Member

ldez commented Jun 12, 2023

The PR #768 is now merged and I created a new release of the action.

I also created an example to explain how to use custom linters (plugins) with this GitHub Action: https://github.com/golangci/golangci-lint-action-plugin-example

I didn't do the extra configuration support because I think it's not needed for now but we can change our mind on that in the future.

@ldez ldez closed this as completed Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants