History

format with gofumpt (#18184)

* gofumpt -w -l . * gofumpt -w -l -extra . * Add linter * manual fix * change make fmt

6543 committed 4 years ago

Commit 54e9ee31 parent 1d98d20423 files · +1586 −1759Browse files

Showing the changes to services/gitdiff/gitdiff.go (1 of 423 files). Show all

Unified · Split

services/gitdiff/gitdiff.go+11−9
@@ -190,9 +190,11 @@ var ( · 189 unmodified lines
190190 codeTagSuffix = []byte(`</span>`)
191191 )
192192
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+)
196198
197199 // shouldWriteInline represents combinations where we manually write inline changes
198200 func shouldWriteInline(diff diffmatchpatch.Diff, lineType DiffLineType) bool {
@@ -206,7 +208,6 @@ func shouldWriteInline(diff diffmatchpatch.Diff, lineType DiffLineType) bool { · 7 unmodified lines
206208 }
207209
208210 func fixupBrokenSpans(diffs []diffmatchpatch.Diff) []diffmatchpatch.Diff {
209−
210211 // Create a new array to store our fixed up blocks
211212 fixedup := make([]diffmatchpatch.Diff, 0, len(diffs))
212213
@@ -658,10 +659,10 @@ func (diffFile *DiffFile) GetTailSection(gitRepo *git.Repository, leftCommitID, · 445 unmodified lines
658659 LastRightIdx: lastLine.RightIdx,
659660 LeftIdx: leftLineCount,
660661 RightIdx: rightLineCount,
661− }}
662+ },
663+ }
662664 tailSection := &DiffSection{FileName: diffFile.Name, Lines: []*DiffLine{tailDiffLine}}
663665 return tailSection
664−
665666 }
666667
667668 func getCommitFileLineCount(commit *git.Commit, filePath string) int {
@@ -942,8 +943,8 @@ parsingLoop: · 274 unmodified lines
942943 // TODO: There are numerous issues with this:
943944 // - we might want to consider detecting encoding while parsing but...
944945 // - 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)
947948 diffLineTypeBuffers[DiffLinePlain] = new(bytes.Buffer)
948949 diffLineTypeBuffers[DiffLineAdd] = new(bytes.Buffer)
949950 diffLineTypeBuffers[DiffLineDel] = new(bytes.Buffer)
@@ -1539,7 +1540,8 @@ func GetWhitespaceFlag(whiteSpaceBehavior string) string { · 589 unmodified lines
15391540 "ignore-all": "-w",
15401541 "ignore-change": "-b",
15411542 "ignore-eol": "--ignore-space-at-eol",
1542− "": ""}
1543+ "": "",
1544+ }
15431545
15441546 return whitespaceFlags[whiteSpaceBehavior]
15451547 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t