I'm following the getting started and I'm having this error:
➜ graphql go run ./server/server.go
# sample/graphql
./generated.go:285:10: ec.Tracer undefined (type *executionContext has no field or method Tracer)
./generated.go:286:10: ec.Tracer undefined (type *executionContext has no field or method Tracer)
./generated.go:299:10: ec.Tracer undefined (type *executionContext has no field or method Tracer)
./generated.go:312:10: ec.Tracer undefined (type *executionContext has no field or method Tracer)
./generated.go:362:10: ec.Tracer undefined (type *executionContext has no field or method Tracer)
./generated.go:363:10: ec.Tracer undefined (type *executionContext has no field or method Tracer)
./generated.go:370:10: ec.Tracer undefined (type *executionContext has no field or method Tracer)
./generated.go:383:10: ec.Tracer undefined (type *executionContext has no field or method Tracer)
./generated.go:422:10: ec.Tracer undefined (type *executionContext has no field or method Tracer)
./generated.go:423:10: ec.Tracer undefined (type *executionContext has no field or method Tracer)
./generated.go:423:10: too many errors
Ohh, forgot to say, I'm running this at master.
I had the same issue.
Solved it with following set of commands:
# remove current gqlgen instalaltion (dev)
rm ~/go/bin/gqlgen
rm -rf ~/go/src/github.com/99designs/gqlgen
# get gqlgen v0.6.0 source code
mkdir $GOPATH/src/github.com/99designs
cd $GOPATH/src/github.com/99designs
git clone https://github.com/99designs/gqlgen.git
cd gqlgen
git checkout tags/v0.6.0
# build v0.6.0 and move executable to gopath
go build ./main.go
mv main $GOPATH/bin/gqlgen
I ran into similar issue when using v0.6.0 and when ran
go generate ./...
Tracer implementation is in the master but not in the release - v0.6.0
generated.go has Tracer reference and hence it is failing
if you are using dep package manager please use below
[[contraint]]
name = "github.com/99designs/gqlgen"
branch = "master"
and run
dep ensure -update
to replace release version with master branch
@srk682's fix worked for me. If I correctly understand how dep works, this should not be a permanent solution since you are not actually locking your dependency, right?
Yeah, this is an issue when mixing master and versioned deps. It's been reported elsewhere. We are considering only having releases on master to get around this. We're also looking at improving the init process and perhaps deprecating the binary. If you're still having issues, hit up our gitter.
@srk682's fix also worked for me. Just a heads up its:
[[constraint]] rather than [[contraint]] 👍
I had a similar error. Dep fetched a new version of GQLParser when I update to 0.6.0. I fixed on the same GQLGen revision and works fine:
Error:
github.com/StudioSol/CifraClubID/vendor/github.com/99designs/gqlgen/codegen
vendor/github.com/99designs/gqlgen/codegen/object_build.go:107: cfg.schema.GetImplements undefined (type *"github.com/StudioSol/CifraClubID/vendor/github.com/vektah/gqlparser/ast".Schema has no field or method GetImplements)
Fix:
`
[[constraint]]
name = "github.com/vektah/gqlparser"
revision = "f119686bf1d4d1a68c7ed6afe35f183625443c41"
Most helpful comment
I ran into similar issue when using v0.6.0 and when ran
go generate ./...
Tracer implementation is in the master but not in the release - v0.6.0
generated.go has Tracer reference and hence it is failing
if you are using dep package manager please use below
[[contraint]]
name = "github.com/99designs/gqlgen"
branch = "master"
and run
dep ensure -update
to replace release version with master branch