-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Getting Started Documentation — No Binary Approach #416
Conversation
docs/content/getting-started.md
Outdated
At the top of our resolvers.go a go generate command was added that looks like this: | ||
```go | ||
//go:generate gorunpkg github.com/99designs/gqlgen | ||
//go:generate go run ./scripts/gqlgen.go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you update the template for resolvers.go?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah interesting. Yeah what should we do there? We can't assume users will have a script to run at scripts/gqlgen.go
.
@@ -9,6 +9,9 @@ import ( | |||
"github.com/99designs/gqlgen/graphql" | |||
"github.com/99designs/gqlgen/internal/gopath" | |||
"github.com/urfave/cli" | |||
|
|||
// Required since otherwise dep will prune away these unused packages before codegen has a chance to run | |||
_ "github.com/99designs/gqlgen/handler" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be enough to get init
to run cleanly. Attempting to run server/server.go
afterwards however still requires some additional deps (websockets I think). So I added a dep ensure
after gqlgen init
in the docs.
Is it possible to add an explanation to what This is not unlikely to be the first run in with To my understanding it runs go generate in all subdirectories so I think it would help to alleviate some confusion to just have a short explaination like:
|
@emil-nasso yeah I think that's a fair comment. I'll add a note. |
docs/content/getting-started.md
Outdated
@@ -88,22 +117,27 @@ type Todo struct { | |||
} | |||
``` | |||
|
|||
And then tell gqlgen to use this new struct by adding this to the gqlgen.yml: | |||
Next tell gqlgen to use this new struct by adding it to `gqlgen.yml`: | |||
|
|||
```yaml | |||
models: | |||
Todo: | |||
model: github.com/vektah/gqlgen-tutorials/gettingstarted.Todo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Earlier the doc says:
mkdir -p $GOPATH/src/github.com/[username]/gqlgen-todos
So I think this doesn't match. Probably should be:
model: github.com/[username]/gqlgen-todos.Todo
docs/content/getting-started.md
Outdated
```bash | ||
rm resolvers.go | ||
gqlgen | ||
$ rm resolvers.go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, this is resolver.go
no resolvers.go
``` | ||
|
||
Now we just need to fill in the `not implemented` parts | ||
|
||
Now we just need to fill in the `not implemented` parts. Update `graph/graph.go` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think (for me) this should be "Update resolver.go
"
docs/content/getting-started.md
Outdated
rm ~/go/bin/gqlgen | ||
rm -rf ~/go/src/github.com/99designs/gqlgen | ||
``` | ||
At the top of our `resolvers.go` add the following line: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolvers.go
-> resolver.go
(based on my experience)
Hey thanks for this project and this PR. This updated documentation really helped me get started. I created a new project and set my
And then ran through the Getting Started guide. Overall, was successful and the new docs helped. I noticed a couple of discrepancies, so I added some commends to the PR. Hope that's helpful! Thanks again. |
@samjbobb thanks for the input. I think your comments are correct and I'll have a fix in place before this goes out. Just an update for anyone else wanting this to be merged: since these docs use |
ca1c6c5
to
b9fbb64
Compare
Improve Getting Started Documentation — No Binary Approach
Addresses #408 — this is a set of improvements to the getting started documentation. The main change is deprecating using a global binary, and moving to always using
dep
to ensure users have a consistent version.#415 discusses the whys for this approach.