@@ -178,35 +178,35 @@ func createCsvDiff(diffFile *DiffFile, baseReader *csv.Reader, headReader *csv.R
178
178
}
179
179
180
180
for i := 0 ; i < len (a2b ); i ++ {
181
- acell , ae := getCell (arow , i )
181
+ aCell , aErr := getCell (arow , i )
182
182
183
183
if a2b [i ] == unmappedColumn {
184
- cells [i ] = & TableDiffCell {LeftCell : acell , Type : TableDiffCellDel }
184
+ cells [i ] = & TableDiffCell {LeftCell : aCell , Type : TableDiffCellDel }
185
185
} else {
186
- bcell , be := getCell (brow , a2b [i ])
187
-
188
- var celltype TableDiffCellType
189
- if ae != nil {
190
- celltype = TableDiffCellAdd
191
- } else if be != nil {
192
- celltype = TableDiffCellDel
193
- } else if acell == bcell {
194
- celltype = TableDiffCellEqual
186
+ bCell , bErr := getCell (brow , a2b [i ])
187
+
188
+ var cellType TableDiffCellType
189
+ if aErr != nil {
190
+ cellType = TableDiffCellAdd
191
+ } else if bErr != nil {
192
+ cellType = TableDiffCellDel
193
+ } else if aCell == bCell {
194
+ cellType = TableDiffCellEqual
195
195
} else {
196
- celltype = TableDiffCellChanged
196
+ cellType = TableDiffCellChanged
197
197
}
198
198
199
- cells [i ] = & TableDiffCell {LeftCell : acell , RightCell : bcell , Type : celltype }
199
+ cells [i ] = & TableDiffCell {LeftCell : aCell , RightCell : bCell , Type : cellType }
200
200
}
201
201
}
202
202
cellsIndex := 0
203
203
for i := 0 ; i < len (b2a ); i ++ {
204
204
if b2a [i ] == unmappedColumn {
205
- bcell , _ := getCell (brow , i )
205
+ bCell , _ := getCell (brow , i )
206
206
if cells [cellsIndex ] != nil && len (cells ) >= cellsIndex + 1 {
207
207
copy (cells [cellsIndex + 1 :], cells [cellsIndex :])
208
208
}
209
- cells [cellsIndex ] = & TableDiffCell {RightCell : bcell , Type : TableDiffCellAdd }
209
+ cells [cellsIndex ] = & TableDiffCell {RightCell : bCell , Type : TableDiffCellAdd }
210
210
} else if cellsIndex < b2a [i ] {
211
211
cellsIndex = b2a [i ]
212
212
}
@@ -300,9 +300,9 @@ func tryMapColumnsByContent(a *csvReader, a2b []int, b *csvReader, b2a []int) {
300
300
rows := util .Min (maxRowsToInspect , util .Max (0 , util .Min (len (a .buffer ), len (b .buffer ))- 1 ))
301
301
same := 0
302
302
for j := 1 ; j <= rows ; j ++ {
303
- acell , ea := getCell (a .buffer [j ], i )
304
- bcell , eb := getCell (b .buffer [j ], bStart )
305
- if ea == nil && eb == nil && acell == bcell {
303
+ aCell , aErr := getCell (a .buffer [j ], i )
304
+ bCell , bErr := getCell (b .buffer [j ], bStart )
305
+ if aErr == nil && bErr == nil && aCell == bCell {
306
306
same ++
307
307
}
308
308
}
0 commit comments