Skip to content

Commit

Permalink
goreleaser cleanup (#211)
Browse files Browse the repository at this point in the history
Followup from the previous stab, this is actually doing the right thing
now and using build tags instead of files.

Also skips the previous set of hacks that was added for applying the
file.
  • Loading branch information
cyx authored Mar 29, 2021
1 parent b4a692d commit c0db508
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 21 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,11 @@ jobs:
with:
go-version: 1.16

- name: Prepare instrumentation
run: |
echo -n "$SENTRY_DSN" >> $GITHUB_WORKSPACE/internal/instrumentation/sentrydsn.txt
shell: bash
env:
SENTRY_DSN : ${{secrets.SENTRY_DSN}}

- name: Run GoReleaser
uses: goreleaser/[email protected]
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
3 changes: 0 additions & 3 deletions .github/workflows/snyk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup repo
run: |
touch $GITHUB_WORKSPACE/internal/instrumentation/sentrydsn.txt
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/golang@master
env:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# project artifacts
/auth0
/internal/instrumentation/sentrydsn.txt

# Swap
[._]*.s[a-v][a-z]
Expand Down
1 change: 1 addition & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ builds:
- -X github.com/auth0/auth0-cli/internal/buildinfo.Revision={{.Commit}}
- -X github.com/auth0/auth0-cli/internal/buildinfo.BuildUser=goreleaser'
- -X github.com/auth0/auth0-cli/internal/buildinfo.BuildDate={{.Date}}'
- -X github.com/auth0/auth0-cli/internal/instrumentation.SentryDSN={{.Env.SENTRY_DSN}}
archives:
- replacements:
darwin: Darwin
Expand Down
9 changes: 3 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,11 @@ generate:
go generate ./...
.PHONY: generate

setup:
@touch ./internal/instrumentation/sentrydsn.txt

test: setup
test:
CGO_ENABLED=1 go test -race ./... -count 1
.PHONY: test

lint: setup
lint:
golangci-lint run -v --timeout=5m
.PHONY: lint

Expand All @@ -56,7 +53,7 @@ build-all-platforms:
.PHONY: build-all-platforms

# Run all the tests and code checks
ci: setup build-all-platforms test lint
ci: build-all-platforms test lint
.PHONY: ci

$(GOBIN)/mockgen:
Expand Down
7 changes: 3 additions & 4 deletions internal/instrumentation/instrumentation.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@ import (
"github.com/getsentry/sentry-go"
)

//go:embed sentrydsn.txt
var sentryDSN string
var SentryDSN string

// ReportException is designed to be called once as the CLI exits. We're
// purposefully initializing a client all the time given this context.
func ReportException(err error) {
if sentryDSN == "" {
if SentryDSN == "" {
return
}

if err := sentry.Init(sentry.ClientOptions{Dsn: sentryDSN}); err != nil {
if err := sentry.Init(sentry.ClientOptions{Dsn: SentryDSN}); err != nil {
return
}

Expand Down

0 comments on commit c0db508

Please sign in to comment.