@@ -190,9 +190,11 @@ var (
190
190
codeTagSuffix = []byte (`</span>` )
191
191
)
192
192
193
- var unfinishedtagRegex = regexp .MustCompile (`<[^>]*$` )
194
- var trailingSpanRegex = regexp .MustCompile (`<span\s*[[:alpha:]="]*?[>]?$` )
195
- var entityRegex = regexp .MustCompile (`&[#]*?[0-9[:alpha:]]*$` )
193
+ var (
194
+ unfinishedtagRegex = regexp .MustCompile (`<[^>]*$` )
195
+ trailingSpanRegex = regexp .MustCompile (`<span\s*[[:alpha:]="]*?[>]?$` )
196
+ entityRegex = regexp .MustCompile (`&[#]*?[0-9[:alpha:]]*$` )
197
+ )
196
198
197
199
// shouldWriteInline represents combinations where we manually write inline changes
198
200
func shouldWriteInline (diff diffmatchpatch.Diff , lineType DiffLineType ) bool {
@@ -206,7 +208,6 @@ func shouldWriteInline(diff diffmatchpatch.Diff, lineType DiffLineType) bool {
206
208
}
207
209
208
210
func fixupBrokenSpans (diffs []diffmatchpatch.Diff ) []diffmatchpatch.Diff {
209
-
210
211
// Create a new array to store our fixed up blocks
211
212
fixedup := make ([]diffmatchpatch.Diff , 0 , len (diffs ))
212
213
@@ -658,10 +659,10 @@ func (diffFile *DiffFile) GetTailSection(gitRepo *git.Repository, leftCommitID,
658
659
LastRightIdx : lastLine .RightIdx ,
659
660
LeftIdx : leftLineCount ,
660
661
RightIdx : rightLineCount ,
661
- }}
662
+ },
663
+ }
662
664
tailSection := & DiffSection {FileName : diffFile .Name , Lines : []* DiffLine {tailDiffLine }}
663
665
return tailSection
664
-
665
666
}
666
667
667
668
func getCommitFileLineCount (commit * git.Commit , filePath string ) int {
@@ -942,8 +943,8 @@ parsingLoop:
942
943
// TODO: There are numerous issues with this:
943
944
// - we might want to consider detecting encoding while parsing but...
944
945
// - we're likely to fail to get the correct encoding here anyway as we won't have enough information
945
- var diffLineTypeBuffers = make (map [DiffLineType ]* bytes.Buffer , 3 )
946
- var diffLineTypeDecoders = make (map [DiffLineType ]* encoding.Decoder , 3 )
946
+ diffLineTypeBuffers : = make (map [DiffLineType ]* bytes.Buffer , 3 )
947
+ diffLineTypeDecoders : = make (map [DiffLineType ]* encoding.Decoder , 3 )
947
948
diffLineTypeBuffers [DiffLinePlain ] = new (bytes.Buffer )
948
949
diffLineTypeBuffers [DiffLineAdd ] = new (bytes.Buffer )
949
950
diffLineTypeBuffers [DiffLineDel ] = new (bytes.Buffer )
@@ -1420,6 +1421,7 @@ func GetDiff(gitRepo *git.Repository, opts *DiffOptions, files ...string) (*Diff
1420
1421
}()
1421
1422
}
1422
1423
defer func () {
1424
+ _ = checker .Close ()
1423
1425
cancel ()
1424
1426
}()
1425
1427
}
@@ -1539,7 +1541,8 @@ func GetWhitespaceFlag(whiteSpaceBehavior string) string {
1539
1541
"ignore-all" : "-w" ,
1540
1542
"ignore-change" : "-b" ,
1541
1543
"ignore-eol" : "--ignore-space-at-eol" ,
1542
- "" : "" }
1544
+ "" : "" ,
1545
+ }
1543
1546
1544
1547
return whitespaceFlags [whiteSpaceBehavior ]
1545
1548
}
0 commit comments