Updated linting checks in circleci config and fixed linting issues
Этот коммит содержится в:
родитель
521a9688b9
коммит
d0a28b5a94
6 изменённых файлов: 46 добавлений и 31 удалений
|
@ -15,57 +15,67 @@ executors:
|
|||
- image: circleci/golang:1.14.0
|
||||
|
||||
commands:
|
||||
install:
|
||||
description: "Install dependencies"
|
||||
fmt:
|
||||
description: "Run gofmt"
|
||||
steps:
|
||||
- run: GO111MODULE=on go mod vendor -v
|
||||
- run: gofmt -d -e . 2>&1 | tee outfile && test -z "$(cat outfile)" && rm outfile
|
||||
lint:
|
||||
description: "Run golint"
|
||||
steps:
|
||||
- run: go get -u golang.org/x/lint/golint
|
||||
- run: golint -set_exit_status ./...
|
||||
- run: cd _examples && golint -set_exit_status ./... && cd ..
|
||||
install:
|
||||
description: "Install dependencies for go1.12"
|
||||
steps:
|
||||
- run: GO111MODULE=on go mod vendor
|
||||
vet:
|
||||
description: "Run go vet"
|
||||
steps:
|
||||
- run: go vet github.com/cucumber/godog
|
||||
- run: go vet github.com/cucumber/godog/colors
|
||||
fmt:
|
||||
description: "Run go fmt"
|
||||
go_test:
|
||||
description: "Run go test"
|
||||
steps:
|
||||
- run: test -z "$(go fmt ./...)"
|
||||
lint:
|
||||
description: "Run golint"
|
||||
steps:
|
||||
- run: go get -u golang.org/x/lint/golint
|
||||
- run: golint ./godog
|
||||
- run: golint ./cmd/godog/main.go
|
||||
- run: go test -v -race -coverprofile=coverage.txt -covermode=atomic
|
||||
godog:
|
||||
description: "Run godog"
|
||||
steps:
|
||||
- run: go install ./cmd/godog
|
||||
- run: godog -f progress --strict
|
||||
go_test:
|
||||
description: "Run go test"
|
||||
steps:
|
||||
- run: go test -v -race -coverprofile=coverage.txt -covermode=atomic
|
||||
coverage:
|
||||
description: "Report on code coverage"
|
||||
steps:
|
||||
- codecov/upload:
|
||||
file: "coverage.txt"
|
||||
part1:
|
||||
description: "Part1 include all commands that doesn't need dependencies installed"
|
||||
steps:
|
||||
- checkout
|
||||
- fmt
|
||||
- lint
|
||||
part2:
|
||||
description: "Part2 is the all other commands"
|
||||
steps:
|
||||
- vet
|
||||
- go_test
|
||||
- godog
|
||||
- coverage
|
||||
all:
|
||||
description: "Run all commands against godog code"
|
||||
steps:
|
||||
- checkout
|
||||
- install
|
||||
- vet
|
||||
- fmt
|
||||
- lint
|
||||
- godog
|
||||
- go_test
|
||||
- coverage
|
||||
- part1
|
||||
- part2
|
||||
|
||||
|
||||
jobs:
|
||||
go1_12:
|
||||
working_directory: /go/src/github.com/cucumber/godog
|
||||
executor: exec_go_1_12
|
||||
steps:
|
||||
- all
|
||||
- part1
|
||||
- install
|
||||
- part2
|
||||
go1_13:
|
||||
working_directory: /go/src/github.com/cucumber/godog
|
||||
executor: exec_go_1_13
|
||||
|
|
|
@ -140,7 +140,6 @@ Since we need a working implementation, we may start by implementing only what i
|
|||
We only need a number of **godogs** for now. Lets keep it simple.
|
||||
|
||||
``` go
|
||||
/* file: $GOPATH/src/godogs/godogs.go */
|
||||
package main
|
||||
|
||||
// Godogs available to eat
|
||||
|
@ -155,7 +154,6 @@ Now lets implement our step definitions, which we can copy from generated
|
|||
console output snippets in order to test our feature requirements:
|
||||
|
||||
``` go
|
||||
/* file: $GOPATH/src/godogs/godogs_test.go */
|
||||
package main
|
||||
|
||||
import (
|
||||
|
@ -348,8 +346,6 @@ is one of the following:
|
|||
A more extensive example can be [found here](/_examples/assert-godogs).
|
||||
|
||||
``` go
|
||||
/* file: $GOPATH/src/assert-godogs/godogs_test.go */
|
||||
|
||||
func thereShouldBeRemaining(remaining int) error {
|
||||
return assertExpectedAndActual(
|
||||
assert.Equal, Godogs, remaining,
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/* file: $GOPATH/src/godogs/godogs.go */
|
||||
package main
|
||||
|
||||
// Godogs available to eat
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/* file: $GOPATH/src/godogs/godogs.go */
|
||||
package main
|
||||
|
||||
// Godogs available to eat
|
||||
|
|
|
@ -26,34 +26,43 @@ func colorize(s interface{}, c color) string {
|
|||
return fmt.Sprintf("%s[%dm%v%s[0m", ansiEscape, c, s, ansiEscape)
|
||||
}
|
||||
|
||||
// ColorFunc is a helper type to create colorized strings.
|
||||
type ColorFunc func(interface{}) string
|
||||
|
||||
// Bold will accept a ColorFunc and return a new ColorFunc
|
||||
// that will make the string bold.
|
||||
func Bold(fn ColorFunc) ColorFunc {
|
||||
return ColorFunc(func(input interface{}) string {
|
||||
return strings.Replace(fn(input), ansiEscape+"[", ansiEscape+"[1;", 1)
|
||||
})
|
||||
}
|
||||
|
||||
// Green will accept an interface and return a colorized green string.
|
||||
func Green(s interface{}) string {
|
||||
return colorize(s, green)
|
||||
}
|
||||
|
||||
// Red will accept an interface and return a colorized green string.
|
||||
func Red(s interface{}) string {
|
||||
return colorize(s, red)
|
||||
}
|
||||
|
||||
// Cyan will accept an interface and return a colorized green string.
|
||||
func Cyan(s interface{}) string {
|
||||
return colorize(s, cyan)
|
||||
}
|
||||
|
||||
// Black will accept an interface and return a colorized green string.
|
||||
func Black(s interface{}) string {
|
||||
return colorize(s, black)
|
||||
}
|
||||
|
||||
// Yellow will accept an interface and return a colorized green string.
|
||||
func Yellow(s interface{}) string {
|
||||
return colorize(s, yellow)
|
||||
}
|
||||
|
||||
// White will accept an interface and return a colorized green string.
|
||||
func White(s interface{}) string {
|
||||
return colorize(s, white)
|
||||
}
|
||||
|
|
|
@ -11,6 +11,8 @@ type noColors struct {
|
|||
lastbuf bytes.Buffer
|
||||
}
|
||||
|
||||
// Uncolored will accept and io.Writer and return a
|
||||
// new io.Writer that won't include colors.
|
||||
func Uncolored(w io.Writer) io.Writer {
|
||||
return &noColors{out: w}
|
||||
}
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче