We currently have a mono repo that contains multiple go projects. For example, we have the following example projects:
https://github.com/<company>/golang/<project1>https://github.com/<company>/golang/<project2>One of the projects is using GRPC + Firestore + GQLGen together. The module namespace for this project is github.com/<company>/<project1> (notice the golang segment is not there).
We are trying to re-use model structures that were generated as part of GRPC in the pbchat package.
We've updated the gqlgen.yml file to add our models as follows:
Identity:
model: github.com/<company>/<project1>/pbchat.Identity
Conversation:
model: github.com/<company>/<project1>/pbchat.Conversation
Message:
model: github.com/<company>/<project1>/pbchat.Message
We also updated the model section of gqlgen.yml as follows:
model:
filename: graph/model/models_gen.go
package: pbchat
If we run go generate ./... with skip_validation=false, we get the following error:
% go generate ./...
validation failed: packages.Load: -: cannot find module providing package github.com/<company>/<project1>/graph/model: module github.com/fitmo/chat-service/graph/model: git ls-remote -q origin in ~/projects/golang/pkg/mod/cache/vcs/3c5e1679b6aa1584ce354a41e10acb6faf0722ec041bd6685f2ea89aca0835e0: exit status 128:
remote: Repository not found.
fatal: repository 'https://github.com/<company>/<project1>/' not found
exit status 1
graph/resolver.go:3: running "go": exit status 1
If we turn validation of by setting skip_validation to true then we are able to generate and run the project successfully
I would have expected the generator to respect the project module namespace and validate locally instead of on the remote server
Not sure this is required as the issue has to do with non-generated model structures and the module namespace not matching the remote repository
gqlgen version?go version?This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Did you ever find a solution to this @ikbenben?
Most helpful comment
Did you ever find a solution to this @ikbenben?