#[Clean code] Need a better way to import a C library in Golang
16 messages · Page 1 of 1 (latest)
the upside of writing tests in go is that you not only test the C code but the go shim around it too
I think that would be more useful since in the project, i'm 100% using the C code as a library so better test the actual way i'm using it
now for the static linking, is there any other cleaner way than write a 700 long line of linking in the go file ?
what's dirty about it?
having a 700 character long line for the linking everytime we have to use the libraries
having to use absolute paths instead of dynamic paths
imagine i wanna move some libraries, i'll have to change all the paths from LDFLAGS
you don't need to repeat the flags for every file
in the screenshot the paths are relative
given they are relative you wouldn't need to, provided they are packaged in a cohesive way
plus, you'd only need to change it once
if you want some advice
don't solve imaginary problems
if you insist on solving what looks like, ostensibly, a non issue, using pkgconfig can help
at the cost of complicating the build if you plan on hosting the .pc out of the system path (which I'd wager you would)