Skip to content

feat: add Go framework support#945

Open
sarahxsanders wants to merge 2 commits into
mainfrom
posthog-code/go-framework-support
Open

feat: add Go framework support#945
sarahxsanders wants to merge 2 commits into
mainfrom
posthog-code/go-framework-support

Conversation

@sarahxsanders

@sarahxsanders sarahxsanders commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Related PRs:

Adds Go as a supported framework, following the backend-framework pattern (Rails):

  • Integration.go enum entry at the end of the frameworks block, before the language fallbacks — a Go repo with an embedded frontend package.json still resolves to Go (covered by a new detection test)
  • GO_AGENT_CONFIG in src/frameworks/go/ — claims a go.mod with a module directive (a bare directory of .go files falls through); gathers the go 1.x directive as agent context; installs via go get github.com/posthog/posthog-go
  • goModulesPackageManager helper + FRAMEWORK_REGISTRY entry
  • bash-fence grammar for go: allows get|build|vet|fmt|version|list and go mod tidy/download/verify/graph/why; go run/test/generate stay denied (arbitrary code execution) and go mod edit stays denied (can rewrite module requirements to arbitrary sources)
  • Pins framework: go on integration-go in the variant-resolution contract test, matching the context-mill PR above

Why: the wizard docs page lists Go as "Coming soon"; instead of removing the label (posthog.com#18797), we're making the wizard actually support it.

Verification: pnpm build ✅, pnpm test ✅ (1536 tests, incl. new go detect + fence tests), pnpm fix


Created with PostHog Code

@github-actions

Copy link
Copy Markdown

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci basic-integration
  • /wizard-ci mcp-analytics
  • /wizard-ci revenue

Test an individual app:

  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
Show more apps
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/javascript-node
  • /wizard-ci basic-integration/javascript-web
  • /wizard-ci basic-integration/laravel
  • /wizard-ci basic-integration/next-js
  • /wizard-ci basic-integration/nuxt
  • /wizard-ci basic-integration/python
  • /wizard-ci basic-integration/rails
  • /wizard-ci basic-integration/react-native
  • /wizard-ci basic-integration/react-router
  • /wizard-ci basic-integration/sveltekit
  • /wizard-ci basic-integration/swift
  • /wizard-ci basic-integration/tanstack-router
  • /wizard-ci basic-integration/tanstack-start
  • /wizard-ci basic-integration/vue
  • /wizard-ci mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/typescript-sdk
  • /wizard-ci revenue/stripe

Results will be posted here when complete.

Adds Go as a supported framework following the backend-framework pattern (Rails):

- Integration.go enum entry at the end of the frameworks block, before the language fallbacks
- GO_AGENT_CONFIG in src/frameworks/go/ — claims a go.mod with a module directive, gathers the go directive version as agent context, installs via go get github.com/posthog/posthog-go
- goModulesPackageManager helper + FRAMEWORK_REGISTRY entry
- bash-fence grammar for the go binary: get/build/vet/fmt/version/list plus go mod tidy/download/verify/graph/why; run/test/generate stay denied (arbitrary code execution), go mod edit stays denied (rewrites module requirements)
- Pins framework: go on integration-go in the variant-resolution contract test, matching context-mill PR #267 which must release before this merges
- Marks go.mod as a real framework target in the agentic manifest comment

Generated-By: PostHog Code
Task-Id: 9c949855-7611-48f2-b8b5-7aa4112543e5
go build/vet were allowed by subcommand without inspecting flags, so
`go build -toolexec=/tmp/x.sh` would run an arbitrary program on every
build. Deny the -toolexec flag explicitly (both = and space forms) and
add attack-corpus tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sarahxsanders
sarahxsanders marked this pull request as ready for review July 24, 2026 15:16
@sarahxsanders
sarahxsanders requested a review from a team as a code owner July 24, 2026 15:16
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.

1 participant