Skip to content

Commit f8e3c9c

Browse files
Merge pull request #8 from depot/sentry
2 parents 10d8564 + 787e330 commit f8e3c9c

File tree

5 files changed

+99
-1
lines changed

5 files changed

+99
-1
lines changed

.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ builds:
1313
binary: bin/depot
1414
main: ./cmd/depot
1515
ldflags:
16-
- -s -w -X github.com/depot/cli/internal/build.Version={{.Version}} -X github.com/depot/cli/internal/build.Date={{time "2006-01-02"}}
16+
- -s -w -X github.com/depot/cli/internal/build.Version={{.Version}} -X github.com/depot/cli/internal/build.Date={{time "2006-01-02"}} -X github.com/depot/cli/internal/build.SentryEnvironment=release
1717
- -X main.updaterEnabled=depot/cli
1818
id: macos
1919
goos: [darwin]

cmd/depot/main.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package main
22

33
import (
4+
"log"
45
"os"
56

67
"github.com/depot/cli/internal/build"
78
"github.com/depot/cli/pkg/cmd/root"
9+
"github.com/getsentry/sentry-go"
810
)
911

1012
func main() {
@@ -13,6 +15,17 @@ func main() {
1315
}
1416

1517
func runMain() int {
18+
if os.Getenv("DEPOT_ERROR_TELEMETRY") != "0" {
19+
err := sentry.Init(sentry.ClientOptions{
20+
Dsn: "https://[email protected]/6271909",
21+
Environment: build.SentryEnvironment,
22+
Release: build.Version,
23+
})
24+
if err != nil {
25+
log.Fatalf("sentry.Init: %s", err)
26+
}
27+
}
28+
1629
buildVersion := build.Version
1730
buildDate := build.Date
1831

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ require (
1111
github.com/docker/distribution v2.8.0+incompatible
1212
github.com/docker/docker v20.10.7+incompatible
1313
github.com/docker/go-units v0.4.0
14+
github.com/getsentry/sentry-go v0.13.0
1415
github.com/moby/buildkit v0.10.0-rc2.0.20220308185020-fdecd0ae108b
1516
github.com/morikuni/aec v1.0.0
1617
github.com/pkg/errors v0.9.1

0 commit comments

Comments
 (0)