Connect your Go backend to Chrome DevTools using Subtrace
You can connect your Go backend to Chrome DevTools using Subtrace so that you
can can inspect the status, headers, payload, and latency of all requests. It
takes just one command to integrate Subtrace.For this guide, we’ll use the following Go app as an example:
package mainimport ( "fmt" "net/http")type server struct{}func (s *server) ServeHTTP(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) fmt.Fprintf(w, "hello from golang!\n")}func main() { fmt.Printf("listening on port 8080...\n") if err := http.ListenAndServe(":8080", new(server)); err != nil { panic(err) }}
First, download the latest version of Subtrace using the following command:
curl -fsSL https://subtrace.dev/install.sh | sh
And get a SUBTRACE_TOKEN from the Subtrace dashboard
for free to set it as an environment variable.
# get a tracer token for free at https://subtrace.dev/dashboardexport SUBTRACE_TOKEN=
Build the main binary using the following commands:
go mod initgo mod tidygo build -o main main.go
And start your server using Subtrace:
subtrace run -- ./main
Send some requests to localhost:8080 to see them automatically appear in
Chrome DevTools in the Subtrace dashboard!
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Subtrace","colors":{"primary":"#0369a1","light":"#0369a1","dark":"#0369a1"},"logo":{"light":"https://mintcdn.com/subtrace/qpTd5I2XwvFUV3U2/images/logo_text_black.svg?fit=max\u0026auto=format\u0026n=qpTd5I2XwvFUV3U2\u0026q=85\u0026s=3a5860f35ae749987a31a4861c6bebe5","dark":"https://mintcdn.com/subtrace/qpTd5I2XwvFUV3U2/images/logo_text_white.svg?fit=max\u0026auto=format\u0026n=qpTd5I2XwvFUV3U2\u0026q=85\u0026s=a31461d3fef8bd3fbe580c2921ef8c5c","href":"https://subtrace.dev"},"favicon":"/images/favicon.svg","navbar":{"links":[{"label":"Support","href":"mailto:support@subtrace.dev"}],"primary":{"type":"button","label":"Dashboard","href":"https://subtrace.dev/dashboard"}},"footer":{"socials":{"github":"https://github.com/subtrace"}},"integrations":{"posthog":{"apiKey":"phc_SXVdOsEGSK2VVBbSC3SYMJTIZeD6T5qiTtJdVg4c55X"}},"navigation":{"global":{"anchors":[{"anchor":"Dashboard","icon":"table","href":"https://subtrace.dev/dashboard"},{"anchor":"Discord","icon":"discord","href":"https://subtrace.dev/discord"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"subtrace","hasAudioNarration":false,"actualSubdomain":"subtrace","customDomains":["docs.subtrace.dev","subtrace.dev"],"gitSource":{"type":"github","owner":"subtrace","repo":"subtrace","deployBranch":"master","contentDirectory":"docs","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6a20c56acf0492c7637e5e05","collectionId":"d434f0e7-41fe-4508-8dcb-df92c6858440","schemaVersion":"v2"},"entitlements":{},"buildId":"6ae92152cfea1bf975332445:success","clientVersion":"0.0.4074","searchFilterCounts":[{"language":"default","tag":"Documentation","count":27},{"language":"default","tag":"Platforms","count":10},{"language":"default","tag":"Language guides","count":9},{"language":"default","tag":"Configuration","count":3},{"language":"default","tag":"Getting Started","count":2},{"language":"default","tag":"Advanced","count":1},{"language":"default","tag":"Reference","count":1},{"language":"default","tag":"Tutorials","count":1}]},"assistantConfig":{},"basePath":"/docs","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"comment-mode","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"#sidebar img{background-color:transparent}"}],"page":{"pagePath":"golang","slug":"/golang","pageMetadata":{"title":"Go + Subtrace","sidebarTitle":"Go","description":"Connect your Go backend to Chrome DevTools using Subtrace","icon":"golang","href":"/golang"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Connect your Go backend to Chrome DevTools using Subtrace\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,..._provideComponents(),...props.components},{CodeBlock}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`You can connect your Go backend to Chrome DevTools using Subtrace so that you\ncan can inspect the status, headers, payload, and latency of all requests. It\ntakes just one command to integrate Subtrace.`}),`\n`,_jsx(_components.p,{children:`For this guide, we’ll use the following Go app as an example:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`20`,language:`go`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`go`,children:_jsxs(_components.code,{language:`go`,numberOfLines:`20`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`package`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` main`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#CE9178`},children:`fmt`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#CE9178`},children:`net/http`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`type`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` server`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` struct`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{}`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`func`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`s `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`server`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`ServeHTTP`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`w`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` http`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`ResponseWriter`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`r`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`http`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`Request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` w`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`WriteHeader`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`http`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`StatusOK`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` fmt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`Fprintf`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`w`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"hello from golang!`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`func`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` main`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` fmt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`Printf`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"listening on port 8080...`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` err`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` :=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` http`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`ListenAndServe`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\":8080\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`new`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`server`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)); `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`err`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` !=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` nil`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` panic`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`err`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`First, download the latest version of Subtrace using the following command:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -fsSL`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://subtrace.dev/install.sh`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:` sh`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`And get a `,_jsx(_components.code,{children:`SUBTRACE_TOKEN`}),` from the Subtrace `,_jsx(_components.a,{href:`https://subtrace.dev/dashboard`,children:`dashboard`}),`\nfor free to set it as an environment variable.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# get a tracer token for free at https://subtrace.dev/dashboard`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`export`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` SUBTRACE_TOKEN`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Build the `,_jsx(_components.code,{children:`main`}),` binary using the following commands:`]}),`\n`,_jsx(CodeBlock,{numberOfLines:`4`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`go mod init`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`go mod tidy`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`go build -o main main.go`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`And start your server using Subtrace:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`subtrace run -- ./main`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`Send some requests to `,_jsx(_components.code,{children:`localhost:8080`}),` to see them automatically appear in\nChrome DevTools in the Subtrace dashboard!`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Go + Subtrace","sidebarTitle":"Go","description":"Connect your Go backend to Chrome DevTools using Subtrace","icon":"golang","href":"/golang"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"subdomain":"subtrace","siteName":"Subtrace","title":"Go + Subtrace - Subtrace","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2025-10-09T08:04:44.888Z","originalFileLocation":"golang.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Connect your Go backend to Chrome DevTools using Subtrace\">\u003cmeta data-mint-head name=\"application-name\" content=\"Subtrace\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/subtrace/kmpiXO89wZGndhxb/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/docs/mintlify-assets/_mintlify/favicons/subtrace/kmpiXO89wZGndhxb/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/subtrace/kmpiXO89wZGndhxb/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/subtrace/kmpiXO89wZGndhxb/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/subtrace/kmpiXO89wZGndhxb/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/subtrace/kmpiXO89wZGndhxb/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/subtrace/kmpiXO89wZGndhxb/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/subtrace/kmpiXO89wZGndhxb/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/subtrace/kmpiXO89wZGndhxb/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Go + Subtrace - Subtrace\">\u003cmeta data-mint-head property=\"og:description\" content=\"Connect your Go backend to Chrome DevTools using Subtrace\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Subtrace\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.subtrace.dev/docs/golang\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://subtrace.mintlify.site/docs/_mintlify/api/og/v2?division=Language+guides\u0026amp;title=Go+%2B+Subtrace\u0026amp;description=Connect+your+Go+backend+to+Chrome+DevTools+using+Subtrace\u0026amp;theme=7503905425d8ddc66b225f01\u0026amp;signature=1bf229e19cc0321bef0a046ad2f346f177fa304476f72ff15f532a01aa41e68d\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Go + Subtrace - Subtrace\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Connect your Go backend to Chrome DevTools using Subtrace\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://subtrace.mintlify.site/docs/_mintlify/api/og/v2?division=Language+guides\u0026amp;title=Go+%2B+Subtrace\u0026amp;description=Connect+your+Go+backend+to+Chrome+DevTools+using+Subtrace\u0026amp;theme=7503905425d8ddc66b225f01\u0026amp;signature=1bf229e19cc0321bef0a046ad2f346f177fa304476f72ff15f532a01aa41e68d\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/docs/mintlify-assets/_mintlify/favicons/subtrace/kmpiXO89wZGndhxb/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Subtrace\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0369a1\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.subtrace.dev/docs/golang\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/golang.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.subtrace.dev/#organization\",\"name\":\"Subtrace\",\"url\":\"https://docs.subtrace.dev\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/subtrace/qpTd5I2XwvFUV3U2/images/logo_text_black.svg?fit=max\u0026auto=format\u0026n=qpTd5I2XwvFUV3U2\u0026q=85\u0026s=3a5860f35ae749987a31a4861c6bebe5\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.subtrace.dev/docs#website\",\"name\":\"Subtrace\",\"url\":\"https://docs.subtrace.dev/docs\",\"publisher\":{\"@id\":\"https://docs.subtrace.dev/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.subtrace.dev/docs/golang#webpage\",\"url\":\"https://docs.subtrace.dev/docs/golang\",\"name\":\"Go + Subtrace\",\"description\":\"Connect your Go backend to Chrome DevTools using Subtrace\",\"dateModified\":\"2025-10-09T08:04:44.888Z\",\"isPartOf\":{\"@id\":\"https://docs.subtrace.dev/docs#website\"},\"breadcrumb\":{\"@id\":\"https://docs.subtrace.dev/docs/golang#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.subtrace.dev/docs/golang#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Language guides\",\"item\":\"https://docs.subtrace.dev/docs/nodejs-express\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Go + Subtrace\",\"item\":\"https://docs.subtrace.dev/docs/golang\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.subtrace.dev/docs/golang#article\",\"headline\":\"Go + Subtrace\",\"name\":\"Go + Subtrace\",\"description\":\"Connect your Go backend to Chrome DevTools using Subtrace\",\"url\":\"https://docs.subtrace.dev/docs/golang\",\"mainEntityOfPage\":{\"@id\":\"https://docs.subtrace.dev/docs/golang#webpage\"},\"dateModified\":\"2025-10-09T08:04:44.888Z\",\"publisher\":{\"@id\":\"https://docs.subtrace.dev/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.subtrace.dev/docs#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Subtrace\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Subtrace","nav":{"global":{"anchors":[{"anchor":"Dashboard","icon":"table","href":"https://subtrace.dev/dashboard"},{"anchor":"Discord","icon":"discord","href":"https://subtrace.dev/discord"}]},"anchors":[{"anchor":"Documentation","icon":"book-open","groups":[{"group":"Getting Started","pages":[{"title":"Quickstart","sidebarTitle":"Quickstart","icon":"rocket","href":"/quickstart"},{"title":"Dashboard","sidebarTitle":"Dashboard","icon":"table-layout","href":"/dashboard"}]},{"group":"Platforms","pages":[{"title":"Using Subtrace with Docker","sidebarTitle":"Docker","icon":"docker","href":"/docker"},{"title":"Using Subtrace with Docker Compose","sidebarTitle":"Docker Compose","icon":"docker","href":"/docker-compose"},{"title":"Installing Subtrace on Kubernetes","sidebarTitle":"Kubernetes","icon":"cubes","href":"/kubernetes"},{"title":"Using Subtrace on Elastic Container Service (ECS)","sidebarTitle":"Elastic Container Service","icon":"aws","href":"/ecs"},{"title":"Using Subtrace on Elastic Kubernetes Service (EKS)","sidebarTitle":"Elastic Kubernetes Service","icon":"aws","href":"/eks"},{"title":"Cloudflare Workers","sidebarTitle":"Cloudflare Workers","icon":"cloudflare","href":"/cloudflare"},{"title":"Use Subtrace on Vercel+Next.js","sidebarTitle":"Vercel + Next.js","icon":"https://mintlify.s3.us-west-1.amazonaws.com/subtrace/images/vercel/icon.svg","href":"/vercel-next"},{"title":"Fly.io","sidebarTitle":"Fly.io","icon":"fly","href":"/fly-io"},{"title":"Porter","sidebarTitle":"Porter","icon":"https://mintlify.s3.us-west-1.amazonaws.com/subtrace/images/porter/icon.png","href":"/porter"},{"title":"Using Subtrace with Flightcontrol","sidebarTitle":"Flightcontrol","icon":"https://mintlify.s3.us-west-1.amazonaws.com/subtrace/images/flightcontrol/icon.svg","href":"/flightcontrol"}]},{"group":"Language guides","pages":[{"title":"NodeJS + Express + Subtrace","sidebarTitle":"Express.js","icon":"node-js","href":"/nodejs-express"},{"title":"Next.js","sidebarTitle":"Next.js","icon":"node-js","href":"/nextjs"},{"title":"SvelteKit","sidebarTitle":"SvelteKit","icon":"node-js","href":"/sveltekit"},{"title":"Python FastAPI + Subtrace","sidebarTitle":"FastAPI","icon":"python","href":"/python-fastapi"},{"title":"Gunicorn + Subtrace","sidebarTitle":"Gunicorn","icon":"python","href":"/python-gunicorn"},{"title":"Python Flask + Subtrace","sidebarTitle":"Flask","description":"Connect your Flask backend to Chrome DevTools using Subtrace","icon":"python","href":"/python-flask"},{"title":"Go + Subtrace","sidebarTitle":"Go","icon":"golang","href":"/golang"},{"title":"PHP Laravel + Subtrace","sidebarTitle":"Laravel","description":"Connect your Laravel backend to Chrome DevTools using Subtrace","icon":"php","href":"/php-laravel"},{"title":"macOS support","sidebarTitle":"macOS","icon":"apple","href":"/macos"}]},{"group":"Configuration","pages":[{"title":"Filter Rules","sidebarTitle":"Filter Rules","icon":"filter","href":"/rules"},{"title":"Tags","sidebarTitle":"Tags","icon":"tag","href":"/tags"},{"title":"Auth \u0026 Credentials","sidebarTitle":"Auth \u0026 Credentials","icon":"key","href":"/credentials"}]},{"group":"Tutorials","pages":[{"title":"Using the dashboard","sidebarTitle":"Using the dashboard","icon":"chart-column","href":"/using-the-dashboard"}]},{"group":"Advanced","pages":[{"title":"Subtrace Benchmarks","sidebarTitle":"Benchmarks","icon":"stopwatch","href":"/benchmarks"}]},{"group":"Reference","pages":[{"title":"Environment Variables","sidebarTitle":"Environment Variables","icon":"sliders","href":"/env-vars"}]}]}]},"basePath":"","title":"Go + Subtrace - Subtrace","buildId":"dpl_CEsowfH15TDzsBT2BFbX312Be4Ct","deploymentId":"dpl_CEsowfH15TDzsBT2BFbX312Be4Ct","dynamics":[],"chunks":[]}