golangci/golangci-lint · error

plugin does not abide by 'New' function: %T

Error message

plugin does not abide by 'New' function: %T

What it means

Type-assertion guard in PluginGoBuilder.lookupPlugin: the plugin exports a symbol named 'New' but its signature is not func(any) ([]*analysis.Analyzer, error), so the assertion to the expected constructor type fails and the actual type (%T) is reported. The plugin does not abide by the required New-function plugin contract.

Source

Thrown at pkg/lint/lintersdb/builder_plugin_go.go:126

}

func (b *PluginGoBuilder) lookupPlugin(plug *plugin.Plugin, settings any) ([]*analysis.Analyzer, error) {
	//nolint:staticcheck,nolintlint // Ignore because the implementation on Windows returns nil
	symbol, err := plug.Lookup("New")
	//nolint:staticcheck,nolintlint // Ignore because the implementation on Windows returns nil
	if err != nil {
		analyzers, errP := b.lookupAnalyzerPlugin(plug)
		if errP != nil {
			return nil, errors.Join(err, errP)
		}

		return analyzers, nil
	}

	// The type func cannot be used here, must be the explicit signature.
	constructor, ok := symbol.(func(any) ([]*analysis.Analyzer, error))
	if !ok {
		return nil, fmt.Errorf("plugin does not abide by 'New' function: %T", symbol)
	}

	return constructor(settings)
}

func (b *PluginGoBuilder) lookupAnalyzerPlugin(plug *plugin.Plugin) ([]*analysis.Analyzer, error) {
	//nolint:staticcheck,nolintlint // Ignore because the implementation on Windows returns nil
	symbol, err := plug.Lookup("AnalyzerPlugin")
	//nolint:staticcheck,nolintlint // Ignore because the implementation on Windows returns nil
	if err != nil {
		return nil, err
	}

	b.log.Warnf("plugin: 'AnalyzerPlugin' plugins are deprecated, please use the new plugin signature: " +
		"https://golangci-lint.run/docs/plugins/go-plugins#create-a-plugin")

	analyzerPlugin, ok := symbol.(AnalyzerPlugin)
	if !ok {

View on GitHub (pinned to ed7a235d2d)

Solutions

  1. Change the plugin's New to exactly match: func(any) ([]*analysis.Analyzer, error)
  2. Rebuild the .so after fixing the signature
  3. Refer to the golangci-lint Go plugins documentation for the required signature
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/lint/lintersdb/builder_plugin_go.go:126 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of golangci/golangci-lint@ed7a235d2d (2026-09-02). Data as JSON: /api/errors/52e33467f3b76bab. Report an issue: GitHub.