Skip to content

Commit abe4212

Browse files
authored
Merge pull request #2 from ChristoWolf/issue/1
feat: created Taskfile for testing and covering Go code
2 parents b9340b7 + 76d96b1 commit abe4212

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

Go/Taskfile.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: '3'
2+
3+
output: prefixed
4+
5+
vars:
6+
COVERNAME: 'coverage'
7+
COVEREXT: '.out'
8+
COVERFILE: '{{.COVERNAME}}{{.COVEREXT}}'
9+
COVERHTML: '{{.COVERNAME}}.html'
10+
11+
tasks:
12+
13+
go-test:
14+
desc: 'runs `go test` in race detection and atomic coverage collection mode'
15+
dir: '{{.USER_WORKING_DIR}}'
16+
cmds:
17+
- cmd: go test -v ./... -race -coverprofile={{.COVERFILE}} -covermode=atomic
18+
19+
go-cover:
20+
desc: 'runs the go-test task, the `cover` Go tool and displays the generated HTML report'
21+
dir: '{{.USER_WORKING_DIR}}'
22+
deps:
23+
- task: go-test
24+
cmds:
25+
- cmd: go tool cover -html={{.COVERFILE}} -o {{.COVERHTML}}
26+
- cmd: cmd /c start {{.COVERHTML}}
27+
platforms: [windows]
28+

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
# taskfiles
2-
A collection of Taskfiles for https://taskfile.dev/
1+
# A collection of Taskfiles for [Task](https://taskfile.dev/)

0 commit comments

Comments
 (0)