From fa775c1fc7cd89d6ea28a250f6cd8a437e0c4c08 Mon Sep 17 00:00:00 2001 From: nhatthm Date: Thu, 18 Aug 2022 22:58:08 +0200 Subject: [PATCH] Bump dependencies --- .gherkin-lintrc | 78 +++++++++++++++++++ .../{golangci-lint.yaml => lint.yaml} | 22 ++++-- .github/workflows/test.yaml | 10 +-- .gitignore | 1 + .golangci.yaml | 4 + Makefile | 14 +++- README.md | 4 +- clock.go | 2 +- features/bootstrap/godog_test.go | 7 +- go.mod | 6 +- go.sum | 13 ++-- 11 files changed, 132 insertions(+), 29 deletions(-) create mode 100644 .gherkin-lintrc rename .github/workflows/{golangci-lint.yaml => lint.yaml} (72%) diff --git a/.gherkin-lintrc b/.gherkin-lintrc new file mode 100644 index 0000000..9ef4928 --- /dev/null +++ b/.gherkin-lintrc @@ -0,0 +1,78 @@ +{ + "file-name": [ + "on", + { + "style": "PascalCase" + } + ], + "no-files-without-scenarios": "on", + "no-unnamed-features": "on", + "no-unnamed-scenarios": "on", + "no-dupe-scenario-names": [ + "on", + "in-feature" + ], + "no-dupe-feature-names": "on", + "no-partially-commented-tag-lines": "on", + "indentation": [ + "on", + { + "Feature": 0, + "Background": 4, + "Scenario": 4, + "Step": 8, + "Examples": 8, + "example": 12, + "given": 8, + "when": 8, + "then": 8, + "and": 8, + "but": 8, + "feature tag": 0, + "scenario tag": 4 + } + ], + "no-trailing-spaces": "on", + "new-line-at-eof": [ + "on", + "yes" + ], + "no-multiple-empty-lines": "on", + "no-empty-file": "on", + "no-scenario-outlines-without-examples": "on", + "name-length": [ + "on", + { + "Feature": 150, + "Scenario": 150, + "Step": 150 + } + ], + "no-restricted-tags": [ + "on", + { + "tags": [ + "@dev", + "@watch", + "@wip" + ] + } + ], + "use-and": "on", + "no-duplicate-tags": "on", + "no-superfluous-tags": "on", + "no-homogenous-tags": "on", + "one-space-between-tags": "on", + "no-unused-variables": "on", + "no-background-only-scenario": "on", + "no-empty-background": "on", + "scenario-size": [ + "on", + { + "steps-length": { + "Background": 15, + "Scenario": 15 + } + } + ] +} diff --git a/.github/workflows/golangci-lint.yaml b/.github/workflows/lint.yaml similarity index 72% rename from .github/workflows/golangci-lint.yaml rename to .github/workflows/lint.yaml index 254eeb9..c7320d9 100644 --- a/.github/workflows/golangci-lint.yaml +++ b/.github/workflows/lint.yaml @@ -8,16 +8,22 @@ on: - main pull_request: jobs: - golangci: - name: golangci-lint + lint: + name: lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: 1.19.x + - name: golangci-lint - uses: golangci/golangci-lint-action@v2.5.2 + 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: v1.42.0 + version: v1.48.0 # Optional: working directory, useful for monorepos # working-directory: somedir @@ -36,3 +42,9 @@ jobs: # Optional: if set to true then the action don't cache or restore ~/.cache/go-build. # skip-build-cache: true + + - name: gherkin-lint + uses: nhatthm/gherkin-lint-action@v1.0.0 + with: + feature_files: features/* + config_file: .gherkin-lintrc diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 777e986..3fe21fd 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -8,7 +8,7 @@ on: env: GO111MODULE: "on" - GO_LATEST_VERSION: "1.17.x" + GO_LATEST_VERSION: "1.19.x" jobs: test: @@ -16,19 +16,19 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest, macos-latest ] - go-version: [ 1.16.x, 1.17.x ] + go-version: [ 1.17.x, 1.18.x, 1.19.x ] runs-on: ${{ matrix.os }} steps: - name: Install Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: ${{ matrix.go-version }} - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Go cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: # In order: # * Module download cache diff --git a/.gitignore b/.gitignore index 04bd755..cb00a7e 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ # Output of the go coverage tool, specifically when used with LiteIDE *.out +bin # Dependency directories (remove the comment below to include it) /vendor diff --git a/.golangci.yaml b/.golangci.yaml index 79af0b0..00aed24 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -21,6 +21,7 @@ linters: enable-all: true disable: - exhaustivestruct + - exhaustruct - forbidigo - forcetypeassert - gci @@ -29,11 +30,14 @@ linters: - gomnd - ifshort - interfacer + - ireturn - lll - maligned + - nolintlint # https://github.com/golangci/golangci-lint/issues/3063 - paralleltest - scopelint - testpackage + - varnamelen - wrapcheck issues: diff --git a/Makefile b/Makefile index 6a03871..ce329d9 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,9 @@ VENDOR_DIR = vendor +GOLANGCI_LINT_VERSION ?= v1.48.0 + GO ?= go -GOLANGCI_LINT ?= golangci-lint +GOLANGCI_LINT ?= golangci-lint-$(GOLANGCI_LINT_VERSION) .PHONY: $(VENDOR_DIR) lint test test-unit @@ -10,8 +12,9 @@ $(VENDOR_DIR): @$(GO) mod vendor @$(GO) mod tidy -lint: - @$(GOLANGCI_LINT) run +.PHONY: lint +lint: bin/$(GOLANGCI_LINT) $(VENDOR_DIR) + @bin/$(GOLANGCI_LINT) run -c .golangci.yaml test: test-unit test-integration @@ -23,3 +26,8 @@ test-unit: test-integration: @echo ">> integration test" @$(GO) test ./features/... -gcflags=-l -coverprofile=features.coverprofile -coverpkg ./... -godog -race + +bin/$(GOLANGCI_LINT): + @echo "$(OK_COLOR)==> Installing golangci-lint $(GOLANGCI_LINT_VERSION)$(NO_COLOR)"; \ + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./bin "$(GOLANGCI_LINT_VERSION)" + @mv ./bin/golangci-lint bin/$(GOLANGCI_LINT) diff --git a/README.md b/README.md index 2e936a6..19c15ca 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Go Report Card](https://goreportcard.com/badge/github.com/nhatthm/httpmock)](https://goreportcard.com/report/github.com/nhatthm/httpmock) [![GoDevDoc](https://img.shields.io/badge/dev-doc-00ADD8?logo=go)](https://pkg.go.dev/github.com/godogx/clocksteps) -`clocksteps` uses [`nhatthm/go-clock`](https://github.com/nhatthm/go-clock) to provide steps for `cucumber/godog` and +`clocksteps` uses [`nhatthm/go-clock`](https://go.nhat.io/clock) to provide steps for `cucumber/godog` and makes it easy to run tests with `time`. ## Prerequisites @@ -47,7 +47,7 @@ func TestIntegration(t *testing.T) { } ``` -Read more about [`nhatthm/go-clock`](https://github.com/nhatthm/go-clock) +Read more about [`nhatthm/go-clock`](https://go.nhat.io/clock) ## Steps diff --git a/clock.go b/clock.go index 02ad8f5..01718d5 100644 --- a/clock.go +++ b/clock.go @@ -5,7 +5,7 @@ import ( "sync" "time" - clock "github.com/nhatthm/go-clock" + "go.nhat.io/clock" ) // ErrClockIsNotSet indicates that the clock must be set by either Clock.Set() or Clock.Freeze() before adding some diff --git a/features/bootstrap/godog_test.go b/features/bootstrap/godog_test.go index 9e48875..f1180dd 100644 --- a/features/bootstrap/godog_test.go +++ b/features/bootstrap/godog_test.go @@ -4,17 +4,18 @@ import ( "bytes" "flag" "fmt" - "io/ioutil" "math/rand" + "os" "path/filepath" "strings" "testing" "time" "github.com/cucumber/godog" - "github.com/godogx/clocksteps" "github.com/nhatthm/timeparser" "github.com/stretchr/testify/assert" + + "github.com/godogx/clocksteps" ) // Used by init(). @@ -62,7 +63,7 @@ func RunSuite(t *testing.T, path string, featureContext func(t *testing.T, ctx * var paths []string - files, err := ioutil.ReadDir(filepath.Clean(path)) + files, err := os.ReadDir(filepath.Clean(path)) assert.NoError(t, err) paths = make([]string, 0, len(files)) diff --git a/go.mod b/go.mod index 51ebf51..88b30b6 100644 --- a/go.mod +++ b/go.mod @@ -4,18 +4,18 @@ go 1.17 require ( github.com/cucumber/godog v0.12.5 - github.com/nhatthm/go-clock v0.6.0 github.com/nhatthm/timeparser v0.2.0 github.com/stretchr/testify v1.8.0 + go.nhat.io/clock v0.7.0 ) require ( github.com/cucumber/gherkin-go/v19 v19.0.3 // indirect github.com/cucumber/messages-go/v16 v16.0.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/gofrs/uuid v4.0.0+incompatible // indirect + github.com/gofrs/uuid v4.2.0+incompatible // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect - github.com/hashicorp/go-memdb v1.3.2 // indirect + github.com/hashicorp/go-memdb v1.3.3 // indirect github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/spf13/pflag v1.0.5 // indirect diff --git a/go.sum b/go.sum index 26ed052..305c520 100644 --- a/go.sum +++ b/go.sum @@ -51,8 +51,9 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -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/gofrs/uuid v4.2.0+incompatible h1:yyYWMnhkhrKwwr8gAOcOCYxOOscHgDS9yZgBrnJfGa0= +github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -88,8 +89,8 @@ github.com/hashicorp/go-immutable-radix v1.3.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjh github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-memdb v1.3.0/go.mod h1:Mluclgwib3R93Hk5fxEfiRhB+6Dar64wWh71LpNSe3g= -github.com/hashicorp/go-memdb v1.3.2 h1:RBKHOsnSszpU6vxq80LzC2BaQjuuvoyaQbkLTf7V7g8= -github.com/hashicorp/go-memdb v1.3.2/go.mod h1:Mluclgwib3R93Hk5fxEfiRhB+6Dar64wWh71LpNSe3g= +github.com/hashicorp/go-memdb v1.3.3 h1:oGfEWrFuxtIUF3W2q/Jzt6G85TrMk9ey6XfYLvVe1Wo= +github.com/hashicorp/go-memdb v1.3.3/go.mod h1:uBTr1oQbtuMgd1SSGoR8YV27eT3sBHbYiNm53bMpgSg= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= @@ -142,8 +143,6 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nhatthm/go-clock v0.6.0 h1:R8I8slcnValPDdM4Cd3Tk3JSSDnZk3nPuLzzPFInYtU= -github.com/nhatthm/go-clock v0.6.0/go.mod h1:KASu97ux5p0fpVsazI4sGJN+HlzeobKsvEtjaFQUXjc= github.com/nhatthm/timeparser v0.2.0 h1:iItJSmsdRUMuEj/sTCcl1V1KT96TbuQ03uRpVDudodo= github.com/nhatthm/timeparser v0.2.0/go.mod h1:FPeNpb70J+UHjmQifiImZWrDnc4Ao8dGdtZ08oaUdro= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= @@ -186,7 +185,6 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -198,6 +196,8 @@ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69 github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.nhat.io/clock v0.7.0 h1:L3t8s+bOqqMXlGcv2qgKhIHBFqYS7rB84gYOHl4F7iA= +go.nhat.io/clock v0.7.0/go.mod h1:95+ixhxejL/vGxvfiJnrEh19gr03GLyJcTZo7UDr6kA= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -319,7 +319,6 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=