From 3795dcaa9fd48354d714916ffa63e04c53efa9a6 Mon Sep 17 00:00:00 2001 From: Viacheslav Poturaev Date: Tue, 14 Jun 2022 23:19:55 +0200 Subject: [PATCH 01/10] Try coverage tool --- .github/workflows/cloc.yml | 2 +- .github/workflows/golangci-lint.yml | 2 +- .github/workflows/gorelease.yml | 6 ++--- .github/workflows/test-unit.yml | 42 ++++++++++++++++++++--------- .golangci.yml | 2 ++ Makefile | 2 +- go.mod | 2 +- go.sum | 3 ++- 8 files changed, 41 insertions(+), 20 deletions(-) diff --git a/.github/workflows/cloc.yml b/.github/workflows/cloc.yml index d6ff20d..4592bb4 100644 --- a/.github/workflows/cloc.yml +++ b/.github/workflows/cloc.yml @@ -24,7 +24,7 @@ jobs: - name: Count Lines Of Code id: loc run: | - curl -sLO https://github.com/vearutop/sccdiff/releases/download/v1.0.1/linux_amd64.tar.gz && tar xf linux_amd64.tar.gz + curl -sLO https://github.com/vearutop/sccdiff/releases/download/v1.0.2/linux_amd64.tar.gz && tar xf linux_amd64.tar.gz && echo "b17e76bede22af0206b4918d3b3c4e7357f2a21b57f8de9e7c9dc0eb56b676c0 sccdiff" | shasum -c OUTPUT=$(cd pr && ../sccdiff -basedir ../base) echo "${OUTPUT}" OUTPUT="${OUTPUT//$'\n'/%0A}" diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index b4f7600..48207f9 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -27,7 +27,7 @@ jobs: uses: golangci/golangci-lint-action@v3.1.0 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: v1.45.2 + version: v1.46.2 # Optional: working directory, useful for monorepos # working-directory: somedir diff --git a/.github/workflows/gorelease.yml b/.github/workflows/gorelease.yml index 429d5ed..0a5a701 100644 --- a/.github/workflows/gorelease.yml +++ b/.github/workflows/gorelease.yml @@ -35,12 +35,12 @@ jobs: with: path: | ~/go/bin/gorelease - key: ${{ runner.os }}-gorelease + key: ${{ runner.os }}-gorelease-fork - name: Gorelease id: gorelease run: | - test -e ~/go/bin/gorelease || go install golang.org/x/exp/cmd/gorelease@latest - OUTPUT=$(gorelease || exit 0) + test -e ~/go/bin/gorelease || (rm -rf /tmp/gorelease && mkdir -p /tmp/gorelease && cd /tmp/gorelease && go mod init foo && go mod edit -replace golang.org/x/exp=github.com/vearutop/golang-exp@gorelease-generic && go get golang.org/x/exp/cmd/gorelease && go install golang.org/x/exp/cmd/gorelease) + OUTPUT=$(gorelease 2>&1 || exit 0) echo "${OUTPUT}" OUTPUT="${OUTPUT//$'\n'/%0A}" echo "::set-output name=report::$OUTPUT" diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index a1d30c9..26e68b0 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -16,11 +16,12 @@ env: GO111MODULE: "on" RUN_BASE_COVERAGE: "on" # Runs test for PR base in case base test coverage is missing. COV_GO_VERSION: 1.18.x # Version of Go to collect coverage + TARGET_DELTA_COV: 90 # Target coverage of changed lines, in percents jobs: test: strategy: matrix: - go-version: [ 1.16.x, 1.17.x, 1.18.x, tip ] + go-version: [ 1.16.x, 1.17.x, 1.18.x ] runs-on: ubuntu-latest steps: - name: Install Go stable @@ -76,19 +77,25 @@ jobs: run: | make test-unit go tool cover -func=./unit.coverprofile | sed -e 's/.go:[0-9]*:\t/.go\t/g' | sed -e 's/\t\t*/\t/g' > unit.txt - OUTPUT=$(test -e unit-base.txt && (diff unit-base.txt unit.txt || exit 0) || cat unit.txt) - echo "${OUTPUT}" - OUTPUT="${OUTPUT//$'\n'/%0A}" - TOTAL=$(grep 'total:' unit.txt) - echo "${TOTAL}" - echo "::set-output name=diff::$OUTPUT" + - name: Annotate missing test coverage + id: annotate + if: matrix.go-version == env.COV_GO_VERSION && github.event.pull_request.base.sha != '' + run: | + git fetch origin master ${{ github.event.pull_request.base.sha }} + curl -sLO https://github.com/vearutop/gocovdiff/releases/download/v1.3.0/linux_amd64.tar.gz && tar xf linux_amd64.tar.gz && echo "c5fa13a6bce4e2c1960941f13e32429d8e05c909d4a08e41c46b83b72b162374 gocovdiff" | shasum -c + REP=$(./gocovdiff -cov unit.coverprofile -gha-annotations gha-unit.txt -delta-cov-file delta-cov-unit.txt -target-delta-cov ${TARGET_DELTA_COV}) + echo "${REP}" + REP="${REP//$'\n'/%0A}" + cat gha-unit.txt + DIFF=$(test -e unit-base.txt && (gocovdiff -func-cov unit.txt -func-base-cov unit-base.txt) || echo "Missing base coverage file") + TOTAL=$(cat delta-cov-unit.txt) + echo "::set-output name=rep::$REP" + echo "::set-output name=diff::$DIFF" echo "::set-output name=total::$TOTAL" - - name: Store base coverage - if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }} - run: cp unit.txt unit-base.txt + - name: Comment Test Coverage continue-on-error: true - if: matrix.go-version == env.COV_GO_VERSION + if: matrix.go-version == env.COV_GO_VERSION && github.event.pull_request.base.sha != '' uses: marocchino/sticky-pull-request-comment@v2 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -96,13 +103,24 @@ jobs: message: | ### Unit Test Coverage ${{ steps.test.outputs.total }} + ${{ steps.annotate.outputs.total }} +
Coverage of changed lines + + ${{ steps.annotate.outputs.rep }} + +
+
Coverage diff with base branch ```diff - ${{ steps.test.outputs.diff }} + ${{ steps.annotate.outputs.diff }} ```
+ - name: Store base coverage + if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }} + run: cp unit.txt unit-base.txt + - name: Upload code coverage if: matrix.go-version == env.COV_GO_VERSION uses: codecov/codecov-action@v1 diff --git a/.golangci.yml b/.golangci.yml index 97710e1..9fa56cf 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -37,6 +37,8 @@ linters: - tagliatelle - errname - ireturn + - exhaustruct + - nonamedreturns issues: exclude-use-default: false diff --git a/Makefile b/Makefile index 77a5ec3..c181688 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -#GOLANGCI_LINT_VERSION := "v1.45.2" # Optional configuration to pinpoint golangci-lint version. +#GOLANGCI_LINT_VERSION := "v1.46.2" # Optional configuration to pinpoint golangci-lint version. # The head of Makefile determines location of dev-go to include standard targets. GO ?= go diff --git a/go.mod b/go.mod index 1d8e1a7..10af7cd 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/bool64/ctxd go 1.17 require ( - github.com/bool64/dev v0.2.5 + github.com/bool64/dev v0.2.14-0.20220614211400-7423b05b32f6 github.com/stretchr/testify v1.7.1 github.com/swaggest/usecase v1.1.2 ) diff --git a/go.sum b/go.sum index 7a4a08c..aa05928 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,6 @@ -github.com/bool64/dev v0.2.5 h1:H0bylghwcjDBBhEwSFTjArEO9Dr8cCaB54QSOF7esOA= github.com/bool64/dev v0.2.5/go.mod h1:cTHiTDNc8EewrQPy3p1obNilpMpdmlUesDkFTF2zRWU= +github.com/bool64/dev v0.2.14-0.20220614211400-7423b05b32f6 h1:s+A3Sk/7GZaRuPo7/Jp5ZygbQyhte5nGikBntkfjMsk= +github.com/bool64/dev v0.2.14-0.20220614211400-7423b05b32f6/go.mod h1:/csLrm+4oDSsKJRIVS0mrywAonLnYKFG8RvGT7Jh9b8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= From d46a962da150f066d8a9d0bf662a19d9c3751fa6 Mon Sep 17 00:00:00 2001 From: Viacheslav Poturaev Date: Tue, 14 Jun 2022 23:45:39 +0200 Subject: [PATCH 02/10] Try coverage tool --- .github/workflows/test-unit.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index 26e68b0..75dedf3 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -82,12 +82,12 @@ jobs: if: matrix.go-version == env.COV_GO_VERSION && github.event.pull_request.base.sha != '' run: | git fetch origin master ${{ github.event.pull_request.base.sha }} - curl -sLO https://github.com/vearutop/gocovdiff/releases/download/v1.3.0/linux_amd64.tar.gz && tar xf linux_amd64.tar.gz && echo "c5fa13a6bce4e2c1960941f13e32429d8e05c909d4a08e41c46b83b72b162374 gocovdiff" | shasum -c + curl -sLO https://github.com/vearutop/gocovdiff/releases/download/v1.3.1/linux_amd64.tar.gz && tar xf linux_amd64.tar.gz && echo "61dd2fc6b517df8110e3975c97569582c48d710af816fee423eb52c7f31b301b gocovdiff" | shasum -c REP=$(./gocovdiff -cov unit.coverprofile -gha-annotations gha-unit.txt -delta-cov-file delta-cov-unit.txt -target-delta-cov ${TARGET_DELTA_COV}) echo "${REP}" REP="${REP//$'\n'/%0A}" cat gha-unit.txt - DIFF=$(test -e unit-base.txt && (gocovdiff -func-cov unit.txt -func-base-cov unit-base.txt) || echo "Missing base coverage file") + DIFF=$(test -e unit-base.txt && (./gocovdiff -func-cov unit.txt -func-base-cov unit-base.txt) || echo "Missing base coverage file") TOTAL=$(cat delta-cov-unit.txt) echo "::set-output name=rep::$REP" echo "::set-output name=diff::$DIFF" @@ -112,9 +112,8 @@ jobs:
Coverage diff with base branch - ```diff ${{ steps.annotate.outputs.diff }} - ``` +
- name: Store base coverage From f3ed9b5a7b250cae14f5eb93f6958106fc501c84 Mon Sep 17 00:00:00 2001 From: Viacheslav Poturaev Date: Tue, 14 Jun 2022 23:49:50 +0200 Subject: [PATCH 03/10] Try coverage tool --- .github/workflows/test-unit.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index 75dedf3..ea57fe0 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -29,6 +29,7 @@ jobs: uses: actions/setup-go@v3 with: go-version: ${{ matrix.go-version }} + - name: Install Go tip if: matrix.go-version == 'tip' run: | @@ -38,8 +39,10 @@ jobs: tar -C ~/sdk/gotip -xzf gotip.tar.gz ~/sdk/gotip/bin/go version echo "PATH=$HOME/go/bin:$HOME/sdk/gotip/bin/:$PATH" >> $GITHUB_ENV + - name: Checkout code uses: actions/checkout@v2 + - name: Go cache uses: actions/cache@v2 with: @@ -52,6 +55,7 @@ jobs: key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go-cache + - name: Restore base test coverage id: base-coverage if: matrix.go-version == env.COV_GO_VERSION @@ -61,22 +65,26 @@ jobs: unit-base.txt # Use base sha for PR or new commit hash for master/main push in test result key. key: ${{ runner.os }}-unit-test-coverage-${{ (github.event.pull_request.base.sha != github.event.after) && github.event.pull_request.base.sha || github.event.after }} + - name: Checkout base code if: matrix.go-version == env.COV_GO_VERSION && env.RUN_BASE_COVERAGE == 'on' && steps.base-coverage.outputs.cache-hit != 'true' && github.event.pull_request.base.sha != '' uses: actions/checkout@v2 with: ref: ${{ github.event.pull_request.base.sha }} path: __base + - name: Run test for base code if: matrix.go-version == env.COV_GO_VERSION && env.RUN_BASE_COVERAGE == 'on' && steps.base-coverage.outputs.cache-hit != 'true' && github.event.pull_request.base.sha != '' run: | cd __base make | grep test-unit && (make test-unit && go tool cover -func=./unit.coverprofile | sed -e 's/.go:[0-9]*:\t/.go\t/g' | sed -e 's/\t\t*/\t/g' > ../unit-base.txt) || echo "No test-unit in base" + - name: Test id: test run: | make test-unit go tool cover -func=./unit.coverprofile | sed -e 's/.go:[0-9]*:\t/.go\t/g' | sed -e 's/\t\t*/\t/g' > unit.txt + - name: Annotate missing test coverage id: annotate if: matrix.go-version == env.COV_GO_VERSION && github.event.pull_request.base.sha != '' @@ -87,6 +95,7 @@ jobs: echo "${REP}" REP="${REP//$'\n'/%0A}" cat gha-unit.txt + test -e unit-base.txt && cat unit-base.txt DIFF=$(test -e unit-base.txt && (./gocovdiff -func-cov unit.txt -func-base-cov unit-base.txt) || echo "Missing base coverage file") TOTAL=$(cat delta-cov-unit.txt) echo "::set-output name=rep::$REP" From 9e373d9621a5f7944e4fdee6037a95893d377aa9 Mon Sep 17 00:00:00 2001 From: Viacheslav Poturaev Date: Tue, 14 Jun 2022 23:54:37 +0200 Subject: [PATCH 04/10] Try coverage tool --- .github/workflows/test-unit.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index ea57fe0..7957d63 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -64,7 +64,7 @@ jobs: path: | unit-base.txt # Use base sha for PR or new commit hash for master/main push in test result key. - key: ${{ runner.os }}-unit-test-coverage-${{ (github.event.pull_request.base.sha != github.event.after) && github.event.pull_request.base.sha || github.event.after }} + key: ${{ runner.os }}-unit-test-base-coverage-${{ (github.event.pull_request.base.sha != github.event.after) && github.event.pull_request.base.sha || github.event.after }} - name: Checkout base code if: matrix.go-version == env.COV_GO_VERSION && env.RUN_BASE_COVERAGE == 'on' && steps.base-coverage.outputs.cache-hit != 'true' && github.event.pull_request.base.sha != '' @@ -77,13 +77,13 @@ jobs: if: matrix.go-version == env.COV_GO_VERSION && env.RUN_BASE_COVERAGE == 'on' && steps.base-coverage.outputs.cache-hit != 'true' && github.event.pull_request.base.sha != '' run: | cd __base - make | grep test-unit && (make test-unit && go tool cover -func=./unit.coverprofile | sed -e 's/.go:[0-9]*:\t/.go\t/g' | sed -e 's/\t\t*/\t/g' > ../unit-base.txt) || echo "No test-unit in base" + make | grep test-unit && (make test-unit && go tool cover -func=./unit.coverprofile > ../unit-base.txt) || echo "No test-unit in base" - name: Test id: test run: | make test-unit - go tool cover -func=./unit.coverprofile | sed -e 's/.go:[0-9]*:\t/.go\t/g' | sed -e 's/\t\t*/\t/g' > unit.txt + go tool cover -func=./unit.coverprofile > unit.txt - name: Annotate missing test coverage id: annotate From 02dfb48b56e28d2b3bda658e11c1b54a940f1664 Mon Sep 17 00:00:00 2001 From: Viacheslav Poturaev Date: Wed, 15 Jun 2022 00:33:21 +0200 Subject: [PATCH 05/10] Try coverage tool --- .github/workflows/test-unit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index 7957d63..968be56 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -90,13 +90,13 @@ jobs: if: matrix.go-version == env.COV_GO_VERSION && github.event.pull_request.base.sha != '' run: | git fetch origin master ${{ github.event.pull_request.base.sha }} - curl -sLO https://github.com/vearutop/gocovdiff/releases/download/v1.3.1/linux_amd64.tar.gz && tar xf linux_amd64.tar.gz && echo "61dd2fc6b517df8110e3975c97569582c48d710af816fee423eb52c7f31b301b gocovdiff" | shasum -c + curl -sLO https://github.com/vearutop/gocovdiff/releases/download/v1.3.2/linux_amd64.tar.gz && tar xf linux_amd64.tar.gz && echo "78146b31ec37ac8037a25d33b0f3c70c85adb0f8b682441b04b3daa518eaa489 gocovdiff" | shasum -c REP=$(./gocovdiff -cov unit.coverprofile -gha-annotations gha-unit.txt -delta-cov-file delta-cov-unit.txt -target-delta-cov ${TARGET_DELTA_COV}) echo "${REP}" REP="${REP//$'\n'/%0A}" cat gha-unit.txt test -e unit-base.txt && cat unit-base.txt - DIFF=$(test -e unit-base.txt && (./gocovdiff -func-cov unit.txt -func-base-cov unit-base.txt) || echo "Missing base coverage file") + DIFF=$(test -e unit-base.txt && ./gocovdiff -func-cov unit.txt -func-base-cov unit-base.txt || echo "Missing base coverage file") TOTAL=$(cat delta-cov-unit.txt) echo "::set-output name=rep::$REP" echo "::set-output name=diff::$DIFF" From df7abdcc1f7a62c7b2b9f95f7e74981b622996d8 Mon Sep 17 00:00:00 2001 From: Viacheslav Poturaev Date: Wed, 15 Jun 2022 00:40:04 +0200 Subject: [PATCH 06/10] Add some code changes --- field.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/field.go b/field.go index dd7355c..d3e36fa 100644 --- a/field.go +++ b/field.go @@ -13,10 +13,18 @@ type DeferredString func() interface{} // String implements fmt.Stringer. func (d DeferredString) String() string { + if d == nil { + panic("ctxd: DeferredString is nil") + } + return fmt.Sprintf("%+v", d()) } // MarshalJSON implements json.Marshaler. func (d DeferredJSON) MarshalJSON() ([]byte, error) { + if d == nil { + panic("ctxd: DeferredJSON is nil") + } + return json.Marshal(d()) } From da34c9676d467c84883a854b0b438b9e83046326 Mon Sep 17 00:00:00 2001 From: Viacheslav Poturaev Date: Wed, 15 Jun 2022 00:45:19 +0200 Subject: [PATCH 07/10] Fix formatting --- .github/workflows/test-unit.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index 968be56..35e9a56 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -97,6 +97,7 @@ jobs: cat gha-unit.txt test -e unit-base.txt && cat unit-base.txt DIFF=$(test -e unit-base.txt && ./gocovdiff -func-cov unit.txt -func-base-cov unit-base.txt || echo "Missing base coverage file") + DIFF="${DIFF//$'\n'/%0A}" TOTAL=$(cat delta-cov-unit.txt) echo "::set-output name=rep::$REP" echo "::set-output name=diff::$DIFF" From 45db44ec2f6a3a2ab0d95b9d2f5ab266c96cbacf Mon Sep 17 00:00:00 2001 From: Viacheslav Poturaev Date: Wed, 15 Jun 2022 00:50:14 +0200 Subject: [PATCH 08/10] Fix total --- .github/workflows/test-unit.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index 35e9a56..ec1ce35 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -84,6 +84,9 @@ jobs: run: | make test-unit go tool cover -func=./unit.coverprofile > unit.txt + TOTAL=$(grep 'total:' unit.txt) + echo "${TOTAL}" + echo "::set-output name=total::$TOTAL" - name: Annotate missing test coverage id: annotate From 7d4290762ad9aa69d27f25f4f55e77d2f1be1d9b Mon Sep 17 00:00:00 2001 From: Viacheslav Poturaev Date: Wed, 15 Jun 2022 00:54:13 +0200 Subject: [PATCH 09/10] Add more tests --- field_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/field_test.go b/field_test.go index 6008f28..0509d63 100644 --- a/field_test.go +++ b/field_test.go @@ -9,10 +9,17 @@ import ( func TestDeferredString_String(t *testing.T) { assert.Equal(t, "[1 2 3]", ctxd.DeferredString(func() interface{} { return []int{1, 2, 3} }).String()) + + assert.Panics(t, func() { _ = ctxd.DeferredString(nil).String() }) } func TestDeferredJSON_MarshalJSON(t *testing.T) { v, err := ctxd.DeferredJSON(func() interface{} { return []int{1, 2, 3} }).MarshalJSON() assert.NoError(t, err) assert.Equal(t, "[1,2,3]", string(v)) + + assert.Panics(t, func() { + _, err := ctxd.DeferredJSON(nil).MarshalJSON() + assert.NoError(t, err) // Unreachable. + }) } From cb2828b3b2f182d6f7599dcb53f2110683c0e48f Mon Sep 17 00:00:00 2001 From: Viacheslav Poturaev Date: Wed, 15 Jun 2022 11:02:26 +0200 Subject: [PATCH 10/10] Remove test condition to expose reporting behavior --- .github/workflows/test-unit.yml | 4 ++-- field_test.go | 2 -- go.mod | 2 +- go.sum | 4 ++-- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index ec1ce35..2494dc4 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -93,7 +93,7 @@ jobs: if: matrix.go-version == env.COV_GO_VERSION && github.event.pull_request.base.sha != '' run: | git fetch origin master ${{ github.event.pull_request.base.sha }} - curl -sLO https://github.com/vearutop/gocovdiff/releases/download/v1.3.2/linux_amd64.tar.gz && tar xf linux_amd64.tar.gz && echo "78146b31ec37ac8037a25d33b0f3c70c85adb0f8b682441b04b3daa518eaa489 gocovdiff" | shasum -c + curl -sLO https://github.com/vearutop/gocovdiff/releases/download/v1.3.3/linux_amd64.tar.gz && tar xf linux_amd64.tar.gz && echo "5408045c76208635f1aedf895f79e9e809dc3c42c961e3b20db8119174cffcf5 gocovdiff" | shasum -c REP=$(./gocovdiff -cov unit.coverprofile -gha-annotations gha-unit.txt -delta-cov-file delta-cov-unit.txt -target-delta-cov ${TARGET_DELTA_COV}) echo "${REP}" REP="${REP//$'\n'/%0A}" @@ -126,7 +126,7 @@ jobs:
Coverage diff with base branch ${{ steps.annotate.outputs.diff }} - +
- name: Store base coverage diff --git a/field_test.go b/field_test.go index 0509d63..faa082b 100644 --- a/field_test.go +++ b/field_test.go @@ -9,8 +9,6 @@ import ( func TestDeferredString_String(t *testing.T) { assert.Equal(t, "[1 2 3]", ctxd.DeferredString(func() interface{} { return []int{1, 2, 3} }).String()) - - assert.Panics(t, func() { _ = ctxd.DeferredString(nil).String() }) } func TestDeferredJSON_MarshalJSON(t *testing.T) { diff --git a/go.mod b/go.mod index 10af7cd..45fdbe3 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/bool64/ctxd go 1.17 require ( - github.com/bool64/dev v0.2.14-0.20220614211400-7423b05b32f6 + github.com/bool64/dev v0.2.15 github.com/stretchr/testify v1.7.1 github.com/swaggest/usecase v1.1.2 ) diff --git a/go.sum b/go.sum index aa05928..4b72749 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/bool64/dev v0.2.5/go.mod h1:cTHiTDNc8EewrQPy3p1obNilpMpdmlUesDkFTF2zRWU= -github.com/bool64/dev v0.2.14-0.20220614211400-7423b05b32f6 h1:s+A3Sk/7GZaRuPo7/Jp5ZygbQyhte5nGikBntkfjMsk= -github.com/bool64/dev v0.2.14-0.20220614211400-7423b05b32f6/go.mod h1:/csLrm+4oDSsKJRIVS0mrywAonLnYKFG8RvGT7Jh9b8= +github.com/bool64/dev v0.2.15 h1:6fC2Z4hxl1CMRbGdwkK0WciHQOqtlIm1UJ/Hyx/Ly8w= +github.com/bool64/dev v0.2.15/go.mod h1:/csLrm+4oDSsKJRIVS0mrywAonLnYKFG8RvGT7Jh9b8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=