-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Revise Getting Started section #1513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d9cac4f
5b23423
6d93249
6c91d81
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
Import and initialize the Sentry SDK early in your application's setup: | ||
|
||
```go | ||
import "github.com/getsentry/sentry-go" | ||
package main | ||
|
||
import ( | ||
"log" | ||
|
||
"github.com/getsentry/sentry-go" | ||
) | ||
|
||
func main() { | ||
sentry.Init(sentry.ClientOptions{ | ||
err := sentry.Init(sentry.ClientOptions{ | ||
Dsn: "___PUBLIC_DSN___", | ||
}) | ||
if err != nil { | ||
log.Fatalf("sentry.Init: %s", err) | ||
} | ||
} | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,25 @@ | ||
The quickest way to verify Sentry in your Go application is to capture an error: | ||
The quickest way to verify Sentry in your Go program is to capture a message: | ||
|
||
```go | ||
package main | ||
|
||
import ( | ||
"errors" | ||
"log" | ||
"time" | ||
|
||
"github.com/getsentry/sentry-go" | ||
) | ||
|
||
func main() { | ||
sentry.Init(sentry.ClientOptions{ | ||
err := sentry.Init(sentry.ClientOptions{ | ||
Dsn: "___PUBLIC_DSN___", | ||
}) | ||
if err != nil { | ||
log.Fatalf("sentry.Init: %s", err) | ||
} | ||
// Flush buffered events before the program terminates. | ||
defer sentry.Flush(2 * time.Second) | ||
|
||
sentry.CaptureException(errors.New("my error")) | ||
// Since sentry emits events in the background we need to make sure | ||
// they are sent before we shut down | ||
sentry.Flush(time.Second * 5) | ||
sentry.CaptureMessage("It works!") | ||
Comment on lines
+21
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For testing purposes, a message is simpler to setup than an error. Prefer educating users to use |
||
} | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ After you completed setting up a project in Sentry, you’ll be given a value wh | |
|
||
## Capturing your first event | ||
|
||
Once you have Sentry integrated into your project, you probably want to verify that everything is working as expected before deploying it, and what better way to do that than to break your application! | ||
Once you have Sentry integrated into your project, you probably want to verify that everything is working as expected before deploying it. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not all platforms suggest "breaking your application", therefore move this sentence to where it is appropriate, and leave it out elsewhere. |
||
|
||
{% wizard %} | ||
{% include components/platform_content.html content_dir='getting-started-verify' %} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adds error handling here. It is easy enough to ignore the error and end up with a misconfigured SDK without warning.
Although this makes the documentation more verbose, this is also where people will refer to. Better have the full picture when copy-pasting.