{% load i18n %}

<p>Note: Just as Go is a fairly young language, the raven-go client is also fairly immature and may be missing features.</p>

<p>{% blocktrans with 'https://github.com/getsentry/raven-go' as link %}Start by installing <a href="{{ link }}">raven-go</a>.{% endblocktrans %}</p>

<pre>go get github.com/getsentry/raven-go</pre>

<p>Import the library:</p>

<pre>import "github.com/getsentry/raven-go"</pre>

<p>Next up create an instance of the client:</p>

<pre>client, _ := raven.NewClient("{% if dsn %}{{ dsn }}{% else %}<strong class="dsn">SENTRY_DSN</strong>{% endif %}", nil)</pre>

<p>Now you're all set to capture an event

client.CaptureError(myError, nil, nil)</pre>

<p>A more in-depth example:</p>

<pre>// ... i.e. raisedErr is incoming error
var raisedErr error

// sentry DSN generated by Sentry server
var sentryDSN string = "{% if dsn %}{{ dsn }}{% else %}<strong class="dsn">SENTRY_DSN</strong>{% endif %}"

// r is a request performed when error occured
var r *http.Request

client, err := raven.NewClient(sentryDSN, nil)
if err != nil {
    log.Fatal(err)
}

// create a stacktrace for our current context
trace := raven.NewStacktrace(0, 2, nil)

packet := raven.NewPacket(raisedErr.Error(), raven.NewException(raisedErr, trace), NewHttp(r))

eventID, ch := client.Capture(packet, nil)
if err = &lt;-ch; err != nil {
    log.Fatal(err)
}
message := fmt.Sprintf("Captured error with id %s: %q", eventID, raisedErr)
log.Println(message)</pre>

<p>{% blocktrans with 'http://godoc.org/github.com/getsentry/raven-go' as link %}For more information on other uses of Raven with PHP, please see the <a href="{{ link }}">official documentation for raven-go</a>.{% endblocktrans %}</p>
