{"owner":"golangci","repo":"golangci-lint","hasSkills":true,"totalSkillsCount":6,"totalTokensCount":2089,"categories":["anthropic-skill","plugin-manifest"],"hasMcp":false,"mcpConfig":null,"found":["docs/content/docs/plugins/go-plugins.md","pkg/commands/internal/migrate/testdata/json/empty.golden.json","docs/content/docs/plugins/_index.md","internal/x/tools/diff/readme.md","internal/x/tools/driverutil/readme.md","docs/content/docs/plugins/module-plugins.md"],"skills":{"docs/content/docs/plugins/go-plugins.md":"---\ntitle: Go Plugin System\nweight: 2\naliases:\n  - /plugins/go-plugins/\n---\n\n{{< callout type=\"warning\" >}}\n  **We recommend using [Module Plugin System](/docs/plugins/module-plugins) instead of the Go Plugin System.**\n{{< /callout >}}\n\nPrivate linters can be added through [Go's plugin system](https://pkg.go.dev/plugin).\n\nFor a private linter (which acts as a plugin) to work properly,\nthe plugin as well as the golangci-lint binary **needs to be built for the same environment**.\n\n`CGO_ENABLED` is another requirement.\n\nThis means that `golangci-lint` needs to be built for whatever machine you intend to run it on\n(cloning the golangci-lint repository and running a `CGO_ENABLED=1 make build` should do the trick for your machine).\n\n## Create a Plugin\n\nYour linter must provide one or more `golang.org/x/tools/go/analysis.Analyzer` structs.\n\nYour project should also use `go.mod`.\n\nAll versions of libraries that overlap `golangci-lint` (including replaced libraries) MUST be set to the same version as `golangci-lint`.\nYou can see the versions by running `go version -m golangci-lint`.\n\nYou'll also need to create a Go file like `plugin/example.go`.\n\nThis file MUST be in the package `main`, and MUST define an exposed function called `New` with the following signature:\n```go\nfunc New(conf any) ([]*analysis.Analyzer, error) {\n\t// ...\n}\n```\n\nSee [plugin/example.go](https://github.com/golangci/example-plugin-linter/blob/HEAD/plugin/example.go) for more info.\n\nTo build the plugin, from the root project directory, run:\n```bash\ngo build -buildmode=plugin plugin/example.go\n```\n\nThis will create a plugin `*.so` file that can be copied into your project or another well-known location for usage in `golangci-lint`.\n\n## Configure a Plugin\n\nIf you already have a linter plugin available, you can follow these steps to define its usage in a projects `.golangci.yml` file.\n\nAn example linter can be found at [here](https://github.com/golangci/example-plugin-linter).\n\nIf you're looking for instructions on how to configure your own custom linter, they can be found further down.\n\n1. If the project you want to lint does not have one already, copy the [.golangci.yml](https://github.com/golangci/golangci-lint/blob/HEAD/.golangci.yml) to the root directory.\n2. Adjust the YAML to appropriate `linters.settings.custom` entries as so:\n  ```yaml {filename=\".golangci.yml\"}\n  version: \"2\"\n\n  linters:\n    settings:\n      custom:\n        example:\n          path: /example.so\n          description: The description of the linter\n          original-url: github.com/golangci/example-linter\n          settings: # Settings are optional.\n            one: Foo\n            two:\n              - name: Bar\n            three:\n              name: Bar\n  ```\n\nThat is all the configuration that is required to run a custom linter in your project.\n\nCustom linters are enabled by default, but abide by the same rules as other linters.\n\nIf the 'disable all' option is specified either on command line or in `.golangci.yml` files `linters.default: none`, custom linters will be disabled;\nthey can be re-enabled by adding them to the `linters.enable` list,\nor providing the enabled option on the command line, `golangci-lint run -Eexample`.\n\nThe configuration inside the `linters.settings` field of linter has some limitations (these are NOT related to the plugin system itself):\nwe use Viper to handle the configuration, but Viper puts all the keys in lowercase, and `.` cannot be used inside a key.\n","pkg/commands/internal/migrate/testdata/json/empty.golden.json":"{\n  \"formatters\": {\n    \"exclusions\": {\n      \"generated\": \"lax\",\n      \"paths\": [\n        \"third_party$\",\n        \"builtin$\",\n        \"examples$\"\n      ]\n    }\n  },\n  \"linters\": {\n    \"exclusions\": {\n      \"generated\": \"lax\",\n      \"paths\": [\n        \"third_party$\",\n        \"builtin$\",\n        \"examples$\"\n      ],\n      \"presets\": [\n        \"comments\",\n        \"common-false-positives\",\n        \"legacy\",\n        \"std-error-handling\"\n      ]\n    }\n  },\n  \"version\": \"2\"\n}\n","docs/content/docs/plugins/_index.md":"---\ntitle: Plugins\nweight: 7\n---\n\n{{< cards >}}\n  {{< card link=\"/docs/plugins/module-plugins/\" title=\"Module Plugin System\" icon=\"puzzle\" tag=\"Recommended\" tagColor=\"icon-only:sparkles\" >}}\n  {{< card link=\"/docs/plugins/go-plugins/\" title=\"Go Plugin System\" icon=\"puzzle\" >}}\n{{< /cards >}}\n","internal/x/tools/diff/readme.md":"# diff\n\nExtracted from `/internal/diff/` (related to `fixer`).\nThis is just a copy of the code without any changes.\n\n## History\n\n- https://github.com/golangci/golangci-lint/pull/6642\n  - sync with https://github.com/golang/tools/blob/v0.48.0/internal/diff/\n- https://github.com/golangci/golangci-lint/pull/6076\n  - sync with https://github.com/golang/tools/blob/v0.37.0/internal/diff/\n- https://github.com/golangci/golangci-lint/pull/5576\n  - sync with https://github.com/golang/tools/blob/v0.28.0/internal/diff/\n","internal/x/tools/driverutil/readme.md":"# driverutil\n\nExtracted from `/internal/analysis/driverutil/` (related to `checker`).\nThis is just a copy of `readfile.go` and `url.go` without any changes.\n\nPreviously, it was `analysisinternal` and `analysisflags` packages.\n\n## History\n\n- https://github.com/golangci/golangci-lint/pull/6642 (no changes)\n  - sync with https://github.com/golang/tools/blob/v0.48.0/internal/analysis/driverutil/readfile.go\n\n- https://github.com/golangci/golangci-lint/pull/6434\n  - sync with https://github.com/golang/tools/blob/v0.43.0/internal/analysis/driverutil/readfile.go\n\n## analysisinternal History\n\n- https://github.com/golangci/golangci-lint/pull/6076\n  - sync with https://github.com/golang/tools/blob/v0.37.0/internal/analysisinternal/\n- https://github.com/golangci/golangci-lint/pull/5576\n  - sync with https://github.com/golang/tools/blob/v0.28.0/internal/analysisinternal/\n\n## analysisflags History\n\n- https://github.com/golangci/golangci-lint/pull/6076\n  - sync with https://github.com/golang/tools/blob/v0.37.0/go/analysis/internal/analysisflags\n- https://github.com/golangci/golangci-lint/pull/5576\n  - sync with https://github.com/golang/tools/blob/v0.28.0/go/analysis/internal/analysisflags\n","docs/content/docs/plugins/module-plugins.md":"---\ntitle: Module Plugin System\nweight: 1\naliases:\n  - /plugins/module-plugins/\n---\n\n> [!TIP]\n> An example linter can be found at [here](https://github.com/golangci/example-plugin-module-linter).\n\n## The Automatic Way\n\n- Define your building configuration into `.custom-gcl.yml`.\n- Run the command `golangci-lint custom` (or `golangci-lint custom -v` to have logs).\n- Define the plugin inside the `linters.settings.custom` section with the type `module`.\n- Run the resulting custom binary of golangci-lint (`./custom-gcl` by default).\n\nRequirements:\n- Go\n- git\n\n### Configuration Example\n\n```yaml {filename=\".custom-gcl.yml\"}\nversion: {{< golangci/latest-version >}}\nplugins:\n  # a plugin from a Go proxy\n  - module: 'github.com/golangci/plugin1'\n    import: 'github.com/golangci/plugin1/foo'\n    version: v1.0.0\n\n  # a plugin from local source\n  - module: 'github.com/golangci/plugin2'\n    path: /my/local/path/plugin2\n```\n\n```yaml {filename=\".golangci.yml\"}\nversion: \"2\"\n\nlinters:\n  default: none\n  enable:\n    - foo\n  settings:\n    custom:\n      foo:\n        type: \"module\"\n        description: This is an example usage of a plugin linter.\n        settings:\n          message: hello\n```\n\n## The Manual Way\n\n- Add a blank-import of your module inside `cmd/golangci-lint/plugins.go`.\n- Run `go mod tidy` (the module containing the plugin will be imported).\n- Run `make build`.\n- Define the plugin inside the `linters.settings.custom` section with the type `module`.\n- Run your custom version of golangci-lint.\n\n### Configuration Example\n\n```yaml {filename=\".golangci.yml\"}\nversion: \"2\"\n\nlinters:\n  default: none\n  enable:\n    - foo\n  settings:\n    custom:\n      foo:\n        type: \"module\"\n        description: This is an example usage of a plugin linter.\n        settings:\n          message: hello\n```\n\n## Reference\n\nThe configuration file can be validated with the JSON Schema: [custom-gcl.jsonschema.json](https://golangci-lint.run/jsonschema/custom-gcl.jsonschema.json)\n\n```yml {filename=\".custom-gcl.yml\"}\n{{% golangci/embed file=\".tmp/.custom-gcl.reference.yml\" %}}\n```\n"},"files":{"docs/content/docs/plugins/go-plugins.md":"---\ntitle: Go Plugin System\nweight: 2\naliases:\n  - /plugins/go-plugins/\n---\n\n{{< callout type=\"warning\" >}}\n  **We recommend using [Module Plugin System](/docs/plugins/module-plugins) instead of the Go Plugin System.**\n{{< /callout >}}\n\nPrivate linters can be added through [Go's plugin system](https://pkg.go.dev/plugin).\n\nFor a private linter (which acts as a plugin) to work properly,\nthe plugin as well as the golangci-lint binary **needs to be built for the same environment**.\n\n`CGO_ENABLED` is another requirement.\n\nThis means that `golangci-lint` needs to be built for whatever machine you intend to run it on\n(cloning the golangci-lint repository and running a `CGO_ENABLED=1 make build` should do the trick for your machine).\n\n## Create a Plugin\n\nYour linter must provide one or more `golang.org/x/tools/go/analysis.Analyzer` structs.\n\nYour project should also use `go.mod`.\n\nAll versions of libraries that overlap `golangci-lint` (including replaced libraries) MUST be set to the same version as `golangci-lint`.\nYou can see the versions by running `go version -m golangci-lint`.\n\nYou'll also need to create a Go file like `plugin/example.go`.\n\nThis file MUST be in the package `main`, and MUST define an exposed function called `New` with the following signature:\n```go\nfunc New(conf any) ([]*analysis.Analyzer, error) {\n\t// ...\n}\n```\n\nSee [plugin/example.go](https://github.com/golangci/example-plugin-linter/blob/HEAD/plugin/example.go) for more info.\n\nTo build the plugin, from the root project directory, run:\n```bash\ngo build -buildmode=plugin plugin/example.go\n```\n\nThis will create a plugin `*.so` file that can be copied into your project or another well-known location for usage in `golangci-lint`.\n\n## Configure a Plugin\n\nIf you already have a linter plugin available, you can follow these steps to define its usage in a projects `.golangci.yml` file.\n\nAn example linter can be found at [here](https://github.com/golangci/example-plugin-linter).\n\nIf you're looking for instructions on how to configure your own custom linter, they can be found further down.\n\n1. If the project you want to lint does not have one already, copy the [.golangci.yml](https://github.com/golangci/golangci-lint/blob/HEAD/.golangci.yml) to the root directory.\n2. Adjust the YAML to appropriate `linters.settings.custom` entries as so:\n  ```yaml {filename=\".golangci.yml\"}\n  version: \"2\"\n\n  linters:\n    settings:\n      custom:\n        example:\n          path: /example.so\n          description: The description of the linter\n          original-url: github.com/golangci/example-linter\n          settings: # Settings are optional.\n            one: Foo\n            two:\n              - name: Bar\n            three:\n              name: Bar\n  ```\n\nThat is all the configuration that is required to run a custom linter in your project.\n\nCustom linters are enabled by default, but abide by the same rules as other linters.\n\nIf the 'disable all' option is specified either on command line or in `.golangci.yml` files `linters.default: none`, custom linters will be disabled;\nthey can be re-enabled by adding them to the `linters.enable` list,\nor providing the enabled option on the command line, `golangci-lint run -Eexample`.\n\nThe configuration inside the `linters.settings` field of linter has some limitations (these are NOT related to the plugin system itself):\nwe use Viper to handle the configuration, but Viper puts all the keys in lowercase, and `.` cannot be used inside a key.\n","pkg/commands/internal/migrate/testdata/json/empty.golden.json":"{\n  \"formatters\": {\n    \"exclusions\": {\n      \"generated\": \"lax\",\n      \"paths\": [\n        \"third_party$\",\n        \"builtin$\",\n        \"examples$\"\n      ]\n    }\n  },\n  \"linters\": {\n    \"exclusions\": {\n      \"generated\": \"lax\",\n      \"paths\": [\n        \"third_party$\",\n        \"builtin$\",\n        \"examples$\"\n      ],\n      \"presets\": [\n        \"comments\",\n        \"common-false-positives\",\n        \"legacy\",\n        \"std-error-handling\"\n      ]\n    }\n  },\n  \"version\": \"2\"\n}\n","docs/content/docs/plugins/_index.md":"---\ntitle: Plugins\nweight: 7\n---\n\n{{< cards >}}\n  {{< card link=\"/docs/plugins/module-plugins/\" title=\"Module Plugin System\" icon=\"puzzle\" tag=\"Recommended\" tagColor=\"icon-only:sparkles\" >}}\n  {{< card link=\"/docs/plugins/go-plugins/\" title=\"Go Plugin System\" icon=\"puzzle\" >}}\n{{< /cards >}}\n","internal/x/tools/diff/readme.md":"# diff\n\nExtracted from `/internal/diff/` (related to `fixer`).\nThis is just a copy of the code without any changes.\n\n## History\n\n- https://github.com/golangci/golangci-lint/pull/6642\n  - sync with https://github.com/golang/tools/blob/v0.48.0/internal/diff/\n- https://github.com/golangci/golangci-lint/pull/6076\n  - sync with https://github.com/golang/tools/blob/v0.37.0/internal/diff/\n- https://github.com/golangci/golangci-lint/pull/5576\n  - sync with https://github.com/golang/tools/blob/v0.28.0/internal/diff/\n","internal/x/tools/driverutil/readme.md":"# driverutil\n\nExtracted from `/internal/analysis/driverutil/` (related to `checker`).\nThis is just a copy of `readfile.go` and `url.go` without any changes.\n\nPreviously, it was `analysisinternal` and `analysisflags` packages.\n\n## History\n\n- https://github.com/golangci/golangci-lint/pull/6642 (no changes)\n  - sync with https://github.com/golang/tools/blob/v0.48.0/internal/analysis/driverutil/readfile.go\n\n- https://github.com/golangci/golangci-lint/pull/6434\n  - sync with https://github.com/golang/tools/blob/v0.43.0/internal/analysis/driverutil/readfile.go\n\n## analysisinternal History\n\n- https://github.com/golangci/golangci-lint/pull/6076\n  - sync with https://github.com/golang/tools/blob/v0.37.0/internal/analysisinternal/\n- https://github.com/golangci/golangci-lint/pull/5576\n  - sync with https://github.com/golang/tools/blob/v0.28.0/internal/analysisinternal/\n\n## analysisflags History\n\n- https://github.com/golangci/golangci-lint/pull/6076\n  - sync with https://github.com/golang/tools/blob/v0.37.0/go/analysis/internal/analysisflags\n- https://github.com/golangci/golangci-lint/pull/5576\n  - sync with https://github.com/golang/tools/blob/v0.28.0/go/analysis/internal/analysisflags\n","docs/content/docs/plugins/module-plugins.md":"---\ntitle: Module Plugin System\nweight: 1\naliases:\n  - /plugins/module-plugins/\n---\n\n> [!TIP]\n> An example linter can be found at [here](https://github.com/golangci/example-plugin-module-linter).\n\n## The Automatic Way\n\n- Define your building configuration into `.custom-gcl.yml`.\n- Run the command `golangci-lint custom` (or `golangci-lint custom -v` to have logs).\n- Define the plugin inside the `linters.settings.custom` section with the type `module`.\n- Run the resulting custom binary of golangci-lint (`./custom-gcl` by default).\n\nRequirements:\n- Go\n- git\n\n### Configuration Example\n\n```yaml {filename=\".custom-gcl.yml\"}\nversion: {{< golangci/latest-version >}}\nplugins:\n  # a plugin from a Go proxy\n  - module: 'github.com/golangci/plugin1'\n    import: 'github.com/golangci/plugin1/foo'\n    version: v1.0.0\n\n  # a plugin from local source\n  - module: 'github.com/golangci/plugin2'\n    path: /my/local/path/plugin2\n```\n\n```yaml {filename=\".golangci.yml\"}\nversion: \"2\"\n\nlinters:\n  default: none\n  enable:\n    - foo\n  settings:\n    custom:\n      foo:\n        type: \"module\"\n        description: This is an example usage of a plugin linter.\n        settings:\n          message: hello\n```\n\n## The Manual Way\n\n- Add a blank-import of your module inside `cmd/golangci-lint/plugins.go`.\n- Run `go mod tidy` (the module containing the plugin will be imported).\n- Run `make build`.\n- Define the plugin inside the `linters.settings.custom` section with the type `module`.\n- Run your custom version of golangci-lint.\n\n### Configuration Example\n\n```yaml {filename=\".golangci.yml\"}\nversion: \"2\"\n\nlinters:\n  default: none\n  enable:\n    - foo\n  settings:\n    custom:\n      foo:\n        type: \"module\"\n        description: This is an example usage of a plugin linter.\n        settings:\n          message: hello\n```\n\n## Reference\n\nThe configuration file can be validated with the JSON Schema: [custom-gcl.jsonschema.json](https://golangci-lint.run/jsonschema/custom-gcl.jsonschema.json)\n\n```yml {filename=\".custom-gcl.yml\"}\n{{% golangci/embed file=\".tmp/.custom-gcl.reference.yml\" %}}\n```\n"},"items":[{"name":"_index.md","path":"docs/content/docs/plugins/_index.md","rawUrl":"https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/docs/content/docs/plugins/_index.md","title":"Plugins Skill","category":"anthropic-skill","format":"markdown","content":"---\ntitle: Plugins\nweight: 7\n---\n\n{{< cards >}}\n  {{< card link=\"/docs/plugins/module-plugins/\" title=\"Module Plugin System\" icon=\"puzzle\" tag=\"Recommended\" tagColor=\"icon-only:sparkles\" >}}\n  {{< card link=\"/docs/plugins/go-plugins/\" title=\"Go Plugin System\" icon=\"puzzle\" >}}\n{{< /cards >}}\n","frontmatter":{"title":"Plugins","weight":7},"isInternal":false,"tokens":83,"sizeBytes":293},{"name":"go-plugins.md","path":"docs/content/docs/plugins/go-plugins.md","rawUrl":"https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/docs/content/docs/plugins/go-plugins.md","title":"Plugins Skill","category":"anthropic-skill","format":"markdown","content":"---\ntitle: Go Plugin System\nweight: 2\naliases:\n  - /plugins/go-plugins/\n---\n\n{{< callout type=\"warning\" >}}\n  **We recommend using [Module Plugin System](/docs/plugins/module-plugins) instead of the Go Plugin System.**\n{{< /callout >}}\n\nPrivate linters can be added through [Go's plugin system](https://pkg.go.dev/plugin).\n\nFor a private linter (which acts as a plugin) to work properly,\nthe plugin as well as the golangci-lint binary **needs to be built for the same environment**.\n\n`CGO_ENABLED` is another requirement.\n\nThis means that `golangci-lint` needs to be built for whatever machine you intend to run it on\n(cloning the golangci-lint repository and running a `CGO_ENABLED=1 make build` should do the trick for your machine).\n\n## Create a Plugin\n\nYour linter must provide one or more `golang.org/x/tools/go/analysis.Analyzer` structs.\n\nYour project should also use `go.mod`.\n\nAll versions of libraries that overlap `golangci-lint` (including replaced libraries) MUST be set to the same version as `golangci-lint`.\nYou can see the versions by running `go version -m golangci-lint`.\n\nYou'll also need to create a Go file like `plugin/example.go`.\n\nThis file MUST be in the package `main`, and MUST define an exposed function called `New` with the following signature:\n```go\nfunc New(conf any) ([]*analysis.Analyzer, error) {\n\t// ...\n}\n```\n\nSee [plugin/example.go](https://github.com/golangci/example-plugin-linter/blob/HEAD/plugin/example.go) for more info.\n\nTo build the plugin, from the root project directory, run:\n```bash\ngo build -buildmode=plugin plugin/example.go\n```\n\nThis will create a plugin `*.so` file that can be copied into your project or another well-known location for usage in `golangci-lint`.\n\n## Configure a Plugin\n\nIf you already have a linter plugin available, you can follow these steps to define its usage in a projects `.golangci.yml` file.\n\nAn example linter can be found at [here](https://github.com/golangci/example-plugin-linter).\n\nIf you're looking for instructions on how to configure your own custom linter, they can be found further down.\n\n1. If the project you want to lint does not have one already, copy the [.golangci.yml](https://github.com/golangci/golangci-lint/blob/HEAD/.golangci.yml) to the root directory.\n2. Adjust the YAML to appropriate `linters.settings.custom` entries as so:\n  ```yaml {filename=\".golangci.yml\"}\n  version: \"2\"\n\n  linters:\n    settings:\n      custom:\n        example:\n          path: /example.so\n          description: The description of the linter\n          original-url: github.com/golangci/example-linter\n          settings: # Settings are optional.\n            one: Foo\n            two:\n              - name: Bar\n            three:\n              name: Bar\n  ```\n\nThat is all the configuration that is required to run a custom linter in your project.\n\nCustom linters are enabled by default, but abide by the same rules as other linters.\n\nIf the 'disable all' option is specified either on command line or in `.golangci.yml` files `linters.default: none`, custom linters will be disabled;\nthey can be re-enabled by adding them to the `linters.enable` list,\nor providing the enabled option on the command line, `golangci-lint run -Eexample`.\n\nThe configuration inside the `linters.settings` field of linter has some limitations (these are NOT related to the plugin system itself):\nwe use Viper to handle the configuration, but Viper puts all the keys in lowercase, and `.` cannot be used inside a key.\n","frontmatter":{"title":"Go Plugin System","weight":2,"aliases":["/plugins/go-plugins/"]},"isInternal":false,"tokens":830,"sizeBytes":3477},{"name":"module-plugins.md","path":"docs/content/docs/plugins/module-plugins.md","rawUrl":"https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/docs/content/docs/plugins/module-plugins.md","title":"Plugins Skill","category":"anthropic-skill","format":"markdown","content":"---\ntitle: Module Plugin System\nweight: 1\naliases:\n  - /plugins/module-plugins/\n---\n\n> [!TIP]\n> An example linter can be found at [here](https://github.com/golangci/example-plugin-module-linter).\n\n## The Automatic Way\n\n- Define your building configuration into `.custom-gcl.yml`.\n- Run the command `golangci-lint custom` (or `golangci-lint custom -v` to have logs).\n- Define the plugin inside the `linters.settings.custom` section with the type `module`.\n- Run the resulting custom binary of golangci-lint (`./custom-gcl` by default).\n\nRequirements:\n- Go\n- git\n\n### Configuration Example\n\n```yaml {filename=\".custom-gcl.yml\"}\nversion: {{< golangci/latest-version >}}\nplugins:\n  # a plugin from a Go proxy\n  - module: 'github.com/golangci/plugin1'\n    import: 'github.com/golangci/plugin1/foo'\n    version: v1.0.0\n\n  # a plugin from local source\n  - module: 'github.com/golangci/plugin2'\n    path: /my/local/path/plugin2\n```\n\n```yaml {filename=\".golangci.yml\"}\nversion: \"2\"\n\nlinters:\n  default: none\n  enable:\n    - foo\n  settings:\n    custom:\n      foo:\n        type: \"module\"\n        description: This is an example usage of a plugin linter.\n        settings:\n          message: hello\n```\n\n## The Manual Way\n\n- Add a blank-import of your module inside `cmd/golangci-lint/plugins.go`.\n- Run `go mod tidy` (the module containing the plugin will be imported).\n- Run `make build`.\n- Define the plugin inside the `linters.settings.custom` section with the type `module`.\n- Run your custom version of golangci-lint.\n\n### Configuration Example\n\n```yaml {filename=\".golangci.yml\"}\nversion: \"2\"\n\nlinters:\n  default: none\n  enable:\n    - foo\n  settings:\n    custom:\n      foo:\n        type: \"module\"\n        description: This is an example usage of a plugin linter.\n        settings:\n          message: hello\n```\n\n## Reference\n\nThe configuration file can be validated with the JSON Schema: [custom-gcl.jsonschema.json](https://golangci-lint.run/jsonschema/custom-gcl.jsonschema.json)\n\n```yml {filename=\".custom-gcl.yml\"}\n{{% golangci/embed file=\".tmp/.custom-gcl.reference.yml\" %}}\n```\n","frontmatter":{"title":"Module Plugin System","weight":1,"aliases":["/plugins/module-plugins/"]},"isInternal":false,"tokens":541,"sizeBytes":2077},{"name":"empty.golden.json","path":"pkg/commands/internal/migrate/testdata/json/empty.golden.json","rawUrl":"https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/pkg/commands/internal/migrate/testdata/json/empty.golden.json","title":"Json Skill","category":"anthropic-skill","format":"json","content":"{\n  \"formatters\": {\n    \"exclusions\": {\n      \"generated\": \"lax\",\n      \"paths\": [\n        \"third_party$\",\n        \"builtin$\",\n        \"examples$\"\n      ]\n    }\n  },\n  \"linters\": {\n    \"exclusions\": {\n      \"generated\": \"lax\",\n      \"paths\": [\n        \"third_party$\",\n        \"builtin$\",\n        \"examples$\"\n      ],\n      \"presets\": [\n        \"comments\",\n        \"common-false-positives\",\n        \"legacy\",\n        \"std-error-handling\"\n      ]\n    }\n  },\n  \"version\": \"2\"\n}\n","frontmatter":{"formatters":{"exclusions":{"generated":"lax","paths":["third_party$","builtin$","examples$"]}},"linters":{"exclusions":{"generated":"lax","paths":["third_party$","builtin$","examples$"],"presets":["comments","common-false-positives","legacy","std-error-handling"]}},"version":"2"},"isInternal":false,"tokens":135,"sizeBytes":475},{"name":"readme.md","path":"internal/x/tools/diff/readme.md","rawUrl":"https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/internal/x/tools/diff/readme.md","title":"diff Documentation","category":"plugin-manifest","format":"markdown","content":"# diff\n\nExtracted from `/internal/diff/` (related to `fixer`).\nThis is just a copy of the code without any changes.\n\n## History\n\n- https://github.com/golangci/golangci-lint/pull/6642\n  - sync with https://github.com/golang/tools/blob/v0.48.0/internal/diff/\n- https://github.com/golangci/golangci-lint/pull/6076\n  - sync with https://github.com/golang/tools/blob/v0.37.0/internal/diff/\n- https://github.com/golangci/golangci-lint/pull/5576\n  - sync with https://github.com/golang/tools/blob/v0.28.0/internal/diff/\n","isInternal":false,"tokens":158,"sizeBytes":513},{"name":"readme.md","path":"internal/x/tools/driverutil/readme.md","rawUrl":"https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/internal/x/tools/driverutil/readme.md","title":"driverutil Documentation","category":"plugin-manifest","format":"markdown","content":"# driverutil\n\nExtracted from `/internal/analysis/driverutil/` (related to `checker`).\nThis is just a copy of `readfile.go` and `url.go` without any changes.\n\nPreviously, it was `analysisinternal` and `analysisflags` packages.\n\n## History\n\n- https://github.com/golangci/golangci-lint/pull/6642 (no changes)\n  - sync with https://github.com/golang/tools/blob/v0.48.0/internal/analysis/driverutil/readfile.go\n\n- https://github.com/golangci/golangci-lint/pull/6434\n  - sync with https://github.com/golang/tools/blob/v0.43.0/internal/analysis/driverutil/readfile.go\n\n## analysisinternal History\n\n- https://github.com/golangci/golangci-lint/pull/6076\n  - sync with https://github.com/golang/tools/blob/v0.37.0/internal/analysisinternal/\n- https://github.com/golangci/golangci-lint/pull/5576\n  - sync with https://github.com/golang/tools/blob/v0.28.0/internal/analysisinternal/\n\n## analysisflags History\n\n- https://github.com/golangci/golangci-lint/pull/6076\n  - sync with https://github.com/golang/tools/blob/v0.37.0/go/analysis/internal/analysisflags\n- https://github.com/golangci/golangci-lint/pull/5576\n  - sync with https://github.com/golang/tools/blob/v0.28.0/go/analysis/internal/analysisflags\n","isInternal":false,"tokens":342,"sizeBytes":1194}],"systemPromptSnippet":"<yakaai_skills repo=\"golangci/golangci-lint\">\n<!-- File: docs/content/docs/plugins/_index.md (Tokens: ~83 | Category: anthropic-skill) -->\n---\ntitle: Plugins\nweight: 7\n---\n\n{{< cards >}}\n  {{< card link=\"/docs/plugins/module-plugins/\" title=\"Module Plugin System\" icon=\"puzzle\" tag=\"Recommended\" tagColor=\"icon-only:sparkles\" >}}\n  {{< card link=\"/docs/plugins/go-plugins/\" title=\"Go Plugin System\" icon=\"puzzle\" >}}\n{{< /cards >}}\n\n<!-- File: docs/content/docs/plugins/go-plugins.md (Tokens: ~830 | Category: anthropic-skill) -->\n---\ntitle: Go Plugin System\nweight: 2\naliases:\n  - /plugins/go-plugins/\n---\n\n{{< callout type=\"warning\" >}}\n  **We recommend using [Module Plugin System](/docs/plugins/module-plugins) instead of the Go Plugin System.**\n{{< /callout >}}\n\nPrivate linters can be added through [Go's plugin system](https://pkg.go.dev/plugin).\n\nFor a private linter (which acts as a plugin) to work properly,\nthe plugin as well as the golangci-lint binary **needs to be built for the same environment**.\n\n`CGO_ENABLED` is another requirement.\n\nThis means that `golangci-lint` needs to be built for whatever machine you intend to run it on\n(cloning the golangci-lint repository and running a `CGO_ENABLED=1 make build` should do the trick for your machine).\n\n## Create a Plugin\n\nYour linter must provide one or more `golang.org/x/tools/go/analysis.Analyzer` structs.\n\nYour project should also use `go.mod`.\n\nAll versions of libraries that overlap `golangci-lint` (including replaced libraries) MUST be set to the same version as `golangci-lint`.\nYou can see the versions by running `go version -m golangci-lint`.\n\nYou'll also need to create a Go file like `plugin/example.go`.\n\nThis file MUST be in the package `main`, and MUST define an exposed function called `New` with the following signature:\n```go\nfunc New(conf any) ([]*analysis.Analyzer, error) {\n\t// ...\n}\n```\n\nSee [plugin/example.go](https://github.com/golangci/example-plugin-linter/blob/HEAD/plugin/example.go) for more info.\n\nTo build the plugin, from the root project directory, run:\n```bash\ngo build -buildmode=plugin plugin/example.go\n```\n\nThis will create a plugin `*.so` file that can be copied into your project or another well-known location for usage in `golangci-lint`.\n\n## Configure a Plugin\n\nIf you already have a linter plugin available, you can follow these steps to define its usage in a projects `.golangci.yml` file.\n\nAn example linter can be found at [here](https://github.com/golangci/example-plugin-linter).\n\nIf you're looking for instructions on how to configure your own custom linter, they can be found further down.\n\n1. If the project you want to lint does not have one already, copy the [.golangci.yml](https://github.com/golangci/golangci-lint/blob/HEAD/.golangci.yml) to the root directory.\n2. Adjust the YAML to appropriate `linters.settings.custom` entries as so:\n  ```yaml {filename=\".golangci.yml\"}\n  version: \"2\"\n\n  linters:\n    settings:\n      custom:\n        example:\n          path: /example.so\n          description: The description of the linter\n          original-url: github.com/golangci/example-linter\n          settings: # Settings are optional.\n            one: Foo\n            two:\n              - name: Bar\n            three:\n              name: Bar\n  ```\n\nThat is all the configuration that is required to run a custom linter in your project.\n\nCustom linters are enabled by default, but abide by the same rules as other linters.\n\nIf the 'disable all' option is specified either on command line or in `.golangci.yml` files `linters.default: none`, custom linters will be disabled;\nthey can be re-enabled by adding them to the `linters.enable` list,\nor providing the enabled option on the command line, `golangci-lint run -Eexample`.\n\nThe configuration inside the `linters.settings` field of linter has some limitations (these are NOT related to the plugin system itself):\nwe use Viper to handle the configuration, but Viper puts all the keys in lowercase, and `.` cannot be used inside a key.\n\n<!-- File: docs/content/docs/plugins/module-plugins.md (Tokens: ~541 | Category: anthropic-skill) -->\n---\ntitle: Module Plugin System\nweight: 1\naliases:\n  - /plugins/module-plugins/\n---\n\n> [!TIP]\n> An example linter can be found at [here](https://github.com/golangci/example-plugin-module-linter).\n\n## The Automatic Way\n\n- Define your building configuration into `.custom-gcl.yml`.\n- Run the command `golangci-lint custom` (or `golangci-lint custom -v` to have logs).\n- Define the plugin inside the `linters.settings.custom` section with the type `module`.\n- Run the resulting custom binary of golangci-lint (`./custom-gcl` by default).\n\nRequirements:\n- Go\n- git\n\n### Configuration Example\n\n```yaml {filename=\".custom-gcl.yml\"}\nversion: {{< golangci/latest-version >}}\nplugins:\n  # a plugin from a Go proxy\n  - module: 'github.com/golangci/plugin1'\n    import: 'github.com/golangci/plugin1/foo'\n    version: v1.0.0\n\n  # a plugin from local source\n  - module: 'github.com/golangci/plugin2'\n    path: /my/local/path/plugin2\n```\n\n```yaml {filename=\".golangci.yml\"}\nversion: \"2\"\n\nlinters:\n  default: none\n  enable:\n    - foo\n  settings:\n    custom:\n      foo:\n        type: \"module\"\n        description: This is an example usage of a plugin linter.\n        settings:\n          message: hello\n```\n\n## The Manual Way\n\n- Add a blank-import of your module inside `cmd/golangci-lint/plugins.go`.\n- Run `go mod tidy` (the module containing the plugin will be imported).\n- Run `make build`.\n- Define the plugin inside the `linters.settings.custom` section with the type `module`.\n- Run your custom version of golangci-lint.\n\n### Configuration Example\n\n```yaml {filename=\".golangci.yml\"}\nversion: \"2\"\n\nlinters:\n  default: none\n  enable:\n    - foo\n  settings:\n    custom:\n      foo:\n        type: \"module\"\n        description: This is an example usage of a plugin linter.\n        settings:\n          message: hello\n```\n\n## Reference\n\nThe configuration file can be validated with the JSON Schema: [custom-gcl.jsonschema.json](https://golangci-lint.run/jsonschema/custom-gcl.jsonschema.json)\n\n```yml {filename=\".custom-gcl.yml\"}\n{{% golangci/embed file=\".tmp/.custom-gcl.reference.yml\" %}}\n```\n\n<!-- File: pkg/commands/internal/migrate/testdata/json/empty.golden.json (Tokens: ~135 | Category: anthropic-skill) -->\n{\n  \"formatters\": {\n    \"exclusions\": {\n      \"generated\": \"lax\",\n      \"paths\": [\n        \"third_party$\",\n        \"builtin$\",\n        \"examples$\"\n      ]\n    }\n  },\n  \"linters\": {\n    \"exclusions\": {\n      \"generated\": \"lax\",\n      \"paths\": [\n        \"third_party$\",\n        \"builtin$\",\n        \"examples$\"\n      ],\n      \"presets\": [\n        \"comments\",\n        \"common-false-positives\",\n        \"legacy\",\n        \"std-error-handling\"\n      ]\n    }\n  },\n  \"version\": \"2\"\n}\n\n<!-- File: internal/x/tools/diff/readme.md (Tokens: ~158 | Category: plugin-manifest) -->\n# diff\n\nExtracted from `/internal/diff/` (related to `fixer`).\nThis is just a copy of the code without any changes.\n\n## History\n\n- https://github.com/golangci/golangci-lint/pull/6642\n  - sync with https://github.com/golang/tools/blob/v0.48.0/internal/diff/\n- https://github.com/golangci/golangci-lint/pull/6076\n  - sync with https://github.com/golang/tools/blob/v0.37.0/internal/diff/\n- https://github.com/golangci/golangci-lint/pull/5576\n  - sync with https://github.com/golang/tools/blob/v0.28.0/internal/diff/\n\n<!-- File: internal/x/tools/driverutil/readme.md (Tokens: ~342 | Category: plugin-manifest) -->\n# driverutil\n\nExtracted from `/internal/analysis/driverutil/` (related to `checker`).\nThis is just a copy of `readfile.go` and `url.go` without any changes.\n\nPreviously, it was `analysisinternal` and `analysisflags` packages.\n\n## History\n\n- https://github.com/golangci/golangci-lint/pull/6642 (no changes)\n  - sync with https://github.com/golang/tools/blob/v0.48.0/internal/analysis/driverutil/readfile.go\n\n- https://github.com/golangci/golangci-lint/pull/6434\n  - sync with https://github.com/golang/tools/blob/v0.43.0/internal/analysis/driverutil/readfile.go\n\n## analysisinternal History\n\n- https://github.com/golangci/golangci-lint/pull/6076\n  - sync with https://github.com/golang/tools/blob/v0.37.0/internal/analysisinternal/\n- https://github.com/golangci/golangci-lint/pull/5576\n  - sync with https://github.com/golang/tools/blob/v0.28.0/internal/analysisinternal/\n\n## analysisflags History\n\n- https://github.com/golangci/golangci-lint/pull/6076\n  - sync with https://github.com/golang/tools/blob/v0.37.0/go/analysis/internal/analysisflags\n- https://github.com/golangci/golangci-lint/pull/5576\n  - sync with https://github.com/golang/tools/blob/v0.28.0/go/analysis/internal/analysisflags\n</yakaai_skills>"}