diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml index 3d2601ec..216e5ef0 100644 --- a/.github/workflows/test-package.yml +++ b/.github/workflows/test-package.yml @@ -8,13 +8,12 @@ jobs: runs-on: ${{ matrix.os }}-latest defaults: run: - working-directory: 'go/src/github.com/bugsnag/bugsnag-go' # relative to $GITHUB_WORKSPACE + working-directory: 'go/src/github.com/bugsnag/bugsnag-go/v2' # relative to $GITHUB_WORKSPACE strategy: fail-fast: false matrix: os: [ubuntu, windows] - go-version: ['1.11', '1.12', '1.13', '1.14', '1.15'] - major-version: ['v2'] + go-version: ['1.11', '1.12', '1.13', '1.14', '1.15', '1.16'] steps: - uses: actions/checkout@v2 @@ -32,13 +31,13 @@ jobs: with: go-version: ${{ matrix.go-version }} - name: install dependencies - run: go get -v -d ./${{ matrix.major-version }}/... + run: go get -v -d ./... - name: run tests - run: go test ./${{ matrix.major-version }}/... + run: go test ./... - name: vet package # go1.12 vet shows spurious 'unknown identifier' issues if: matrix.go-version != '1.12' - run: go vet ./${{ matrix.major-version }}/... + run: go vet ./... - name: install integration dependencies if: matrix.os == 'ubuntu' @@ -47,6 +46,7 @@ jobs: sudo gem install bundler bundle install - name: maze tests + working-directory: go/src/github.com/bugsnag/bugsnag-go # relative to $GITHUB_WORKSPACE if: matrix.os == 'ubuntu' env: GO_VERSION: ${{ matrix.go-version }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 9041d910..9a5143e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 2.1.1 (2021-04-19) + +### Enhancements + +* Update panicwrap dependency to 1.3.2, adding support for darwin arm64 + ## 2.1.0 (2021-01-27) ### Enhancements diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 00000000..83b38f76 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,55 @@ +GIT + remote: https://github.com/bugsnag/maze-runner + revision: 7377529a77eb7585afc66cd2080fcdc4eea3306a + branch: v1 + specs: + bugsnag-maze-runner (1.1.0) + cucumber (~> 3.1.0) + cucumber-expressions (= 5.0.15) + minitest (~> 5.0) + os (~> 1.0.0) + rack (~> 2.0.0) + rake (~> 12.3.3) + test-unit (~> 3.2.0) + +GEM + remote: https://rubygems.org/ + specs: + backports (3.21.0) + builder (3.2.4) + cucumber (3.1.0) + builder (>= 2.1.2) + cucumber-core (~> 3.1.0) + cucumber-expressions (~> 5.0.4) + cucumber-wire (~> 0.0.1) + diff-lcs (~> 1.3) + gherkin (~> 5.0) + multi_json (>= 1.7.5, < 2.0) + multi_test (>= 0.1.2) + cucumber-core (3.1.0) + backports (>= 3.8.0) + cucumber-tag_expressions (~> 1.1.0) + gherkin (>= 5.0.0) + cucumber-expressions (5.0.15) + cucumber-tag_expressions (1.1.1) + cucumber-wire (0.0.1) + diff-lcs (1.4.4) + gherkin (5.1.0) + minitest (5.14.4) + multi_json (1.15.0) + multi_test (0.1.2) + os (1.0.1) + power_assert (2.0.0) + rack (2.0.9) + rake (12.3.3) + test-unit (3.2.9) + power_assert + +PLATFORMS + ruby + +DEPENDENCIES + bugsnag-maze-runner! + +BUNDLED WITH + 2.1.4 diff --git a/Makefile b/Makefile index 3b5dc5b6..665f82a2 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ TEST?=./... +export GO111MODULE=auto + default: alldeps test deps: diff --git a/features/fixtures/app/Dockerfile b/features/fixtures/app/Dockerfile index f176f21a..be61d206 100644 --- a/features/fixtures/app/Dockerfile +++ b/features/fixtures/app/Dockerfile @@ -6,13 +6,21 @@ RUN apk update && apk upgrade && apk add git bash ENV GOPATH /app COPY testbuild /app/src/github.com/bugsnag/bugsnag-go -WORKDIR /app/src/github.com/bugsnag/bugsnag-go +WORKDIR /app/src/github.com/bugsnag/bugsnag-go/v2 -RUN go get . ./sessions ./headers ./errors +RUN go get ./... # Copy test scenarios COPY ./app /app/src/test WORKDIR /app/src/test +# Ensure subsequent steps are re-run if the GO_VERSION variable changes +ARG GO_VERSION +# Create app module - avoid locking bugsnag dep by not checking it in +# Skip on old versions of Go which pre-date modules +RUN if [[ $GO_VERSION != '1.11' && $GO_VERSION != '1.12' ]]; then \ + go mod init && go mod tidy; \ + fi + RUN chmod +x run.sh CMD ["/app/src/test/run.sh"] diff --git a/features/fixtures/autoconfigure/Dockerfile b/features/fixtures/autoconfigure/Dockerfile index e36ebc57..e0764b9f 100644 --- a/features/fixtures/autoconfigure/Dockerfile +++ b/features/fixtures/autoconfigure/Dockerfile @@ -6,13 +6,22 @@ RUN apk update && apk upgrade && apk add git bash ENV GOPATH /app COPY testbuild /app/src/github.com/bugsnag/bugsnag-go -WORKDIR /app/src/github.com/bugsnag/bugsnag-go +WORKDIR /app/src/github.com/bugsnag/bugsnag-go/v2 -RUN go get . ./sessions ./headers ./errors +# Get bugsnag dependencies +RUN go get ./... # Copy test scenarios COPY ./autoconfigure /app/src/test WORKDIR /app/src/test +# Ensure subsequent steps are re-run if the GO_VERSION variable changes +ARG GO_VERSION +# Create app module - avoid locking bugsnag dep by not checking it in +# Skip on old versions of Go which pre-date modules +RUN if [[ $GO_VERSION != '1.11' && $GO_VERSION != '1.12' ]]; then \ + go mod init && go mod tidy; \ + fi + RUN chmod +x run.sh CMD ["/app/src/test/run.sh"] diff --git a/features/fixtures/net_http/Dockerfile b/features/fixtures/net_http/Dockerfile index 39c0a25d..de86a56b 100644 --- a/features/fixtures/net_http/Dockerfile +++ b/features/fixtures/net_http/Dockerfile @@ -8,10 +8,19 @@ RUN apk update && \ ENV GOPATH /app COPY testbuild /app/src/github.com/bugsnag/bugsnag-go -WORKDIR /app/src/github.com/bugsnag/bugsnag-go +WORKDIR /app/src/github.com/bugsnag/bugsnag-go/v2 -RUN go get -v -d . ./sessions ./headers ./errors +# Get bugsnag dependencies +RUN go get ./... # Copy test scenarios COPY ./net_http /app/src/test WORKDIR /app/src/test + +# Ensure subsequent steps are re-run if the GO_VERSION variable changes +ARG GO_VERSION +# Create app module - avoid locking bugsnag dep by not checking it in +# Skip on old versions of Go which pre-date modules +RUN if [[ $GO_VERSION != '1.11' && $GO_VERSION != '1.12' ]]; then \ + go mod init && go mod tidy; \ + fi diff --git a/features/handled.feature b/features/handled.feature index e97d7489..2c9a5f46 100644 --- a/features/handled.feature +++ b/features/handled.feature @@ -13,7 +13,7 @@ Scenario: A handled error sends a report And the event "unhandled" is false And the event "severity" equals "warning" And the event "severityReason.type" equals "handledError" - And the exception "errorClass" equals "*os.PathError" + And the exception is a PathError for request 0 And the "file" of stack frame 0 equals "main.go" Scenario: A handled error sends a report with a custom name diff --git a/features/net-http/handled.feature b/features/net-http/handled.feature index 4c814b4a..2fd366aa 100644 --- a/features/net-http/handled.feature +++ b/features/net-http/handled.feature @@ -16,7 +16,7 @@ Scenario: A handled error sends a report And the event "unhandled" is false for request 0 And the event "severity" equals "warning" for request 0 And the event "severityReason.type" equals "handledError" for request 0 - And the exception "errorClass" equals "*os.PathError" for request 0 + And the exception is a PathError for request 0 And the "file" of stack frame 0 equals "main.go" for request 0 Scenario: A handled error sends a report with a custom name diff --git a/features/steps/go_steps.rb b/features/steps/go_steps.rb index ff17dc43..16a0e307 100644 --- a/features/steps/go_steps.rb +++ b/features/steps/go_steps.rb @@ -23,6 +23,16 @@ } end +Then(/^the exception is a PathError for request (\d+)$/) do |request_index| + body = find_request(request_index)[:body] + error_class = body["events"][0]["exceptions"][0]["errorClass"] + if ['1.11', '1.12', '1.13', '1.14', '1.15'].include? ENV['GO_VERSION'] + assert_equal(error_class, '*os.PathError') + else + assert_equal(error_class, '*fs.PathError') + end +end + Then(/^the request(?: (\d+))? is a valid session report with api key "(.*)"$/) do |request_index, api_key| request_index ||= 0 steps %Q{ diff --git a/features/support/env.rb b/features/support/env.rb index f0cbcff6..3e70280e 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -8,7 +8,7 @@ Dir.mkdir testBuildFolder # Copy the existing dir -`find . -name '*.go' \ +`find . -name '*.go' -o -name 'go.sum' -o -name 'go.mod' \ -not -path "./examples/*" \ -not -path "./testutil/*" \ -not -path "./v2/testutil/*" \ diff --git a/v2/bugsnag.go b/v2/bugsnag.go index 77cc6e82..2af21de5 100644 --- a/v2/bugsnag.go +++ b/v2/bugsnag.go @@ -21,7 +21,7 @@ import ( ) // Version defines the version of this Bugsnag notifier -const Version = "2.1.0" +const Version = "2.1.1" var panicHandlerOnce sync.Once var sessionTrackerOnce sync.Once diff --git a/v2/go.mod b/v2/go.mod index 1867c626..fc1d0b35 100644 --- a/v2/go.mod +++ b/v2/go.mod @@ -4,7 +4,10 @@ go 1.15 require ( github.com/bitly/go-simplejson v0.5.0 - github.com/bugsnag/panicwrap v1.3.1 + github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect + github.com/bugsnag/panicwrap v1.3.2 github.com/gofrs/uuid v4.0.0+incompatible + github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect + github.com/kr/pretty v0.2.1 // indirect github.com/pkg/errors v0.9.1 ) diff --git a/v2/go.sum b/v2/go.sum index 7e740bb4..b6d4b2cc 100644 --- a/v2/go.sum +++ b/v2/go.sum @@ -1,5 +1,17 @@ +github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y= github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= -github.com/bugsnag/panicwrap v1.3.1 h1:pmuhHlhbUV4OOrGDvoiMjHSZzwRcL+I9cIzYKiW4lII= -github.com/bugsnag/panicwrap v1.3.1/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= +github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= +github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= +github.com/bugsnag/panicwrap v1.3.2 h1:pNcbtPtH4Y6VwK+oZVNV/2H6Hh3jOL0ZNVFZEfd/eA4= +github.com/bugsnag/panicwrap v1.3.2/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= +github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 h1:iQTw/8FWTuc7uiaSepXwyf3o52HaUYcV+Tu66S3F5GA= +github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=