It worked. In my last try the multiple packages that I generated were not 
comma separated, once I fixed that everything worked fine.


On Friday, 4 November 2016 14:50:00 UTC+5:30, Vivekanand SV wrote:
>
> I tried few things and the following worked for me
>
> *go test -c -coverpkg=. -covermode=count -o=test_binary*
> *test_binary -test.coverprofile c.out*
>
> But the the same thing fails when there are more than one package passed 
> to coverpkg flag with the error "*cannot use -c flag with multiple 
> packages*". 
>
> Is there any way I can workaround this problem ?
>
>
> On Thursday, 3 November 2016 19:24:36 UTC+5:30, Vivekanand SV wrote:
>>
>> Hi,
>>
>>
>>     I have a setup where I first generate binary and then run the binary 
>> for the test cases. I was able to do that successfully for basic things, 
>> but when I want to pass the coverpkg flag to the binary it doesn't work as 
>> it is not defined. I can see only coverprofile is defined while coverpkg 
>> and covermode are not defined. Were they left out intentionally ?
>>
>>
>> My call is like below:
>>
>>
>> *# packageName, packagePath and coverPkgs are passed dynamically.*
>> *go test $packageName -gcflags -e -v -c -o=test_binary*
>> *./test_binary -test.coverpkg=$coverPkgs -test.covermode=count 
>> -test.coverprofile=$packagePath"/"c.out*
>>
>>
>>     The reason I am running this separately is I want the go test to not 
>> use package directory as its working directory, I want it to be different.
>>
>>
>> Thanks,
>> Vivek.
>>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to