Picking some nits that my IDE complained about (#91)
* Picking some nits that my IDE complained about Signed-off-by: Steve Coffman <steve@khanacademy.org> * Update graphql/util.go Co-authored-by: Ben Kraft <benkraft@khanacademy.org> * revert to original for comment Signed-off-by: Steve Coffman <steve@khanacademy.org> Co-authored-by: Ben Kraft <benkraft@khanacademy.org>
This commit is contained in:
+1
-1
@@ -13,7 +13,7 @@ csilvers is Craig Silverstein
|
|||||||
|
|
||||||
## Running genqlient
|
## Running genqlient
|
||||||
|
|
||||||
It's already checked in to github, but to regenerate `generated.go`:
|
It's already checked in to GitHub, but to regenerate `generated.go`:
|
||||||
```sh
|
```sh
|
||||||
go generate ./...
|
go generate ./...
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
example "github.com/Khan/genqlient/example"
|
"github.com/Khan/genqlient/example"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
+2
-2
@@ -90,7 +90,7 @@ func (g *generator) convertInputType(
|
|||||||
options, queryOptions *genqlientDirective,
|
options, queryOptions *genqlientDirective,
|
||||||
) (goType, error) {
|
) (goType, error) {
|
||||||
// note prefix is ignored here (see generator.typeName), as is selectionSet
|
// note prefix is ignored here (see generator.typeName), as is selectionSet
|
||||||
// (for input types we use the whole thing)).
|
// (for input types we use the whole thing).
|
||||||
return g.convertType(nil, typ, nil, options, queryOptions)
|
return g.convertType(nil, typ, nil, options, queryOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -463,7 +463,7 @@ func (g *generator) convertInlineFragment(
|
|||||||
containingTypedef *ast.Definition,
|
containingTypedef *ast.Definition,
|
||||||
queryOptions *genqlientDirective,
|
queryOptions *genqlientDirective,
|
||||||
) ([]*goStructField, error) {
|
) ([]*goStructField, error) {
|
||||||
// You might think fragmentTypedef would be fragment.ObjectDefinition, but
|
// You might think fragmentTypedef would be a fragment.ObjectDefinition, but
|
||||||
// actually that's the type into which the fragment is spread.
|
// actually that's the type into which the fragment is spread.
|
||||||
fragmentTypedef := g.schema.Types[fragment.TypeCondition]
|
fragmentTypedef := g.schema.Types[fragment.TypeCondition]
|
||||||
if !fragmentMatches(containingTypedef, fragmentTypedef) {
|
if !fragmentMatches(containingTypedef, fragmentTypedef) {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type descriptionInfo struct {
|
|||||||
CommentOverride string
|
CommentOverride string
|
||||||
// name of the corresponding GraphQL type
|
// name of the corresponding GraphQL type
|
||||||
GraphQLName string
|
GraphQLName string
|
||||||
// GraphQL description of the type .GraphQLName, if any
|
// GraphQL schema's description of the type .GraphQLName, if any
|
||||||
GraphQLDescription string
|
GraphQLDescription string
|
||||||
// name of the corresponding GraphQL fragment (on .GraphQLName), if any
|
// name of the corresponding GraphQL fragment (on .GraphQLName), if any
|
||||||
FragmentName string
|
FragmentName string
|
||||||
|
|||||||
+1
-1
@@ -245,7 +245,7 @@ func (typ *goInterfaceType) WriteDefinition(w io.Writer, g *generator) error {
|
|||||||
"Get%s is a part of, and documented with, the interface %s.",
|
"Get%s is a part of, and documented with, the interface %s.",
|
||||||
sharedField.GoName, typ.GoName)
|
sharedField.GoName, typ.GoName)
|
||||||
writeDescription(w, description)
|
writeDescription(w, description)
|
||||||
// In principle we should find the corresponding field of the
|
// In principle, we should find the corresponding field of the
|
||||||
// implementation and use its name in `v.<name>`. In practice,
|
// implementation and use its name in `v.<name>`. In practice,
|
||||||
// they're always the same.
|
// they're always the same.
|
||||||
fmt.Fprintf(w, "func (v *%s) Get%s() %s { return v.%s }\n",
|
fmt.Fprintf(w, "func (v *%s) Get%s() %s { return v.%s }\n",
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/vektah/gqlparser/v2/gqlerror"
|
"github.com/vektah/gqlparser/v2/gqlerror"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Client is the interface that the generate code calls into to actually make
|
// Client is the interface that the generated code calls into to actually make
|
||||||
// requests.
|
// requests.
|
||||||
//
|
//
|
||||||
// Unstable: This interface is likely to change before v1.0, see #19.
|
// Unstable: This interface is likely to change before v1.0, see #19.
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ package graphql
|
|||||||
// NoUnmarshalJSON is intended for the use of genqlient's generated code only.
|
// NoUnmarshalJSON is intended for the use of genqlient's generated code only.
|
||||||
//
|
//
|
||||||
// It is used to prevent a struct type from inheriting its embed's
|
// It is used to prevent a struct type from inheriting its embed's
|
||||||
// UnmarshalJSON method: given a type
|
// UnmarshalJSON method, so if we construct a type:
|
||||||
// type T struct { E; NoUnmarshalJSON }
|
// type T struct { E; NoUnmarshalJSON }
|
||||||
// where E has an UnmarshalJSON method, T will not inherit it, per the Go
|
// where E has an UnmarshalJSON method, T will not inherit it, per the Go
|
||||||
// selector rules: https://golang.org/ref/spec#Selectors.
|
// selector rules: https://golang.org/ref/spec#Selectors.
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ func TestInterfaceListPointerField(t *testing.T) {
|
|||||||
assert.Equal(t, "Yours Truly", (*resp.Beings[0]).GetName())
|
assert.Equal(t, "Yours Truly", (*resp.Beings[0]).GetName())
|
||||||
|
|
||||||
user, ok := (*resp.Beings[0]).(*queryWithInterfaceListPointerFieldBeingsUser)
|
user, ok := (*resp.Beings[0]).(*queryWithInterfaceListPointerFieldBeingsUser)
|
||||||
require.Truef(t, ok, "got %T, not User", (*resp.Beings[0]))
|
require.Truef(t, ok, "got %T, not User", *resp.Beings[0])
|
||||||
assert.Equal(t, "1", user.Id)
|
assert.Equal(t, "1", user.Id)
|
||||||
assert.Equal(t, "Yours Truly", user.Name)
|
assert.Equal(t, "Yours Truly", user.Name)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user