Add option `-coverpkg=$(go list ./...|sed 's/ /,/g')` works.

On Tuesday, May 24, 2016 at 9:31:52 PM UTC+8 Dave MacFarlane wrote:

> If all you're trying to do is get coverage of all your subpackages for a 
> CI and aren't concerned about downstream packages or manually toggling 
> which ones are one/off at runtime, I've used this script:
>
> https://github.com/codecov/example-go/blob/master/go.test.sh
>
> with Travis, and it seems to work fine.
>
>
> On Mon, May 23, 2016 at 2:15 AM, <julio....@gmail.com> wrote:
>
>> > My unit tests run against the code in package A which depends on 
>>> package 
>>> > B which depends on package C. When running with "-cover" I only get a 
>>> > report of the coverage in package A. Is there a way to get the 
>>> coverage 
>>> > report for all the packages in the project based on the tests that are 
>>> run? 
>>>
>>> From go test -help: 
>>>     -coverpkg pkg1,pkg2,pkg3 
>>>         Apply coverage analysis in each test to the given list of 
>>> packages. The default is for each test to analyze only the package being 
>>> tested. Packages are specified as import paths. 
>>>
>>> E.g. in the directory for package A, run "go test -coverpkg A,B,C". 
>>>
>>>
>> Is it possible to do the same at run-time?
>> When running tests recursively from a root directory, it is kind of weird 
>> to make such coverpkg list... It would be much cleaner to write this list 
>> in the test file instead or to offer better `-coverpkg` values...
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> - Dave
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/50bd7944-e59a-4cb3-8de7-2b4ca6f90990n%40googlegroups.com.

Reply via email to