Open manitgupta opened 2 years ago
@manitgupta Unfortunately I'm not sure what is causing this issue - we have seem similar problems ourselves, and are using modvendor to solve them for our own internal use case with the pganalyze collector:
https://github.com/pganalyze/collector/blob/main/Makefile#L32
(possibly you can ask someone internally on the Go team at Google, how go mod vendor
should work for .c/.h files?)
@lfittl I looked into this issue and the reason seems to be that go mod vendor
does not correctly include source files from a directory if there are no .go
file present in it. The solution seems to be to include a dummy.go
file in the directories.
This has been done go-graphviz
repo previously and seems to be work.
Here is the PR for it: https://github.com/goccy/go-graphviz/pull/37/files
I am willing to do a similar PR for pg_query_go
if you'd be willing to review it.
This modvendor
solution is also interesting. As a workaround, I had earlier written a script in our Makefile to get the source at the needed version for pg_query_go
package.
build-vendor:
# vendor the dependencies
go mod vendor
# git clone the repository and switch to the tag present in harbourbridge's go.mod file (currently: v2.0.5)
rm -rf vendor/github.com/pganalyze/pg_query_go/v2
cd vendor/github.com/pganalyze/pg_query_go/ && git clone https://github.com/pganalyze/pg_query_go
cd vendor/github.com/pganalyze/pg_query_go/pg_query_go/ && git checkout tags/v2.0.5
mv vendor/github.com/pganalyze/pg_query_go/pg_query_go/ vendor/github.com/pganalyze/pg_query_go/v2/
# revert to the home directory and build
go build
I've just encountered this as well, upstream ticket is https://github.com/golang/go/issues/26366 ("resolved", yeah, great).
Hi,
We are using
pg_query_go
as a dependency for harbourbridge.When I vendor in
pg_query_go
usinggo mod vendor
, I get a missing C header error:I am on
pg_query_go
v2.0.5.This is what gets vendored in:
When I just
rm -r vendor
, this problem goes away and everything works fine.I saw a similar issue in another repo here: https://github.com/goccy/go-graphviz/issues/28
Could you please suggest a path to vendoring in this library?