golangci/golangci-lint · error

get base path: %w

Error message

get base path: %w

What it means

Wrapping error in PluginGoBuilder.getAnalyzerPlugin: fsutils.GetBasePath failed while resolving the plugin's non-absolute path relative to the config directory / relative-path mode. The plugin cannot be located, so loading aborts before plugin.Open.

Source

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

	linterConfig := linter.NewConfig(customLinter).
		WithGroups(config.GroupStandard).
		WithLoadForGoAnalysis().
		WithURL(settings.OriginalURL)

	return linterConfig, nil
}

// getAnalyzerPlugin loads a private linter as specified in the config file,
// loads the plugin from a .so file,
// and returns the 'AnalyzerPlugin' interface implemented by the private plugin.
// An error is returned if the private linter cannot be loaded
// or the linter does not implement the AnalyzerPlugin interface.
func (b *PluginGoBuilder) getAnalyzerPlugin(cfg *config.Config, path string, settings any) ([]*analysis.Analyzer, error) {
	if !filepath.IsAbs(path) {
		basePath, err := fsutils.GetBasePath(context.Background(), cfg.Run.RelativePathMode, cfg.GetConfigDir())
		if err != nil {
			return nil, fmt.Errorf("get base path: %w", err)
		}

		// resolve non-absolute paths relative to config file's directory
		path = filepath.Join(basePath, path)
	}

	//nolint:staticcheck,nolintlint // Ignore because the implementation on Windows returns nil
	plug, err := plugin.Open(path)
	//nolint:staticcheck,nolintlint // Ignore because the implementation on Windows returns nil
	if err != nil {
		return nil, err
	}

	analyzers, err := b.lookupPlugin(plug, settings)
	if err != nil {
		return nil, fmt.Errorf("lookup plugin %s: %w", path, err)
	}

View on GitHub (pinned to ed7a235d2d)

Solutions

  1. Use an absolute path for the plugin in the custom linter settings
  2. Verify the config directory and relative-path-mode settings
  3. Check the wrapped error for the base-path resolution failure
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at pkg/lint/lintersdb/builder_plugin_go.go:88 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/503167a43521a540. Report an issue: GitHub.