diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a69dd51..fb0b18e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,11 +28,14 @@ jobs: ${{ runner.os }}-go-cache - name: Run gofmt run: gofmt -d -e . 2>&1 | tee outfile && test -z "$(cat outfile)" && rm outfile - - name: Run golint + - name: Run staticcheck + if: matrix.go-version == '1.17.x' run: | - go install golang.org/x/lint/golint@latest - golint -set_exit_status ./... - cd _examples && golint -set_exit_status ./... && cd .. + bin/staticcheck_linux_amd64_2021.1.2 github.com/cucumber/godog + bin/staticcheck_linux_amd64_2021.1.2 github.com/cucumber/godog/cmd/godog + # Disable for now because of failing checks + # TODO: Add back in when fixes are made + # bin/staticcheck_linux_amd64_2021.1.2 ./... - name: Run go vet run: | go vet ./... diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ffb3c86..4467822 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,3 +22,7 @@ If everything passes, you're ready to hack! [install go]: https://golang.org/doc/install [community Slack]: https://cucumber.io/community#slack [raise an issue]: https://github.com/cucumber/godog/issues/new/choose + +## Changing dependencies + +If dependencies have changed, you will also need to update the _examples module. `go mod tidy` should be sufficient. \ No newline at end of file diff --git a/Makefile b/Makefile index 346aa33..01bbc5c 100644 --- a/Makefile +++ b/Makefile @@ -12,8 +12,8 @@ test: check-go-version @echo "running all tests" @go install ./... @go fmt ./... - @go run golang.org/x/lint/golint@latest github.com/cucumber/godog - @go run golang.org/x/lint/golint@latest github.com/cucumber/godog/cmd/godog + @go run honnef.co/go/tools/cmd/staticcheck@v0.2.2 github.com/cucumber/godog + @go run honnef.co/go/tools/cmd/staticcheck@v0.2.2 github.com/cucumber/godog/cmd/godog go vet ./... go test -race ./... godog -f progress -c 4 diff --git a/bin/staticcheck_linux_amd64_2021.1.2 b/bin/staticcheck_linux_amd64_2021.1.2 new file mode 100755 index 0000000..1c92681 Binary files /dev/null and b/bin/staticcheck_linux_amd64_2021.1.2 differ diff --git a/run_test.go b/run_test.go index cdbcf76..bbe4843 100644 --- a/run_test.go +++ b/run_test.go @@ -632,8 +632,7 @@ type progressOutput struct { bottomRows []string } -func passingStepDef() error { return nil } -func passingStepDefWithoutReturn() {} +func passingStepDef() error { return nil } func oddEvenStepDef(odd, even int) error { return oddOrEven(odd, even) } diff --git a/suite.go b/suite.go index 2d80bed..ebb97c5 100644 --- a/suite.go +++ b/suite.go @@ -418,16 +418,6 @@ func (s *suite) shouldFail(err error) bool { return true } -func isEmptyFeature(pickles []*messages.Pickle) bool { - for _, pickle := range pickles { - if len(pickle.Steps) > 0 { - return false - } - } - - return true -} - func (s *suite) runPickle(pickle *messages.Pickle) (err error) { ctx := s.defaultContext if ctx == nil { diff --git a/test_context_test.go b/test_context_test.go index d5fe930..7810700 100644 --- a/test_context_test.go +++ b/test_context_test.go @@ -42,8 +42,8 @@ func TestScenarioContext_Step(t *testing.T) { }) Convey("has more than 2 return values", func() { - So(func() { ctx.Step(".*", nokLimitCase) }, ShouldPanicWith, fmt.Sprintf("expected handler to return either zero, one or two values, but it has: 3")) - So(func() { ctx.Step(".*", nokMore) }, ShouldPanicWith, fmt.Sprintf("expected handler to return either zero, one or two values, but it has: 5")) + So(func() { ctx.Step(".*", nokLimitCase) }, ShouldPanicWith, "expected handler to return either zero, one or two values, but it has: 3") + So(func() { ctx.Step(".*", nokMore) }, ShouldPanicWith, "expected handler to return either zero, one or two values, but it has: 5") }) Convey("return type is not an error or string slice or void", func() {