* gofumpt -w -l . * gofumpt -w -l -extra . * Add linter * manual fix * change make fmt
Showing the changes to services/gitdiff/gitdiff.go (1 of 423 files). Show all
Unified · Split
| @@ -190,9 +190,11 @@ var ( · 189 unmodified lines | ||
| 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 { · 7 unmodified lines | ||
| 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, · 445 unmodified lines | ||
| 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: · 274 unmodified lines | ||
| 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) |
| @@ -1539,7 +1540,8 @@ func GetWhitespaceFlag(whiteSpaceBehavior string) string { · 589 unmodified lines | ||
| 1539 | 1540 | "ignore-all": "-w", |
| 1540 | 1541 | "ignore-change": "-b", |
| 1541 | 1542 | "ignore-eol": "--ignore-space-at-eol", |
| 1542 | − "": ""} | |
| 1543 | + "": "", | |
| 1544 | + } | |
| 1543 | 1545 | |
| 1544 | 1546 | return whitespaceFlags[whiteSpaceBehavior] |
| 1545 | 1547 | } |