Skip to content

Commit 1ee8380

Browse files
authored
Merge pull request #299 from gqlgo/fix-linter-1
refactor(clientgenv2): optimize slice initialization with capacity
2 parents a879099 + ddcea5f commit 1ee8380

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

clientgenv2/source_generator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ func (rs ResponseFieldList) IsFragmentSpread() bool {
4646
}
4747

4848
func (rs ResponseFieldList) StructType() *types.Struct {
49-
vars := make([]*types.Var, 0)
50-
structTags := make([]string, 0)
49+
vars := make([]*types.Var, 0, len(rs))
50+
structTags := make([]string, 0, len(rs))
5151

5252
for _, field := range rs {
5353
vars = append(vars, types.NewVar(0, nil, templates.ToGo(field.Name), field.Type))

clientv2/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ func parseMultipartFiles(
312312
case []*graphql.Upload:
313313
vars[k] = make([]struct{}, len(item))
314314

315-
var groupFiles []MultipartFile
315+
groupFiles := make([]MultipartFile, 0, len(item))
316316

317317
for itemI, itemV := range item {
318318
iStr := strconv.Itoa(i)

0 commit comments

Comments
 (0)