:jeans:Multi-Package go project coverprofile for tools like goveralls

Overview

Package overalls

Build Status GoDoc

Package overalls takes multi-package go projects, runs test coverage tests on all packages in each directory and finally concatenates into a single file for tools like goveralls and codecov.io.

Usage and documentation

Example
overalls -project=github.com/go-playground/overalls -covermode=count -debug
then with other tools such as goveralls
goveralls -coverprofile=overalls.coverprofile -service semaphore -repotoken $COVERALLS_TOKEN
or codecov.io
mv overalls.coverprofile coverage.txt
export CODECOV_TOKEN=###
bash <(curl -s https://codecov.io/bash)
note:
  1. goveralls and codecover currently do not calculate coverage the same way as go tool cover see here and here.

  2. overalls (and go test) by default will not calculate coverage "across" packages. E.g. if a test in package A covers code in package B overalls will not count it. You may or may not want this depending on whether you're more concerned about unit test coverage or integration test coverage. To enable add the coverpkg flag. overalls -project=github.com/go-playground/overalls -covermode=count -debug -- -coverpkg=./...

$ overalls -help

usage: overalls -project=[path] -covermode[mode] OPTIONS -- TESTOPTIONS

overalls recursively traverses your projects directory structure
running 'go test -covermode=count -coverprofile=profile.coverprofile'
in each directory with go test files, concatenates them into one
coverprofile in your root directory named 'overalls.coverprofile'

OPTIONS
  -project
	Your project path as an absolute path or relative to the '$GOPATH/src' directory
	example: -project=github.com/go-playground/overalls

  -covermode
    Mode to run when testing files.
    default:count

OPTIONAL

  -ignore
    A comma separated list of directory names to ignore, relative to project path.
    example: -ignore=[.git,.hiddentdir...]
    default: '.git'

  -debug
    A flag indicating whether to print debug messages.
    example: -debug
    default:false

  -concurrency
    Limit the number of packages being processed at one time.
    The minimum value must be 2 or more when set.
    example: -concurrency=5
    default: unlimited

TESTOPTIONS

Any flags after -- will be passed as-is to go test. For example:

overalls -project=$PROJECT -debug -- -race -v

Will call go test -race -v under the hood in addition to the -coverprofile commands.

How to Contribute

Make a pull request.

If the changes being proposed or requested are breaking changes, please create an issue.

License

Distributed under MIT License, please see license file in code for more details.

Comments
  • Proposal: allow configuring

    Proposal: allow configuring "go" command for compatibility with `richgo`

    This is a neat tool: https://github.com/kyoh86/richgo

    I'd like to add a flag to overalls that allows us to specify e.g. --go-cmd=richgo (default would be "go").

    Thoughts/objections?

    question 
    opened by ascandella 12
  • Use covermode atomic with -race

    Use covermode atomic with -race

    I believe the current default of -covermode=count with -race can cause race conditions. See this gist for an example.

    https://gist.github.com/mmcloughlin/6ec7d19a354ff2869350432f37628663

    opened by mmcloughlin 11
  • Add concurrency flag to limit resource usage

    Add concurrency flag to limit resource usage

    I wrote this because we have a repository that over utilizes packages and we run tests on a resource-constrained VM. In order to not build all packages at the same time (and bring down the VM), I've added an option to use a concurrency limiter so overalls only processes a certain number of packages at a time.

    In order to not change current usage for others who don't care, I've set a very high default for the concurrency limit.

    Based on http://jmoiron.net/blog/limiting-concurrency-in-go/

    I'm not sure if others find this useful or not. If not, we can close this PR.

    opened by teastburncx 7
  • Allow overalls to work with projects based on Go modules

    Allow overalls to work with projects based on Go modules

    This is my attempt to get overalls to work with project based on Go modules. I can't say I entirely understand the consequences of passing "." as the source directory in the build.Default.Import call, but it works fine with overalls itself and one of my own projects (both prior to and after the migration to Go modules).

    opened by magnusbaeck 5
  • Support passing arguments to go test

    Support passing arguments to go test

    We run our tests in CI with -race -v, it'd be nice if we could keep the same output, while still using overalls to actually run the tests per package and merge the coverage output.

    Being able to pass arguments like go list takes would also be nice.

    I'm happy to try and add this myself, but that would require a bit of bikeshedding (of test output, of arguments) so I wanted to bring this up for discussion first

    proposal 
    opened by nothingmuch 4
  • Improve statements detection

    Improve statements detection

    We had a problem with the correctness of statements detection when tests are located in a separate package and have sub-packages so I've made a little change of how go test runs - include all sub-packages of the testing one and this fixed the problem. For example here is what was happening and here is how it works now.

    opened by KernelPryanic 3
  • GPL dependency

    GPL dependency

    I've just noticed that this project depends on "github.com/yookoala/realpath" which is licensed under GPL-like dependency. I'm not sure, but may be it's impossible to have this project licensed under MIT because of it. Anyway, thanks for a perfect library :)

    opened by vitalyisaev2 2
  • Add -go-binary flag for richgo integration

    Add -go-binary flag for richgo integration

    Richgo is this cool tool that you can use to colorize your go test output into a much more readable format:

    https://github.com/kyoh86/richgo

    By running overalls -go-binary=richgo (assuming you've installed it), you get sweet, sweet output.

    Fixes #15

    opened by ascandella 2
  • Support symbolic links

    Support symbolic links

    As part of my CI build process, the source is mounted at /source. I then create a symbolic link from /source to /go/src/github.com/F21/myproject.

    Unfortunately, when symbolic links are used, overalls is not able to find the tests in the project. The current solution is to copy the contents of /source to /go/src/github.com/F21/myproject, but support for symbolic links would be super awesome!

    enhancement question 
    opened by F21 2
  • Allow running outside of go workspace

    Allow running outside of go workspace

    Our CI system checks out git repositories with no consideration for go workspace layouts.

    go test still works inside the checkout directory, but it's impossible to use overalls to run it without shuffling things around

    question 
    opened by nothingmuch 2
  • optionally output to file as well as logger

    optionally output to file as well as logger

    I have a case where I need the test output as well as the coverage report to make my CI tooling happy.

    This PR adds an optional flag (outfile) to write stderr and stdout to a file as well as to the logger.

    opened by christian-blades-cb 1
  • Include -coverpkg=./... by default

    Include -coverpkg=./... by default

    I tried using this tool to get a coverage report similar to goveralls but the lack of the "--coverpkg" arg caused it to give a much different result. You can see goveralls is using --coverpkg here: https://github.com/mattn/goveralls/blob/master/goveralls.go#L124

    I suggest that you make this the command because I would guess that most people seeking multi-package coverage have package that depend on each other and this is what they want. Otherwise the results are confusing because it says you have no coverage when you really do. go test -covermode=count -coverprofile=profile.coverprofile -coverpkg=./...

    enhancement help wanted 
    opened by cdennison 2
Owner
Go Playgound
multiple packages, libraries and programs to further the advancement of Go!
Go Playgound
goveralls - Go integration for Coveralls.io continuous code coverage tracking system.

goveralls Go integration for Coveralls.io continuous code coverage tracking system. Installation goveralls requires a working Go installation (Go-1.2

mattn 749 Dec 7, 2022
siusiu (suite-suite harmonics) a suite used to manage the suite, designed to free penetration testing engineers from learning and using various security tools, reducing the time and effort spent by penetration testing engineers on installing tools, remembering how to use tools.

siusiu (suite-suite harmonics) a suite used to manage the suite, designed to free penetration testing engineers from learning and using various security tools, reducing the time and effort spent by penetration testing engineers on installing tools, remembering how to use tools.

Re 293 Dec 9, 2022
Guilherme Biff Zarelli 3 Jun 6, 2022
A fast data generator that's multi-table aware and supports multi-row DML.

If you need to generate a lot of random data for your database tables but don't want to spend hours configuring a custom tool for the job, then datage

Coding Concepts 51 Nov 21, 2022
Open, Multi-Cloud, Multi-Cluster Kubernetes Orchestration

Karmada Karmada: Open, Multi-Cloud, Multi-Cluster Kubernetes Orchestration Karmada (Kubernetes Armada) is a Kubernetes management system that enables

null 2.9k Dec 7, 2022
Multi producer and multi-reader lockless ring buffer in go using generics from the go 1.18beta release

LocklessGenericRingBuffer This is an implementation of a multi producer, multi r

Gavin Clarke 142 Nov 15, 2022
Go WhatsApp Multi-Device Implementation in REST API with Multi-Session/Account Support

Go WhatsApp Multi-Device Implementation in REST API This repository contains example of implementation go.mau.fi/whatsmeow package with Multi-Session/

Dimas Restu H 62 Dec 3, 2022
This project is a collection of many of the basic tools used on Unix-like operating systems implemented in Go as a learning exercize.

GoUnix This project is a collection of many of the basic tools used on Unix-like operating systems implemented in Go as a learning exercize. The idea

Tom Hanson 65 Jul 21, 2022
gNXI Tools - gRPC Network Management/Operations Interface Tools

gNxI Tools gNMI - gRPC Network Management Interface gNOI - gRPC Network Operations Interface A collection of tools for Network Management that use the

Google 226 Nov 11, 2022
Chanify is a safe and simple notification tools. This repository is command line tools for Chanify.

Chanify is a safe and simple notification tools. For developers, system administrators, and everyone can push notifications with API.

Chanify 967 Dec 2, 2022
Tools - This subrepository holds the source for various packages and tools that support

Go Tools This subrepository holds the source for various packages and tools that

Rohan 0 Jan 12, 2022
Go package providing opinionated tools and methods for working with the `aws-sdk-go/service/cloudfront` package.

go-aws-cloudfront Go package providing opinionated tools and methods for working with the aws-sdk-go/service/cloudfront package. Documentation Tools $

aaronland 0 Feb 2, 2022
PHP functions implementation to Golang. This package is for the Go beginners who have developed PHP code before. You can use PHP like functions in your app, module etc. when you add this module to your project.

PHP Functions for Golang - phpfuncs PHP functions implementation to Golang. This package is for the Go beginners who have developed PHP code before. Y

Serkan Algur 52 Aug 26, 2022
Easily increment 📶 a multi-language 🔱 project version

version-bump Have you ever made a mistake incrementing a project version? Do you have multiple files to update the version at? I was always forgetting

Anton Yurchenko 10 Dec 4, 2022
This project was created with the purpose of implementing a multi-process synchronization problem.

Producer Consumer This project was created with the purpose of implementing a multi-process synchronization problem. The result is determined by the v

Alexandre Alves 1 Feb 15, 2022
Various tools for usage with Golang like installer, github tool and cloud features.

Gopei2 (Go Programming Environment Installer) Gopei shell install Go compiler, LiteIDE and configure for you the entire environment, variables, paths,

George Calianu 100 Nov 9, 2022
A suite of gRPC debugging tools. Like Fiddler/Charles but for gRPC.

grpc-tools A suite of tools for gRPC debugging and development. Like Fiddler/Charles but for gRPC! The main tool is grpc-dump which transparently inte

Bradley Kemp 1.1k Dec 7, 2022
A fully Go userland with Linux bootloaders! u-root can create a one-binary root file system (initramfs) containing a busybox-like set of tools written in Go.

u-root Description u-root embodies four different projects. Go versions of many standard Linux tools, such as ls, cp, or shutdown. See cmds/core for m

null 2k Dec 8, 2022