Skip to content

Conversation

@mattinannt
Copy link
Member

@mattinannt mattinannt commented Oct 29, 2025

Refactor: Update Go Module Path to Match VCS Layout (Go Best Practice)

Problem

The Go module path should always match the VCS layout. Since go.mod lives in apps/hub/, the module path must include that to be fetchable and reusable by external projects.

Solution

Updated to follow Go's recommended multi-module monorepo pattern:

  • Changed module name in go.mod to github.com/formbricks/hub/apps/hub
  • Updated all package imports to github.com/formbricks/hub/apps/hub/internal/...
  • This matches the standard Go convention where the module path reflects the directory structure

Why This Matters

  • ✅ Module path matches VCS layout (go.mod location)
  • ✅ Module is now fetchable: go get github.com/formbricks/hub/apps/hub
  • ✅ Works with go.work for local monorepo development
  • ✅ Follows patterns used by large monorepos (Kubernetes, Terraform, etc.)
  • ✅ Go tooling works correctly and predictably

Files Changed

  • go.mod - Updated module to github.com/formbricks/hub/apps/hub
  • 33 Go files - Updated all internal package imports to include apps/hub in path

Testing

  • ✅ Code compiles successfully with go build ./cmd/hub
  • go mod tidy completes without errors
  • ✅ All import paths resolved correctly
  • ✅ Matches Go monorepo best practices

References

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

- Change module from github.com/formbricks/formbricks-rewrite/apps/hub to github.com/formbricks/hub
- Update all internal package imports across 30+ files to use the new module path
- Update imports in cmd/hub/main.go and cmd/generate-openapi/main.go
- Verified compilation and go mod tidy passes
- CI workflows compatible with new module path (no hardcoded module references)
@mattinannt mattinannt force-pushed the fix/update-go-module-path branch from 3719276 to e37f63f Compare October 29, 2025 20:17
@mattinannt mattinannt merged commit 1951d91 into main Oct 29, 2025
2 checks passed
@mattinannt mattinannt deleted the fix/update-go-module-path branch October 29, 2025 20:19
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