Skip to content

feat(integration): make Go a full example-based variant - #267

Merged
sarahxsanders merged 3 commits into
mainfrom
posthog-code/integration-go-framework
Aug 21, 2026
Merged

sarahxsanders merged 3 commits into
mainfrom
posthog-code/integration-go-framework

Conversation

@sarahxsanders

@sarahxsanders sarahxsanders commented Jul 22, 2026 •

Copy link
Copy Markdown
Collaborator

Promotes the Go integration from a docs-only variant to a full example-based variant, anchored on a real, compiling example app at example-apps/go.

Why: without an anchoring example, the wizard reinvents the integration shape every run. A worked example collapses that variance — the point raised in review.

What's here:

  • example-apps/go/ — idiomatic net/http service: one client per process, env-var config, identify, event capture, feature flags via the current EvaluateFlags snapshot API, error tracking, and client.Close() on graceful shutdown. go build + go vet clean.
  • config.yaml: go switched from template: description-go-docs-only.md → example_paths + framework: go.
  • Removed the now-unused description-go-docs-only.md.

Ships as a pair with the wizard detection PR PostHog/wizard#945.

@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.

Replace the go docs-only variant with a full variant anchored on a real
example app (example-apps/go): an idiomatic net/http service that creates
one PostHog client per process, configures it from environment variables,
identifies users, captures events, evaluates feature flags via the current
EvaluateFlags snapshot API, reports errors, and flushes on graceful
shutdown with client.Close().

An anchoring example collapses the run-to-run variance a docs-only prompt
leaves open. Removes description-go-docs-only.md (now unused) and points
the variant at the example via example_paths + framework: go.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sarahxsanders
sarahxsanders force-pushed the posthog-code/integration-go-framework branch from 18b4e97 to 6dabe99 Compare July 23, 2026 19:21
@sarahxsanders sarahxsanders changed the title feat(integration): route the go variant to wizard framework detection feat(integration): make Go a full example-based variant Jul 23, 2026
@sarahxsanders
sarahxsanders marked this pull request as ready for review July 24, 2026 15:15
@sarahxsanders
sarahxsanders requested a review from a team as a code owner July 24, 2026 15:15
@gewenyu99

Copy link
Copy Markdown
Collaborator

Full e2e run of this PR pair (wizard #945 + context-mill #267, both with main merged in) against gotify/server — real Go server, go.mod at root.

Outcome: PostHog set up — dashboard and notebook created through prod MCP, go build ./... and go vet ./... clean on the output, defer posthogClient.Close() wired, identity via DistinctId on captures. The one conflict the outro reports is gotify's pre-existing ui/build/* gap, not this integration.

Note: the branch as filed fails at the dashboard step — its agent prompts predate the posthog_exec tool grant on main. Works once main is merged in, which for context-mill is blocked on unsigned commits.

All 25 TUI frames 01-intro.png 02-auth.png 03-run.png 04-run.png 05-run.png 06-run.png 07-run.png 08-run.png 09-run.png 10-run.png 11-run.png 12-run.png 13-run.png 14-run.png 15-run.png 16-run.png 17-run.png 18-run.png 19-run.png 20-run.png 21-outro.png 22-outro.png 23-mcp.png 24-slack-connect.png 25-keep-skills.png

@gewenyu99 gewenyu99 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Stamped but you have some unsigned commits

sarahxsanders and others added 2 commits August 21, 2026 09:55
The handlers interpolated the cookie distinct id, the submitted user_id, the
email, and the error message straight into HTML. Since this example is copied
into real integrations, escape all user-controlled strings with
html.EscapeString so the pattern that gets propagated is safe by default.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Semgrep (cookie-missing-httponly / cookie-missing-secure) blocks cookies
without these flags. Set HttpOnly, Secure, and SameSite=Lax on both the
user_id and burrito_count cookies so the copied pattern is secure by default.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sarahxsanders
sarahxsanders force-pushed the posthog-code/integration-go-framework branch from 13d78c9 to 35882d7 Compare August 21, 2026 13:56
@sarahxsanders
sarahxsanders merged commit d2896b8 into main Aug 21, 2026
12 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