Skip to content

Commit 885bd3d

Browse files
author
Zephaniah E. Loss-Cutler-Hull
committed
Make seen use fieldName instead of colName.
fieldName is after any mangilng to make it fit go variable standards, and since that is the name that we are actually using, that is the name that we should be checking for conflicts. This only matters when we have multiple fields that differ only by things that are changed when we are converting to the go variable standards.
1 parent ba20104 commit 885bd3d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

internal/codegen/golang/result.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ func columnsToStruct(r *compiler.Result, name string, columns []goColumn, settin
252252
suffix := 0
253253
if o, ok := suffixes[c.id]; ok && useID {
254254
suffix = o
255-
} else if v := seen[colName]; v > 0 {
255+
} else if v := seen[fieldName]; v > 0 {
256256
suffix = v + 1
257257
}
258258
suffixes[c.id] = suffix
@@ -272,7 +272,8 @@ func columnsToStruct(r *compiler.Result, name string, columns []goColumn, settin
272272
Type: goType(r, c.Column, settings),
273273
Tags: tags,
274274
})
275-
seen[colName]++
275+
seen[fieldName]++
276276
}
277+
277278
return &gs
278279
}

0 commit comments

Comments
 (0)