Fix protobuf namespace conflict with prefab-cloud-go#12
Merged
Conversation
Change the protobuf package namespace from "prefab" to "reforge" to avoid
type registration conflicts when sdk-go and prefab-cloud-go are used together
in the same binary.
Previously, both packages were registering types like prefab.OnFailure,
prefab.ConfigValue, etc. in the global protobuf type registry, causing a
panic at runtime:
panic: proto: file "prefab.proto" has a name conflict over prefab.OnFailure
previously from: "github.com/ReforgeHQ/sdk-go/proto"
currently from: "github.com/prefab-cloud/prefab-cloud-go/proto"
The compilation script now:
1. Copies prefab.proto to reforge.proto (avoiding filename collision)
2. Changes "package prefab;" to "package reforge;" (avoiding namespace collision)
3. Compiles the modified copy
4. Cleans up temporary files
This allows both SDKs to coexist without conflicts in either the file
descriptor registry or the type namespace registry.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the protobuf type namespace conflict that occurs when
sdk-goandprefab-cloud-goare used together in the same binary.Problem
Both packages were registering types in the same protobuf namespace (
prefab.*), causing a runtime panic:The original issue was two-fold:
package prefab;creating types likeprefab.OnFailure,prefab.ConfigValue, etc.Solution
Modified the proto compilation script to:
prefab.proto→reforge.proto(fixes filename collision)package prefab;withpackage reforge;(fixes namespace collision)Now the protobuf types are registered as:
reforge.OnFailureinstead ofprefab.OnFailurereforge.ConfigValueinstead ofprefab.ConfigValueThe source proto file (git submodule) remains unchanged.
Changes
proto/reforge.pb.go- Regenerated with new namespacescripts/compile-protos.sh- Added sed command to change package name during buildTest plan
go build ./...make test(561 tests)🤖 Generated with Claude Code