Using External C Packages in Go Tests

I have a external C package from github that I've successfully integrated into my Go Project calling it from a single Go Module. This necessitated installing pkg-config. I'm running on MacOS Catalina

I have 

#cgo LDFLAGS: -L<pathtolibrary> and import "C" in my go file

When I Debug my Unit Test CTRL-SHIFT-D everything works.

However with CTRL-SHIFT-R I get pkg-config --cflags -- <library> Package <library> was not found in the pkg-config search path. Perhaps you should add the directory containing <library>.pc to the PKG_CONFIG_PATH environment variable.

Why is this necessary when CTRL-SHIFT-D works? I'd rather not have to set that environment variable outside of my GOLANG environment. I running the latest GOLAND release.

0
正式评论

Hi,

Can you please provide a sample project that reproduces the problem? It will be much easier to find the reason if I can reproduce the issue on my machine.

请先登录再写评论。