Skip to content

Commit 7666862

Browse files
authored
feat: added go-lint task which runs golangci-lint (#7)
1 parent e36776b commit 7666862

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

Go/Taskfile.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,35 @@ version: '3'
33
output: prefixed
44

55
vars:
6-
COVERNAME: 'coverage'
7-
COVEREXT: '.out'
8-
COVERFILE: '{{.COVERNAME}}{{.COVEREXT}}'
9-
COVERHTML: '{{.COVERNAME}}.html'
6+
COVER_NAME: 'coverage'
7+
COVER_FILE: '{{.COVER_NAME}}.out'
8+
COVER_HTML: '{{.COVER_NAME}}.html'
109

1110
tasks:
1211

1312
go-test:
1413
desc: 'runs `go test` in race detection and atomic coverage collection mode'
1514
dir: '{{.USER_WORKING_DIR}}'
1615
cmds:
17-
- cmd: go test -v ./... -race -coverprofile={{.COVERFILE}} -covermode=atomic
16+
- cmd: go test -v ./... -race -coverprofile={{.COVER_FILE}} -covermode=atomic
1817

1918
go-cover:
2019
desc: 'runs the go-test task, the `cover` Go tool and displays the generated HTML report'
2120
dir: '{{.USER_WORKING_DIR}}'
2221
deps:
2322
- task: go-test
2423
cmds:
25-
- cmd: go tool cover -html={{.COVERFILE}} -o {{.COVERHTML}}
26-
- cmd: cmd /c start {{.COVERHTML}}
24+
- cmd: go tool cover -html={{.COVER_FILE}} -o {{.COVER_HTML}}
25+
- cmd: cmd /c start {{.COVER_HTML}}
2726
platforms: [windows]
2827

28+
go-lint:
29+
desc: 'runs `golangci-lint` with the first recursively found config file'
30+
dir: '{{.USER_WORKING_DIR}}'
31+
vars:
32+
CONFIG_FILE:
33+
sh: where /r "{{.USER_WORKING_DIR}}" .golangci.*
34+
cmds:
35+
- cmd: 'echo found config file: "{{.CONFIG_FILE}}"'
36+
- cmd: golangci-lint run --config="{{.CONFIG_FILE}}"
37+
platforms: [windows]

0 commit comments

Comments
 (0)