Re: [go-nuts] go test looking for a C library when the package actually does not contain any test files

2017-09-13 Thread Ondřej Kupka
Hmm, that sucks for my use case, but at least I know now that it's a
feature.

Cheers,
Ondřej

On st 13. 9. 2017 19:25 Ian Lance Taylor  wrote:

> On Wed, Sep 13, 2017 at 9:06 AM, Ondřej Kupka  wrote:
> >
> > I am running go test on a set of packages. Some of these packages do
> contain
> > tests and some don't.
> > The packages that don't contain any test files import a Kafka package
> that
> > links librdkafka and uses Cgo.
> > When I run go test with this set of packages I end up getting
> >
> > # pkg-config --cflags rdkafka
> > Package rdkafka was not found in the pkg-config search path.
> > Perhaps you should add the directory containing `rdkafka.pc'
> > to the PKG_CONFIG_PATH environment variable
> > No package 'rdkafka' found pkg-config:
> > exit status 1
> >
> > I don't understand why it is searching for librdkafka when the packages
> > actually containing tests do not need it.
> > It this a bug or a weird feature? It there any way around it, except not
> > passing in the packages without tests?
>
> `go test` will build all the requested packages in the process of
> testing them.  It will build a package even if it has no tests.  That
> is presumably where your run is failing.  I suppose you could consider
> building a package to be a minimal form of testing it.
>
> Ian
>

-- 
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.


Re: [go-nuts] go test looking for a C library when the package actually does not contain any test files

2017-09-13 Thread Ian Lance Taylor
On Wed, Sep 13, 2017 at 9:06 AM, Ondřej Kupka  wrote:
>
> I am running go test on a set of packages. Some of these packages do contain
> tests and some don't.
> The packages that don't contain any test files import a Kafka package that
> links librdkafka and uses Cgo.
> When I run go test with this set of packages I end up getting
>
> # pkg-config --cflags rdkafka
> Package rdkafka was not found in the pkg-config search path.
> Perhaps you should add the directory containing `rdkafka.pc'
> to the PKG_CONFIG_PATH environment variable
> No package 'rdkafka' found pkg-config:
> exit status 1
>
> I don't understand why it is searching for librdkafka when the packages
> actually containing tests do not need it.
> It this a bug or a weird feature? It there any way around it, except not
> passing in the packages without tests?

`go test` will build all the requested packages in the process of
testing them.  It will build a package even if it has no tests.  That
is presumably where your run is failing.  I suppose you could consider
building a package to be a minimal form of testing it.

Ian

-- 
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.


[go-nuts] go test looking for a C library when the package actually does not contain any test files

2017-09-13 Thread Ondřej Kupka
Hi,

I am running go test on a set of packages. Some of these packages do 
contain tests and some don't.
The packages that *don't* contain any test files import a Kafka package 
that links librdkafka and uses Cgo.
When I run go test with this set of packages I end up getting

# pkg-config --cflags rdkafka
Package rdkafka was not found in the pkg-config search path.
Perhaps you should add the directory containing `rdkafka.pc'
to the PKG_CONFIG_PATH environment variable
No package 'rdkafka' found pkg-config:
exit status 1

I don't understand why it is searching for librdkafka when the packages 
actually containing tests do not need it.
It this a bug or a weird feature? It there any way around it, except not 
passing in the packages without tests?

Regards,
Ondrej

-- 
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.