Description
When validating a plugin archive with -sourceCodeUri, plugin-validator can fail with Invalid Go manifest file if dependency trees contain Go files (for example node_modules/.pnpm/.../flatted/golang/pkg/flatted/flatted.go).
These files are third-party dependency internals and not plugin-owned backend source, but they are still considered during source/manifest validation.
Expected behavior
Validation should not fail because of Go files inside dependency folders such as node_modules/.pnpm.
Only plugin-relevant source files should be considered for Go manifest/source consistency checks.
Actual behavior
Validation fails with errors similar to:
Invalid Go manifest file
<dependency path>/flatted.go is in the source code but not in the manifest
This can happen even if build-side mitigations are applied to prevent those files from being added to the plugin Go manifest.
Why this matters
- Common JS dependency trees may include non-JS assets, including Go files.
- Since
plugin-actions/package-plugin runs validator automatically, this can fail CI/plugin release builds by default.
- Workarounds are fragile (renaming
node_modules, postinstall pruning, etc.).
- Security/compliance constraints can make dependency-version workarounds unacceptable.
Minimal reproduction
- Create plugin archive from
dist/ as documented.
- Ensure dependencies include a package that ships Go sources under
node_modules (e.g. flatted/golang).
- Run:
npx @grafana/plugin-validator@latest -sourceCodeUri file://. <plugin-id>.zip
- Observe go-manifest/source mismatch errors referencing dependency paths.
Proposed solution
- Add built-in default exclusions for source scanning/comparison for dependency directories, such as:
- node_modules/**
- .pnpm/**
- other package-manager cache/dependency paths
- Add configurable exclude globs (global or analyzer-specific) for source analyzers, especially sourcecode and go-manifest.
- Constrain go-manifest/source comparison to plugin-owned backend source roots rather than a full repository walk.
Description
When validating a plugin archive with
-sourceCodeUri,plugin-validatorcan fail withInvalid Go manifest fileif dependency trees contain Go files (for examplenode_modules/.pnpm/.../flatted/golang/pkg/flatted/flatted.go).These files are third-party dependency internals and not plugin-owned backend source, but they are still considered during source/manifest validation.
Expected behavior
Validation should not fail because of Go files inside dependency folders such as
node_modules/.pnpm.Only plugin-relevant source files should be considered for Go manifest/source consistency checks.
Actual behavior
Validation fails with errors similar to:
Invalid Go manifest file<dependency path>/flatted.go is in the source code but not in the manifestThis can happen even if build-side mitigations are applied to prevent those files from being added to the plugin Go manifest.
Why this matters
plugin-actions/package-pluginruns validator automatically, this can fail CI/plugin release builds by default.node_modules, postinstall pruning, etc.).Minimal reproduction
dist/as documented.node_modules(e.g.flatted/golang).Proposed solution