README.md
1<p align="center">
2 <a href="https://sentry.io" target="_blank" align="center">
3 <img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" width="280">
4 </a>
5 <br />
6</p>
7
8# Official Sentry SDK for Go
9
10[![Build Status](https://github.com/getsentry/sentry-go/workflows/go-workflow/badge.svg)](https://github.com/getsentry/sentry-go/actions?query=workflow%3Ago-workflow)
11[![Go Report Card](https://goreportcard.com/badge/github.com/getsentry/sentry-go)](https://goreportcard.com/report/github.com/getsentry/sentry-go)
12[![Discord](https://img.shields.io/discord/621778831602221064)](https://discord.gg/Ww9hbqr)
13[![GoDoc](https://godoc.org/github.com/getsentry/sentry-go?status.svg)](https://godoc.org/github.com/getsentry/sentry-go)
14[![go.dev](https://img.shields.io/badge/go.dev-pkg-007d9c.svg?style=flat)](https://pkg.go.dev/github.com/getsentry/sentry-go)
15
16`sentry-go` provides a Sentry client implementation for the Go programming
17language. This is the next line of the Go SDK for [Sentry](https://sentry.io/),
18intended to replace the `raven-go` package.
19
20> Looking for the old `raven-go` SDK documentation? See the Legacy client section [here](https://docs.sentry.io/clients/go/).
21> If you want to start using sentry-go instead, check out the [migration guide](https://docs.sentry.io/platforms/go/migration/).
22
23## Requirements
24
25The only requirement is a Go compiler.
26
27We verify this package against the 3 most recent releases of Go. Those are the
28supported versions. The exact versions are defined in
29[`GitHub workflow`](.github/workflows/ci.yml).
30
31In addition, we run tests against the current master branch of the Go toolchain,
32though support for this configuration is best-effort.
33
34## Installation
35
36`sentry-go` can be installed like any other Go library through `go get`:
37
38```console
39$ go get github.com/getsentry/sentry-go
40```
41
42Or, if you are already using
43[Go Modules](https://github.com/golang/go/wiki/Modules), you may specify a
44version number as well:
45
46```console
47$ go get github.com/getsentry/sentry-go@latest
48```
49
50Check out the [list of released versions](https://pkg.go.dev/github.com/getsentry/sentry-go?tab=versions).
51
52## Configuration
53
54To use `sentry-go`, you’ll need to import the `sentry-go` package and initialize
55it with your DSN and other [options](https://pkg.go.dev/github.com/getsentry/sentry-go#ClientOptions).
56
57If not specified in the SDK initialization, the
58[DSN](https://docs.sentry.io/product/sentry-basics/dsn-explainer/),
59[Release](https://docs.sentry.io/product/releases/) and
60[Environment](https://docs.sentry.io/product/sentry-basics/environments/)
61are read from the environment variables `SENTRY_DSN`, `SENTRY_RELEASE` and
62`SENTRY_ENVIRONMENT`, respectively.
63
64More on this in the [Configuration section of the official Sentry Go SDK documentation](https://docs.sentry.io/platforms/go/configuration/).
65
66## Usage
67
68The SDK supports reporting errors and tracking application performance.
69
70To get started, have a look at one of our [examples](example/):
71- [Basic error instrumentation](example/basic/main.go)
72- [Error and tracing for HTTP servers](example/http/main.go)
73
74We also provide a [complete API reference](https://pkg.go.dev/github.com/getsentry/sentry-go).
75
76For more detailed information about how to get the most out of `sentry-go`,
77checkout the official documentation:
78
79- [Sentry Go SDK documentation](https://docs.sentry.io/platforms/go/)
80- Guides:
81 - [net/http](https://docs.sentry.io/platforms/go/guides/http/)
82 - [echo](https://docs.sentry.io/platforms/go/guides/echo/)
83 - [fasthttp](https://docs.sentry.io/platforms/go/guides/fasthttp/)
84 - [gin](https://docs.sentry.io/platforms/go/guides/gin/)
85 - [iris](https://docs.sentry.io/platforms/go/guides/iris/)
86 - [martini](https://docs.sentry.io/platforms/go/guides/martini/)
87 - [negroni](https://docs.sentry.io/platforms/go/guides/negroni/)
88
89## Resources
90
91- [Bug Tracker](https://github.com/getsentry/sentry-go/issues)
92- [GitHub Project](https://github.com/getsentry/sentry-go)
93- [![GoDoc](https://godoc.org/github.com/getsentry/sentry-go?status.svg)](https://godoc.org/github.com/getsentry/sentry-go)
94- [![go.dev](https://img.shields.io/badge/go.dev-pkg-007d9c.svg?style=flat)](https://pkg.go.dev/github.com/getsentry/sentry-go)
95- [![Documentation](https://img.shields.io/badge/documentation-sentry.io-green.svg)](https://docs.sentry.io/platforms/go/)
96- [![Forum](https://img.shields.io/badge/forum-sentry-green.svg)](https://forum.sentry.io/c/sdks)
97- [![Discord](https://img.shields.io/discord/621778831602221064)](https://discord.gg/Ww9hbqr)
98- [![Stack Overflow](https://img.shields.io/badge/stack%20overflow-sentry-green.svg)](http://stackoverflow.com/questions/tagged/sentry)
99- [![Twitter Follow](https://img.shields.io/twitter/follow/getsentry?label=getsentry&style=social)](https://twitter.com/intent/follow?screen_name=getsentry)
100
101## License
102
103Licensed under
104[The 2-Clause BSD License](https://opensource.org/licenses/BSD-2-Clause), see
105[`LICENSE`](LICENSE).
106
107## Community
108
109Join Sentry's [`#go` channel on Discord](https://discord.gg/Ww9hbqr) to get
110involved and help us improve the SDK!
111