gqlgen requires a go mod tidy which isn't possible
- Langage dominant
- Go
- Étoiles
- 10.8k
- Forks
- 1.3k
- Merge moyen
- 2 j 36 min
- PR mergées (30 j)
- 26
Description
### What happened?
I run `gqlgen` (installed in `home/go/bin`) and reveive this error:
```
modelgen: package could not be loaded: github.com/99designs/gqlgen/graphql.Boolean: packages.Load: err: exit status 1: stderr: go: updates to go.mod needed; to update it:
go mod tidy
```
Therefore, I run `go mod tidy`, which fails with:
```
github.com/my_company/my_project/internal/cli imports
github.com/my_company/my_project/internal/app/graphql: no matching versions for query "latest"
github.com/my_company/my_project/eventing imports
github.com/my_company/my_project/internal/graphql/models: no matching versions for query "latest"
```
I guess that's b/c `internal/app/graphql` and `internal/graphql/models` don't exist yet (I want `gqlgen` to create files here).
I recall that in the past I solved that problem somehow by flddling with `get get -u` commands, but after reinstalling Ubuntu this time I don't really manage it. I'ld also love to understand what the problem actually is instead of just mindlessly hammering some commands. ;)
When I can create the imported module by hand with an empty dummy file in it, `go mod tidy` works, and so does `gqlgen` afterward. Maybe it would make help if `gqlgen` created its target files before it call `go mod tidy`?
### What did you expect?
Ideally, `gqlgen` generates the file without requiring `go mod tidy`, or I can run `go mod tidy` first (if that solved the issue).
### Minimal graphql.schema and models to reproduce
`graphql.schema`:
```yaml
schema: api/my_entity.graphqls
exec:
filename: internal/app/graphql/gql_exec_gen.go
package: graphql
model:
filename: internal/graphql/models/models_gen.go
package: models
resolver:
filename: internal/graphql/resolver.go
type: Resolver
package: graphql
```
`api/my_entity.graphqls`:
```graphql
type MyEntitiy {
id: ID!
}
type Query {
myEntity(id: ID!): MyEntity
}
```
### versions
github.com/99designs/gqlgen v0.17.32
go1.20.5 linux/amd64
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.