Connect your Go Application
Connect your Go application to Bugsink to start tracking errors.
Bugsink is compatible with the
Sentry SDK. A basic setup is the following:
Step 1: Install the SDK
Install the SDK using go get:
{% code %}:::text
go get github.com/getsentry/sentry-go@latest
{% endcode %}
Step 2: Initialize the SDK
Initialize and configure the SDK with your DSN:
{% code %}:::golang
package main
import (
"log"
"time"
"github.com/getsentry/sentry-go"
)
func main() {
err := sentry.Init(sentry.ClientOptions{
Dsn: "{{ dsn }}",
SendDefaultPII: true,
EnableTracing: false,
TracesSampleRate: 0,
DisableLogs: true,
DisableMetrics: true,
DisableClientReports: true,
})
if err != nil {
log.Fatalf("sentry.Init: %s", err)
}
defer sentry.Flush(2 * time.Second)
// Your application code starts here.
}
{% endcode %}
Step 3: Verify the setup
To verify that everything is working, create an error on purpose and check that it appears in Bugsink.
Put this code in your application where it can easily be triggered and then trigger it:
{% code %}:::golang
sentry.CaptureMessage("Error created on purpose to send it to Bugsink")
{% endcode %}
Further reading