123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
- import type {
- Docs,
- DocsParams,
- OnboardingConfig,
- } from 'sentry/components/onboarding/gettingStartedDoc/types';
- import {
- getCrashReportGenericInstallStep,
- getCrashReportModalConfigDescription,
- getCrashReportModalIntroduction,
- } from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding';
- import replayOnboardingJsLoader from 'sentry/gettingStartedDocs/javascript/jsLoader/jsLoader';
- import {t, tct} from 'sentry/locale';
- type Params = DocsParams;
- const getConfigureSnippet = (params: Params) => `
- package main
- import (
- "log"
- "github.com/getsentry/sentry-go"
- )
- func main() {
- err := sentry.Init(sentry.ClientOptions{
- Dsn: "${params.dsn}",${
- params.isPerformanceSelected
- ? `
- // Set TracesSampleRate to 1.0 to capture 100%
- // of transactions for performance monitoring.
- // We recommend adjusting this value in production,
- TracesSampleRate: 1.0,`
- : ''
- }
- })
- if err != nil {
- log.Fatalf("sentry.Init: %s", err)
- }
- }`;
- const getVerifySnippet = (params: Params) => `
- package main
- import (
- "log"
- "time"
- "github.com/getsentry/sentry-go"
- )
- func main() {
- err := sentry.Init(sentry.ClientOptions{
- Dsn: "___PUBLIC_DSN___",${
- params.isPerformanceSelected
- ? `
- // Set TracesSampleRate to 1.0 to capture 100%
- // of transactions for performance monitoring.
- // We recommend adjusting this value in production,
- TracesSampleRate: 1.0,`
- : ''
- }
- })
- if err != nil {
- log.Fatalf("sentry.Init: %s", err)
- }
- // Flush buffered events before the program terminates.
- defer sentry.Flush(2 * time.Second)
- sentry.CaptureMessage("It works!")
- }`;
- const onboarding: OnboardingConfig = {
- install: () => [
- {
- type: StepType.INSTALL,
- description: tct('Install our Go SDK using [code:go get]:', {
- code: <code />,
- }),
- configurations: [
- {
- language: 'bash',
- code: 'go get github.com/getsentry/sentry-go',
- },
- ],
- },
- ],
- configure: params => [
- {
- type: StepType.CONFIGURE,
- description: t(
- "Import and initialize the Sentry SDK early in your application's setup:"
- ),
- configurations: [
- {
- language: 'go',
- code: getConfigureSnippet(params),
- },
- ],
- },
- ],
- verify: (params: Params) => [
- {
- type: StepType.VERIFY,
- description: t(
- 'The quickest way to verify Sentry in your Go program is to capture a message:'
- ),
- configurations: [
- {
- language: 'go',
- code: getVerifySnippet(params),
- },
- ],
- },
- ],
- };
- const crashReportOnboarding: OnboardingConfig = {
- introduction: () => getCrashReportModalIntroduction(),
- install: (params: Params) => getCrashReportGenericInstallStep(params),
- configure: () => [
- {
- type: StepType.CONFIGURE,
- description: getCrashReportModalConfigDescription({
- link: 'https://docs.sentry.io/platforms/go/user-feedback/configuration/#crash-report-modal',
- }),
- },
- ],
- verify: () => [],
- nextSteps: () => [],
- };
- const docs: Docs = {
- onboarding,
- replayOnboardingJsLoader,
- crashReportOnboarding,
- };
- export default docs;
|