vektah / dataloaden

go generate based DataLoader
MIT License
530 stars 79 forks source link

Support package names other than directory base path name #3

Closed dvic closed 6 years ago

dvic commented 6 years ago

This PR changes how the output package name is chosen. Instead of using the base path, it first checks if there is a go file in the working directory and uses that package name. In this way, the generated file will contain the correct package name if it is different than the base path (which is allowed in Go).

dvic commented 6 years ago

By the way, I think https://github.com/vektah/gqlgen also has the same issue, I guess we should also fix it there?

vektah commented 6 years ago

Thanks for this, yeah theres an open issue for the gqlgen side but its going to be a bit more complicated because there are some circular data requirements https://github.com/vektah/gqlgen/issues/114.