-
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
The sample code in getting started cannot be compiled #1274
Labels
Comments
This patch makes it boot up. diff --git a/server-next/graph/schema.resolvers.go b/server-next/graph/schema.resolvers.go
index d14d5d1..ffa99c8 100644
--- a/server-next/graph/schema.resolvers.go
+++ b/server-next/graph/schema.resolvers.go
@@ -7,15 +7,18 @@ import (
"context"
"crypto/rand"
"fmt"
+ "math/big"
"github.com/ksoda/todo-app/graph/generated"
"github.com/ksoda/todo-app/graph/model"
)
func (r *mutationResolver) CreateTodo(ctx context.Context, input model.NewTodo) (*model.Todo, error) {
+ rand, _ := rand.Int(rand.Reader, big.NewInt(100))
todo := &model.Todo{
+
Text: input.Text,
- ID: fmt.Sprintf("T%d", rand.Int()),
+ ID: fmt.Sprintf("T%d", rand),
User: &model.User{ID: input.UserID, Name: "user " + input.UserID},
}
r.todos = append(r.todos, todo) |
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. |
Simply import |
dangolbeeker
added a commit
to dangolbeeker/gqlgen-todos
that referenced
this issue
May 10, 2021
chaitanyapantheor
added a commit
to chaitanyamaili/gqlgen
that referenced
this issue
Oct 25, 2022
Here is the fix PR #2411 |
StevenACoffman
pushed a commit
that referenced
this issue
Nov 4, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What happened?
The following command failed. This happens when you implement the code according to Implement the resolvers
What did you expect?
The server is successfully started.
Minimal graphql.schema and models to reproduce
graphql.schema and models
versions
gqlgen version
: v0.11.3go version
: go version go1.13.8 linux/amd64The text was updated successfully, but these errors were encountered: