From 9dfda2aabe8094a306d32c2f1137ca9d07631151 Mon Sep 17 00:00:00 2001 From: nhatthm Date: Sat, 28 Jan 2023 15:50:31 +0100 Subject: [PATCH] Bump dependencies --- .github/workflows/lint.yaml | 6 ++--- .github/workflows/test.yaml | 2 +- .github/workflows/update-registry.yaml | 32 ++++++++++++++++++++++++++ .golangci.yaml | 5 +++- Makefile | 17 ++++++++++---- README.md | 2 +- go.mod | 6 ++--- go.sum | 4 ++++ helper.go | 2 +- 9 files changed, 62 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/update-registry.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 754486f..e029981 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -20,15 +20,15 @@ jobs: with: go-version: ${{ env.GO_VERSION }} - - id: get-lint-version + - id: vars run: | - make golangci-lint-version + make $GITHUB_OUTPUT - name: lint uses: golangci/golangci-lint-action@v3 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: ${{ steps.get-lint-version.outputs.GOLANGCI_LINT_VERSION }} + version: ${{ steps.vars.outputs.GOLANGCI_LINT_VERSION }} # Optional: working directory, useful for monorepos # working-directory: somedir diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 3c28640..f1c1b90 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -16,7 +16,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest, macos-latest ] - go-version: [ 1.17.x, 1.18.x, 1.19.x ] + go-version: [ 1.18.x, 1.19.x ] runs-on: ${{ matrix.os }} steps: - name: Install Go diff --git a/.github/workflows/update-registry.yaml b/.github/workflows/update-registry.yaml new file mode 100644 index 0000000..ac1515b --- /dev/null +++ b/.github/workflows/update-registry.yaml @@ -0,0 +1,32 @@ +--- +name: 'update-registry' + +on: + push: + branches: + - master + tags: + - v* + workflow_dispatch: + +jobs: + notify: + runs-on: ubuntu-latest + strategy: + matrix: + registry: [ go.nhat.io, go-staging.nhat.io ] + steps: + - uses: actions/checkout@v3 + + - id: vars + run: | + make $GITHUB_OUTPUT + + - name: notify ${{ matrix.registry }} + uses: benc-uk/workflow-dispatch@v121 + with: + workflow: build + repo: nhatthm/${{ matrix.registry }} + token: ${{ secrets.REGISTRY_TOKEN }} + inputs: '{"modules": "${{ steps.vars.outputs.MODULE_NAME }}"}' + ref: 'master' diff --git a/.golangci.yaml b/.golangci.yaml index 74dfb67..681da7b 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -20,6 +20,7 @@ linters-settings: linters: enable-all: true disable: + - deadcode - exhaustivestruct - exhaustruct - forbidigo @@ -33,13 +34,15 @@ linters: - ireturn - lll - maligned + - nolintlint # https://github.com/golangci/golangci-lint/issues/3063 - nonamedreturns - nosnakecase - - nolintlint # https://github.com/golangci/golangci-lint/issues/3063 - paralleltest - scopelint + - structcheck - tagliatelle - testpackage + - varcheck - varnamelen - wrapcheck diff --git a/Makefile b/Makefile index 2abcf0e..f0b3828 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,23 @@ +MODULE_NAME=httpmock + VENDOR_DIR = vendor -GOLANGCI_LINT_VERSION ?= v1.48.0 +GOLANGCI_LINT_VERSION ?= v1.50.1 GO ?= go GOLANGCI_LINT ?= $(shell go env GOPATH)/bin/golangci-lint-$(GOLANGCI_LINT_VERSION) +GITHUB_OUTPUT ?= /dev/null + .PHONY: $(VENDOR_DIR) $(VENDOR_DIR): @mkdir -p $(VENDOR_DIR) @$(GO) mod vendor +.PHONY: tidy +tidy: + @$(GO) mod tidy + .PHONY: lint lint: $(GOLANGCI_LINT) $(VENDOR_DIR) @$(GOLANGCI_LINT) run -c .golangci.yaml @@ -23,9 +31,10 @@ test-unit: @echo ">> unit test" @$(GO) test -gcflags=-l -coverprofile=unit.coverprofile -covermode=atomic -race ./... -.PHONY: golangci-lint-version -golangci-lint-version: - @echo "::set-output name=GOLANGCI_LINT_VERSION::$(GOLANGCI_LINT_VERSION)" +.PHONY: $(GITHUB_OUTPUT) +$(GITHUB_OUTPUT): + @echo "MODULE_NAME=$(MODULE_NAME)" >> "$@" + @echo "GOLANGCI_LINT_VERSION=$(GOLANGCI_LINT_VERSION)" >> "$@" $(GOLANGCI_LINT): @echo "$(OK_COLOR)==> Installing golangci-lint $(GOLANGCI_LINT_VERSION)$(NO_COLOR)"; \ diff --git a/README.md b/README.md index 17353b1..3e47cb0 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ support HTTP behavioral tests. ## Prerequisites -- `Go >= 1.17` +- `Go >= 1.18` [[table of contents]](#table-of-contents) diff --git a/go.mod b/go.mod index d0071f4..2781ebc 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module go.nhat.io/httpmock -go 1.17 +go 1.18 require ( github.com/stretchr/testify v1.8.1 @@ -8,12 +8,12 @@ require ( ) require ( - github.com/bool64/shared v0.1.4 // indirect + github.com/bool64/shared v0.1.5 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/fsnotify/fsnotify v1.5.4 // indirect github.com/iancoleman/orderedmap v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/sergi/go-diff v1.2.0 // indirect + github.com/sergi/go-diff v1.3.1 // indirect github.com/stretchr/objx v0.5.0 // indirect github.com/swaggest/assertjson v1.7.0 // indirect github.com/yudai/gojsondiff v1.0.0 // indirect diff --git a/go.sum b/go.sum index 169e366..8175a89 100644 --- a/go.sum +++ b/go.sum @@ -3,6 +3,8 @@ github.com/bool64/dev v0.2.10 h1:ypAGBazcwyIy2JvIJio8V3kdqO7AgIAYvcckW54qxr4= github.com/bool64/dev v0.2.10/go.mod h1:/csLrm+4oDSsKJRIVS0mrywAonLnYKFG8RvGT7Jh9b8= github.com/bool64/shared v0.1.4 h1:zwtb1dl2QzDa9TJOq2jzDTdb5IPf9XlxTGKN8cySWT0= github.com/bool64/shared v0.1.4/go.mod h1:ryGjsnQFh6BnEXClfVlEJrzjwzat7CmA8PNS5E+jPp0= +github.com/bool64/shared v0.1.5 h1:fp3eUhBsrSjNCQPcSdQqZxxh9bBwrYiZ+zOKFkM0/2E= +github.com/bool64/shared v0.1.5/go.mod h1:081yz68YC9jeFB3+Bbmno2RFWvGKv1lPKkMP6MHJlPs= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= 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= @@ -53,6 +55,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= +github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= diff --git a/helper.go b/helper.go index 895da93..3891d5b 100644 --- a/helper.go +++ b/helper.go @@ -28,7 +28,7 @@ func DoRequest( // DoRequestWithTimeout sends a simple HTTP Request for testing and returns the status code, response headers and // response body along with the total execution time. // -// code, headers, body, _ = DoRequestWithTimeout(t, http.MethodGet, "/", nil, nil, 0) +// code, headers, body, _ = DoRequestWithTimeout(t, http.MethodGet, "/", map[string]string{}, nil, 0) func DoRequestWithTimeout( tb testing.TB, method, requestURI string,