Skip to content

Commit

Permalink
Merge pull request #2 from ChristoWolf/issue/1
Browse files Browse the repository at this point in the history
feat: created Taskfile for testing and covering Go code
  • Loading branch information
ChristoWolf authored Feb 13, 2023
2 parents b9340b7 + 76d96b1 commit abe4212
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
28 changes: 28 additions & 0 deletions Go/Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: '3'

output: prefixed

vars:
COVERNAME: 'coverage'
COVEREXT: '.out'
COVERFILE: '{{.COVERNAME}}{{.COVEREXT}}'
COVERHTML: '{{.COVERNAME}}.html'

tasks:

go-test:
desc: 'runs `go test` in race detection and atomic coverage collection mode'
dir: '{{.USER_WORKING_DIR}}'
cmds:
- cmd: go test -v ./... -race -coverprofile={{.COVERFILE}} -covermode=atomic

go-cover:
desc: 'runs the go-test task, the `cover` Go tool and displays the generated HTML report'
dir: '{{.USER_WORKING_DIR}}'
deps:
- task: go-test
cmds:
- cmd: go tool cover -html={{.COVERFILE}} -o {{.COVERHTML}}
- cmd: cmd /c start {{.COVERHTML}}
platforms: [windows]

3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# taskfiles
A collection of Taskfiles for https://taskfile.dev/
# A collection of Taskfiles for [Task](https://taskfile.dev/)

0 comments on commit abe4212

Please sign in to comment.