Skip to content

Instantly share code, notes, and snippets.

@nyarly
Last active July 23, 2016 00:00
Show Gist options
  • Save nyarly/ca4fb3fbb8f8af4b30ecd9f1e330df9d to your computer and use it in GitHub Desktop.
Save nyarly/ca4fb3fbb8f8af4b30ecd9f1e330df9d to your computer and use it in GitHub Desktop.
Configs for coverage in Go
LegendEnable
exec "au BufEnter,BufWinEnter ". expand('%:p') ." LegendEnable"
#!/usr/bin/env bash
coverdir=/tmp/sous-cover
engulf -coverdir $coverdir -covermode=count -short -max-jobs=8 ./...
res=$?
legendary .cadre/coverage.vim $coverdir/*.coverprofile
exit $res
@nyarly
Copy link
Author

nyarly commented Jul 23, 2016

You'll need to go get github.com/nyarly/engulf github.com/nyarly/legendary to get all the tools involved.
You'll also need a Vim plugin called 'killphi/vim-legend'

The test run with all coverage is more time consuming (like by about 10x) but it's generally not needed.
The result, though, will be signs in Vim that indicate test coverage of files while you're working, which I find super useful.

Futhermore legendary --hitlist /tmp/sous-cover/*.coverprofile will produce a list all code files, sorted by worst coverage in terms of absolute missed lines and by missed percentage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment