Skip to content

Commit 026c126

Browse files
committed
fix lint
1 parent 5e56fca commit 026c126

File tree

12 files changed

+75
-29
lines changed

12 files changed

+75
-29
lines changed

client/client.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ import (
66
"encoding/json"
77
"net/http"
88

9-
"golang.org/x/xerrors"
10-
119
"github.com/Yamashou/gqlgenc/graphqljson"
10+
"golang.org/x/xerrors"
1211
)
1312

1413
type HTTPRequestOption func(req *http.Request)

clientgen/query.go

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ func QueryDocumentsByOperations(schema *ast.Schema, operations ast.OperationList
5454
func fragmentsInOperationDefinition(operation *ast.OperationDefinition) ast.FragmentDefinitionList {
5555
fragments := fragmentsInOperationWalker(operation.SelectionSet)
5656
uniqueFragments := fragmentsUnique(fragments)
57+
5758
return uniqueFragments
5859
}
5960

clientgen/source.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@ import (
55
"fmt"
66
"go/types"
77

8-
"golang.org/x/xerrors"
9-
108
"github.com/99designs/gqlgen/codegen/templates"
11-
12-
"github.com/vektah/gqlparser/v2/formatter"
13-
149
"github.com/vektah/gqlparser/v2/ast"
10+
"github.com/vektah/gqlparser/v2/formatter"
11+
"golang.org/x/xerrors"
1512
)
1613

1714
type Source struct {
@@ -119,6 +116,7 @@ func queryString(queryDocument *ast.QueryDocument) string {
119116
var buf bytes.Buffer
120117
astFormatter := formatter.NewFormatter(&buf)
121118
astFormatter.FormatQueryDocument(queryDocument)
119+
122120
return buf.String()
123121
}
124122

@@ -190,5 +188,6 @@ func getResponseStructName(operation *ast.OperationDefinition) string {
190188
if operation.Operation == ast.Mutation {
191189
return fmt.Sprintf("%sPayload", operation.Name)
192190
}
191+
193192
return operation.Name
194193
}

clientgen/source_generator.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ import (
55
"go/types"
66
"strings"
77

8-
"golang.org/x/xerrors"
9-
10-
"github.com/99designs/gqlgen/codegen/templates"
11-
128
"github.com/99designs/gqlgen/codegen/config"
9+
"github.com/99designs/gqlgen/codegen/templates"
1310
"github.com/vektah/gqlparser/v2/ast"
11+
"golang.org/x/xerrors"
1412
)
1513

1614
type Argument struct {
@@ -158,6 +156,7 @@ func (r *SourceGenerator) NewResponseField(selection ast.Selection) *ResponseFie
158156
fieldsResponseFields.StructType(),
159157
nil,
160158
)
159+
161160
return &ResponseField{
162161
Name: selection.Name,
163162
Type: typ,
@@ -168,6 +167,7 @@ func (r *SourceGenerator) NewResponseField(selection ast.Selection) *ResponseFie
168167
case *ast.InlineFragment:
169168
// InlineFragmentは子要素をそのままstructとしてもつので、ここで、構造体の型を作成します
170169
fieldsResponseFields := r.NewResponseFields(selection.SelectionSet)
170+
171171
return &ResponseField{
172172
Name: selection.TypeCondition,
173173
Type: fieldsResponseFields.StructType(),

config/config.go

+6-8
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,12 @@ import (
77
"os"
88
"path/filepath"
99

10-
"golang.org/x/xerrors"
11-
12-
"github.com/vektah/gqlparser/v2/validator"
13-
14-
"github.com/vektah/gqlparser/v2/ast"
15-
10+
"github.com/99designs/gqlgen/codegen/config"
1611
"github.com/Yamashou/gqlgenc/client"
1712
"github.com/Yamashou/gqlgenc/introspection"
18-
19-
"github.com/99designs/gqlgen/codegen/config"
13+
"github.com/vektah/gqlparser/v2/ast"
14+
"github.com/vektah/gqlparser/v2/validator"
15+
"golang.org/x/xerrors"
2016
"gopkg.in/yaml.v2"
2117
)
2218

@@ -53,6 +49,7 @@ func findCfg(fileName string) (string, error) {
5349

5450
func findCfgInDir(dir, fileName string) string {
5551
path := filepath.Join(dir, fileName)
52+
5653
return path
5754
}
5855

@@ -107,6 +104,7 @@ func (c *Config) LoadSchema(ctx context.Context) error {
107104
}
108105

109106
c.GQLConfig.Schema = schema
107+
110108
return nil
111109
}
112110

generator/generater.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ package generator
33
import (
44
"context"
55

6-
"golang.org/x/xerrors"
7-
86
"github.com/99designs/gqlgen/api"
97
"github.com/99designs/gqlgen/plugin"
108
"github.com/99designs/gqlgen/plugin/modelgen"
11-
129
"github.com/Yamashou/gqlgenc/config"
10+
"golang.org/x/xerrors"
1311
)
1412

1513
func Generate(ctx context.Context, cfg *config.Config, option ...api.Option) error {

go.mod

+10-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,18 @@ module github.com/Yamashou/gqlgenc
33
go 1.14
44

55
require (
6-
github.com/99designs/gqlgen v0.11.3
6+
github.com/99designs/gqlgen v0.12.2
7+
github.com/agnivade/levenshtein v1.1.0 // indirect
8+
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
79
github.com/google/go-cmp v0.5.0
10+
github.com/hashicorp/golang-lru v0.5.4 // indirect
11+
github.com/matryer/moq v0.0.0-20200816112511-720d53e65d2f // indirect
12+
github.com/mitchellh/mapstructure v1.3.3 // indirect
813
github.com/pkg/errors v0.9.1 // indirect
14+
github.com/urfave/cli/v2 v2.2.0 // indirect
15+
github.com/vektah/dataloaden v0.3.0 // indirect
916
github.com/vektah/gqlparser/v2 v2.0.1
10-
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
17+
golang.org/x/tools v0.0.0-20200827010519-17fd2f27a9e3 // indirect
18+
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
1119
gopkg.in/yaml.v2 v2.3.0
1220
)

go.sum

+37
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
github.com/99designs/gqlgen v0.11.3 h1:oFSxl1DFS9X///uHV3y6CEfpcXWrDUxVblR4Xib2bs4=
22
github.com/99designs/gqlgen v0.11.3/go.mod h1:RgX5GRRdDWNkh4pBrdzNpNPFVsdoUFY2+adM6nb1N+4=
3+
github.com/99designs/gqlgen v0.12.2 h1:aOdpsiCycFtCnAv8CAI1exnKrIDHMqtMzQoXeTziY4o=
4+
github.com/99designs/gqlgen v0.12.2/go.mod h1:7zdGo6ry9u1YBp/qlb2uxSU5Mt2jQKLcBETQiKk+Bxo=
35
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
46
github.com/agnivade/levenshtein v1.0.1 h1:3oJU7J3FGFmyhn8KHjmVaZCN5hxTr7GxgRue+sxIXdQ=
57
github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM=
68
github.com/agnivade/levenshtein v1.0.3 h1:M5ZnqLOoZR8ygVq0FfkXsNOKzMCk0xRiow0R5+5VkQ0=
79
github.com/agnivade/levenshtein v1.0.3/go.mod h1:4SFRZbbXWLF4MU1T9Qg0pGgH3Pjs+t6ie5efyrwRJXs=
10+
github.com/agnivade/levenshtein v1.1.0 h1:n6qGwyHG61v3ABce1rPVZklEYRT8NFpCMrpZdBUbYGM=
11+
github.com/agnivade/levenshtein v1.1.0/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo=
812
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ=
913
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
1014
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q=
1115
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE=
1216
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
1317
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
18+
github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=
19+
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
1420
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1521
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
1622
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1723
github.com/dgryski/trifles v0.0.0-20190318185328-a8d75aae118c h1:TUuUh0Xgj97tLMNtWtNvI9mIV6isjEb9lBMNv+77IGM=
1824
github.com/dgryski/trifles v0.0.0-20190318185328-a8d75aae118c/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA=
25+
github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA=
1926
github.com/go-chi/chi v3.3.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
2027
github.com/gogo/protobuf v1.0.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
2128
github.com/google/go-cmp v0.4.1 h1:/exdXoGamhu5ONeUJH0deniYLWYvQwW66yvlfiiKTu0=
@@ -26,8 +33,12 @@ github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f/go.mod h1:kBGZzfjB
2633
github.com/gorilla/mux v1.6.1/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
2734
github.com/gorilla/websocket v1.2.0 h1:VJtLvh6VQym50czpZzx07z/kw9EgAxI3x1ZB8taTMQQ=
2835
github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
36+
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
37+
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
2938
github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo=
3039
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
40+
github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
41+
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
3142
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
3243
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
3344
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
@@ -36,12 +47,16 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
3647
github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
3748
github.com/matryer/moq v0.0.0-20200106131100-75d0ddfc0007 h1:reVOUXwnhsYv/8UqjvhrMOu5CNT9UapHFLbQ2JcXsmg=
3849
github.com/matryer/moq v0.0.0-20200106131100-75d0ddfc0007/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ=
50+
github.com/matryer/moq v0.0.0-20200816112511-720d53e65d2f h1:EEW57stILKCHn/FUfjq6D5gZtciD/SbRxGZk4bfDpD4=
51+
github.com/matryer/moq v0.0.0-20200816112511-720d53e65d2f/go.mod h1:9RtPYjTnH1bSBIkpvtHkFN7nbWAnO7oRpdJkEIn6UtE=
3952
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
4053
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
4154
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
4255
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
4356
github.com/mitchellh/mapstructure v0.0.0-20180203102830-a4e142e9c047 h1:zCoDWFD5nrJJVjbXiDZcVhOBSzKn3o9LgRLLMRNuru8=
4457
github.com/mitchellh/mapstructure v0.0.0-20180203102830-a4e142e9c047/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
58+
github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8=
59+
github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
4560
github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74=
4661
github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg=
4762
github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
@@ -53,6 +68,7 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
5368
github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
5469
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
5570
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
71+
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
5672
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
5773
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
5874
github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
@@ -61,34 +77,55 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeV
6177
github.com/shurcooL/vfsgen v0.0.0-20180121065927-ffb13db8def0/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
6278
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
6379
github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
80+
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
6481
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
6582
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
6683
github.com/urfave/cli/v2 v2.1.1 h1:Qt8FeAtxE/vfdrLmR3rxR6JRE0RoVmbXu8+6kZtYU4k=
6784
github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ=
85+
github.com/urfave/cli/v2 v2.2.0 h1:JTTnM6wKzdA0Jqodd966MVj4vWbbquZykeX1sKbe2C4=
86+
github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ=
6887
github.com/vektah/dataloaden v0.2.1-0.20190515034641-a19b9a6e7c9e h1:+w0Zm/9gaWpEAyDlU1eKOuk5twTjAjuevXqcJJw8hrg=
6988
github.com/vektah/dataloaden v0.2.1-0.20190515034641-a19b9a6e7c9e/go.mod h1:/HUdMve7rvxZma+2ZELQeNh88+003LL7Pf/CZ089j8U=
89+
github.com/vektah/dataloaden v0.3.0 h1:ZfVN2QD6swgvp+tDqdH/OIT/wu3Dhu0cus0k5gIZS84=
90+
github.com/vektah/dataloaden v0.3.0/go.mod h1:/HUdMve7rvxZma+2ZELQeNh88+003LL7Pf/CZ089j8U=
91+
github.com/vektah/gqlparser v1.3.1 h1:8b0IcD3qZKWJQHSzynbDlrtP3IxVydZ2DZepCGofqfU=
92+
github.com/vektah/gqlparser v1.3.1/go.mod h1:bkVf0FX+Stjg/MHnm8mEyubuaArhNEqfQhF+OTiAL74=
7093
github.com/vektah/gqlparser/v2 v2.0.1 h1:xgl5abVnsd4hkN9rk65OJID9bfcLSMuTaTcZj777q1o=
7194
github.com/vektah/gqlparser/v2 v2.0.1/go.mod h1:SyUiHgLATUR8BiYURfTirrTcGpcE+4XkV2se04Px1Ms=
95+
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
7296
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
7397
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
98+
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
7499
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
100+
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
101+
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
75102
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
76103
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
77104
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
105+
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
78106
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
107+
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
79108
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
80109
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
81110
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
82111
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
112+
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
83113
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
84114
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
85115
golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
86116
golang.org/x/tools v0.0.0-20190515012406-7d7faa4812bd/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
117+
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
87118
golang.org/x/tools v0.0.0-20200114235610-7ae403b6b589 h1:rjUrONFu4kLchcZTfp3/96bR8bW8dIa8uz3cR5n0cgM=
88119
golang.org/x/tools v0.0.0-20200114235610-7ae403b6b589/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
120+
golang.org/x/tools v0.0.0-20200815165600-90abf76919f3/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
121+
golang.org/x/tools v0.0.0-20200827010519-17fd2f27a9e3 h1:r3P/5xOq/dK1991B65Oy6E1fRF/2d/fSYZJ/fXGVfJc=
122+
golang.org/x/tools v0.0.0-20200827010519-17fd2f27a9e3/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
123+
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
89124
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
90125
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
91126
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
127+
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
128+
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
92129
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
93130
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
94131
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

graphqljson/graphql.go

+6
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ func (d *Decoder) decode() error {
300300
return xerrors.New("unexpected token in JSON input")
301301
}
302302
}
303+
303304
return nil
304305
}
305306

@@ -319,6 +320,7 @@ func (d *Decoder) state() json.Delim {
319320
if len(d.parseState) == 0 {
320321
return 0
321322
}
323+
322324
return d.parseState[len(d.parseState)-1]
323325
}
324326

@@ -346,6 +348,7 @@ func fieldByGraphQLName(v reflect.Value, name string) reflect.Value {
346348
return v.Field(i)
347349
}
348350
}
351+
349352
return reflect.Value{}
350353
}
351354

@@ -368,6 +371,7 @@ func hasGraphQLName(f reflect.StructField, name string) bool {
368371
if i := strings.Index(value, ":"); i != -1 {
369372
value = value[:i]
370373
}
374+
371375
return strings.TrimSpace(value) == name
372376
}
373377

@@ -378,6 +382,7 @@ func isGraphQLFragment(f reflect.StructField) bool {
378382
return false
379383
}
380384
value = strings.TrimSpace(value) // TODO: Parse better.
385+
381386
return strings.HasPrefix(value, "...")
382387
}
383388

@@ -389,6 +394,7 @@ func unmarshalValue(value json.Token, v reflect.Value) error {
389394
if err != nil {
390395
return xerrors.Errorf(": %w", err)
391396
}
397+
392398
return json.Unmarshal(b, v.Addr().Interface())
393399
}
394400

graphqljson/graphql_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import (
44
"testing"
55
"time"
66

7-
"github.com/google/go-cmp/cmp"
8-
97
"github.com/Yamashou/gqlgenc/graphqljson"
8+
"github.com/google/go-cmp/cmp"
109
)
1110

1211
func TestUnmarshalGraphQL(t *testing.T) {

introspection/parse.go

+3
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ func parseOperationTypeDefinitionForQuery(fullType *FullType) *ast.OperationType
3838
var op ast.OperationTypeDefinition
3939
op.Operation = ast.Query
4040
op.Type = *fullType.Name
41+
4142
return &op
4243
}
4344

4445
func parseOperationTypeDefinitionForMutation(fullType *FullType) *ast.OperationTypeDefinition {
4546
var op ast.OperationTypeDefinition
4647
op.Operation = ast.Mutation
4748
op.Type = *fullType.Name
49+
4850
return &op
4951
}
5052

@@ -279,6 +281,7 @@ func getType(typeRef *TypeRef) *ast.Type {
279281
}
280282
nullableType := getType(nullableRef)
281283
nullableType.NonNull = true
284+
282285
return nullableType
283286
}
284287

main.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ import (
55
"fmt"
66
"os"
77

8-
"github.com/Yamashou/gqlgenc/generator"
9-
108
"github.com/99designs/gqlgen/api"
11-
129
"github.com/Yamashou/gqlgenc/clientgen"
1310
"github.com/Yamashou/gqlgenc/config"
11+
"github.com/Yamashou/gqlgenc/generator"
1412
)
1513

1614
func main() {

0 commit comments

Comments
 (0)