Skip to content

Bump Go module path to github.com/grafana/pyroscope/v2#5073

Merged
simonswine merged 9 commits intografana:mainfrom
simonswine:20260417_update-go-mod-major-version
Apr 17, 2026
Merged

Bump Go module path to github.com/grafana/pyroscope/v2#5073
simonswine merged 9 commits intografana:mainfrom
simonswine:20260417_update-go-mod-major-version

Conversation

@simonswine
Copy link
Copy Markdown
Contributor

@simonswine simonswine commented Apr 17, 2026

Summary

  • Updates the root Go module path from github.com/grafana/pyroscope to github.com/grafana/pyroscope/v2 to comply with Go's major version suffix requirement for v2+ releases
  • Rewrites all internal import paths across ~636 files
  • Updates pkg/buf.gen.yaml go_package_prefix and Makefile VPREFIX to match

The api and lidia submodules are intentionally kept at their v1 module paths.

Test plan

  • go build ./... passes
  • go mod tidy produces no changes
  • make lint passes
  • Sanity grep confirms no missed imports: grep -r '"github.com/grafana/pyroscope/' --include='*.go' . | grep -v '/v2/' | grep -v 'pyroscope-go' | grep -v 'pyroscope/api/' | grep -v 'pyroscope/lidia'

Note

Medium Risk
Moderate risk because it changes the Go module path and rewrites a large number of internal imports, which can break downstream builds and generated-code references if anything is missed. No functional logic changes are intended, but build/test tooling and dependency resolution are affected repo-wide.

Overview
Updates the root Go module path to github.com/grafana/pyroscope/v2 and rewrites internal imports throughout the repo to use the new .../v2/... prefix.

Aligns build and codegen configuration with the new module path (e.g., Makefile VPREFIX and pkg/buf.gen.yaml go_package_prefix), and updates generated Go protobuf/connect outputs accordingly.

Reviewed by Cursor Bugbot for commit fefa8dd. Bugbot is set up for automated code reviews on this repo. Configure here.

Go requires a /v2 suffix in the module path for major version >= 2.
Updates the root module declaration, all internal import paths, the
Makefile VPREFIX, and pkg/buf.gen.yaml go_package_prefix.

The api and lidia submodules are kept at their current v1 paths.
After bumping pkg/buf.gen.yaml go_package_prefix to .../v2/pkg/, the
embedded raw file descriptors in the generated .pb.go files needed
regenerating to encode the correct go_package option string.
find_go.go: fix comment that was incorrectly updated to include /v2
by the bulk import path rewrite.

find_test.go: remove incorrect /v2 from expected GitHub web URLs that
were incorrectly updated by the bulk import path rewrite (these are
HTML URLs, not Go import paths).
compacted.golden: update byte offsets/sizes — the block data encodes
function names which are 3 bytes longer with the v2 path, shifting all
table-of-contents offsets.

compaction_test.go: revert FunctionName strings to v1 paths — the
testdata/segments were profiled from a v1 binary so recording rule
function name matching must use the old module path.
@simonswine simonswine marked this pull request as ready for review April 17, 2026 13:39
Comment thread pkg/featureflags/feature_flags.go Outdated
Comment thread pkg/block/section_profiles.go Outdated
buf: make([]parquet.Row, 1),
GenericWriter: parquet.NewGenericWriter[*schemav1.Profile](w,
parquet.CreatedBy("github.com/grafana/pyroscope/", build.Version, build.Revision),
parquet.CreatedBy("github.com/grafana/pyroscope/v2/", build.Version, build.Revision),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want/need the change here?

Comment thread pkg/frontend/vcs/source/find_test.go Outdated
Comment on lines +258 to +259
FunctionName: "github.com/grafana/pyroscope/v2/pkg/compactionworker.(*Worker).runCompaction",
Path: "/Users/christian/git/github.com/grafana/pyroscope/v2/pkg/compactionworker/worker.go",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably doesn't matter since it is a test, but this path seems wrong

Comment thread pkg/frontend/vcs/source/find_test.go Outdated
FunctionName: "github.com/grafana/pyroscope/pkg/foo.Bar",
Path: "/Users/christian/git/github.com/grafana/pyroscope/pkg/foo/bar.go",
FunctionName: "github.com/grafana/pyroscope/v2/pkg/foo.Bar",
Path: "/Users/christian/git/github.com/grafana/pyroscope/v2/pkg/foo/bar.go",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably doesn't matter since it is a test, but this path seems wrong

Comment thread pkg/phlaredb/profile_store.go Outdated
@@ -69,7 +69,7 @@ type profileStore struct {

func newParquetProfileWriter(writer io.Writer, options ...parquet.WriterOption) *parquet.GenericWriter[*schemav1.Profile] {
options = append(options, parquet.PageBufferSize(parquetWriteBufferSize))
options = append(options, parquet.CreatedBy("github.com/grafana/pyroscope/", build.Version, build.Revision))
options = append(options, parquet.CreatedBy("github.com/grafana/pyroscope/v2/", build.Version, build.Revision))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, do we want/need this change?

parquet.CreatedBy is metadata stored in parquet file headers - it's a
human-readable identifier, not a Go import path. The bulk module path
rewrite incorrectly changed "github.com/grafana/pyroscope/" to
"github.com/grafana/pyroscope/v2/" in all five places.

Also revert the two local filesystem paths in find_test.go that got
/v2 added by the bulk rewrite. Go module major version suffixes apply
to import paths, not to filesystem paths where repos are checked out.
The function names (which are import paths) correctly retain /v2.
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.

Reviewed by Cursor Bugbot for commit 932ccb3. Configure here.

Comment thread pkg/frontend/vcs/source/find_test.go
@simonswine simonswine merged commit d55b18e into grafana:main Apr 17, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants