99designs / 99designs/gqlgen

Panic if type name "Subscription"

Đang mở
#957 5 bình luận 1 reaction 0 người được giao Xem trên GitHub
accepted
Ngôn ngữ chính
Go
Star
10.8k
Fork
1.3k
Merge trung bình
2 ngày 36 phút
Pull request đã merge (30 ngày)
26

Mô tả

### What happened?
A panic occurs if define type of Subscription
```
type Subscription implements Node {
id: ID!
userID: ID!
name: String!
deadline: Int!
createdAt: Int!
updatedAt: Int!
}

type Query {
findSubscription(name:String!): Subscription
}
```
```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x130447d]

goroutine 1 [running]:
github.com/99designs/gqlgen/codegen/config.(*TypeReference).IsPtr(...)
/Users/foo/go/pkg/mod/github.com/99designs/gqlgen@v0.10.2/codegen/config/binder.go:255
github.com/99designs/gqlgen/codegen.(*builder).buildField(0xc0002dd5d0, 0xc000627600, 0xc000167c00, 0x0, 0x1b189e0, 0x0)
/Users/foo/go/pkg/mod/github.com/99designs/gqlgen@v0.10.2/codegen/field.go:70 +0x35d
github.com/99designs/gqlgen/codegen.(*builder).buildObject(0xc0002dd5d0, 0xc0001d6900, 0x1618581, 0x6, 0x0)
/Users/foo/go/pkg/mod/github.com/99designs/gqlgen@v0.10.2/codegen/object.go:73 +0x4ec
github.com/99designs/gqlgen/codegen.BuildData(0xc0001b8000, 0x16fbc60, 0x1b17d80, 0x0)
/Users/foo/go/pkg/mod/github.com/99designs/gqlgen@v0.10.2/codegen/data.go:89 +0x4a7
github.com/99designs/gqlgen/api.Generate(0xc0001b8000, 0x0, 0x0, 0x0, 0x0, 0xc0000a2006)
/Users/foo/go/pkg/mod/github.com/99designs/gqlgen@v0.10.2/api/generate.go:41 +0x276
github.com/99designs/gqlgen/cmd.glob..func1(0xc0001b6000)
/Users/foo/go/pkg/mod/github.com/99designs/gqlgen@v0.10.2/cmd/gen.go:39 +0xa2
github.com/urfave/cli.HandleAction(0x1553e60, 0x1659b50, 0xc0001b6000, 0xc0001b6000, 0x0)
/Users/foo/go/pkg/mod/github.com/urfave/cli@v1.22.2/app.go:525 +0x127
github.com/urfave/cli.Command.Run(0x161d37a, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1649e4f, 0x29, 0x0, ...)
/Users/foo/go/pkg/mod/github.com/urfave/cli@v1.22.2/command.go:174 +0x521
github.com/urfave/cli.(*App).Run(0xc000102540, 0xc00000e080, 0x2, 0x2, 0x0, 0x0)
/Users/foo/go/pkg/mod/github.com/urfave/cli@v1.22.2/app.go:276 +0x729
github.com/99designs/gqlgen/cmd.Execute()
/Users/foo/go/pkg/mod/github.com/99designs/gqlgen@v0.10.2/cmd/root.go:40 +0x224
main.main()
/Users/foo/go/pkg/mod/github.com/99designs/gqlgen@v0.10.2/main.go:8 +0x20
```
### What did you expect?
No Panic and generate code

### Minimal graphql.schema and models to reproduce
```
type Subscription {
id: ID!
userID: ID!
createdAt: Int!
updatedAt: Int!
}
```
### versions
- `gqlgen version`?
v0.10.2
- `go version`?
go version go1.12.9 darwin/amd64
- dep or go modules?
go modules

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.