Skip to content

Merge coverage report each module into a single coverage report #67

Closed as not planned
@rghetia

Description

@rghetia

After #65 test is run for each module in its own sub-directory. The raw coverage report for each module is is separate. These reports can be merged with following bash script.

#!/bin/bash

files=`find . -name 'coverage.txt' | egrep -v '^\./coverage.txt' | tr '\n' ' '`
echo "mode: set" > $1 && cat $files | grep -v mode: | sort -r | awk '{if($1 != last) {print $0;last=$1}}' >> $1

The merged report can then be converted to html format using.

go tool cover -html=coverage.txt -o coverage.html

The issue with merging is that it doesn't work for the module which is new. Following error occurs for the new module

cover: no matching versions for query "latest"

Not sure what the root cause is but it is probably related go tool attempting to retrieve latest version of the new module from github which doesn't exists (because it is new - chicken-and-egg problem).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions