Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

Commit

Permalink
go fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ynqa committed Oct 3, 2020
1 parent fdf297b commit 42abb37
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion pkg/diffy/diffy.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func splitText(text string, length, tabSize int) []string {
var res []string
for i := 0; i < len(text); i += length {
if i+length < len(text) {
res = append(res, text[i:(i + length)])
res = append(res, text[i:(i+length)])
} else {
res = append(res, text[i:])
}
Expand Down
32 changes: 16 additions & 16 deletions pkg/diffy/split.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func WriteSplitDiff(
i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2
if c.Tag == 'e' {
for ln, line := range diff.A[i1:i2] {
texts := splitText(line, mid - 6, opt.TabSize)
texts := splitText(line, mid-6, opt.TabSize)
buf.WriteString(
splittedLine(
fmt.Sprintf("%*d", lnSpaceSize, i1+ln+1),
Expand All @@ -52,7 +52,7 @@ func WriteSplitDiff(
mid, opt.SpaceSizeAfterLn, 2,
),
)
for i:=1; i<len(texts); i++ {
for i := 1; i < len(texts); i++ {
buf.WriteString(
splittedLine(
strings.Repeat(" ", lnSpaceSize),
Expand All @@ -70,7 +70,7 @@ func WriteSplitDiff(
}
if c.Tag == 'd' {
for ln, line := range diff.A[i1:i2] {
texts := splitText(line, mid - 6, opt.TabSize)
texts := splitText(line, mid-6, opt.TabSize)
buf.WriteString(
splittedLine(
fmt.Sprintf("%*d", lnSpaceSize, i1+ln+1),
Expand All @@ -83,7 +83,7 @@ func WriteSplitDiff(
mid, opt.SpaceSizeAfterLn, 2,
),
)
for i:=1; i<len(texts); i++ {
for i := 1; i < len(texts); i++ {
buf.WriteString(
splittedLine(
strings.Repeat(" ", lnSpaceSize),
Expand All @@ -101,7 +101,7 @@ func WriteSplitDiff(
}
if c.Tag == 'i' {
for ln, line := range diff.B[j1:j2] {
texts := splitText(line, mid - 6, opt.TabSize)
texts := splitText(line, mid-6, opt.TabSize)
buf.WriteString(
splittedLine(
"",
Expand All @@ -114,7 +114,7 @@ func WriteSplitDiff(
mid, opt.SpaceSizeAfterLn, 2,
),
)
for i:=1; i<len(texts); i++ {
for i := 1; i < len(texts); i++ {
buf.WriteString(
splittedLine(
"",
Expand All @@ -140,8 +140,8 @@ func WriteSplitDiff(
minIsOrg = false
}
for ; cursor < minLen; cursor++ {
orgTexts := splitText(diff.A[i1+cursor], mid - 6, opt.TabSize)
newTexts := splitText(diff.B[j1+cursor], mid - 6, opt.TabSize)
orgTexts := splitText(diff.A[i1+cursor], mid-6, opt.TabSize)
newTexts := splitText(diff.B[j1+cursor], mid-6, opt.TabSize)
buf.WriteString(
splittedLine(
fmt.Sprintf("%*d", lnSpaceSize, i1+cursor+1),
Expand Down Expand Up @@ -176,7 +176,7 @@ func WriteSplitDiff(
)
}
if minTextIsOrg {
for i := textCursor; i < len(newTexts); i ++ {
for i := textCursor; i < len(newTexts); i++ {
buf.WriteString(
splittedLine(
"",
Expand All @@ -191,7 +191,7 @@ func WriteSplitDiff(
)
}
} else {
for i := textCursor; i < len(orgTexts); i ++ {
for i := textCursor; i < len(orgTexts); i++ {
buf.WriteString(
splittedLine(
strings.Repeat(" ", lnSpaceSize),
Expand All @@ -208,8 +208,8 @@ func WriteSplitDiff(
}
}
if minIsOrg {
for ; cursor < j2 - j1; cursor++ {
texts := splitText(diff.B[j1+cursor], mid - 6, opt.TabSize)
for ; cursor < j2-j1; cursor++ {
texts := splitText(diff.B[j1+cursor], mid-6, opt.TabSize)
buf.WriteString(
splittedLine(
"",
Expand All @@ -222,7 +222,7 @@ func WriteSplitDiff(
mid, opt.SpaceSizeAfterLn, 2,
),
)
for i:=1; i<len(texts); i++ {
for i := 1; i < len(texts); i++ {
buf.WriteString(
splittedLine(
"",
Expand All @@ -238,8 +238,8 @@ func WriteSplitDiff(
}
}
} else {
for ; cursor < i2 - i1; cursor++ {
texts := splitText(diff.A[i1+cursor], mid - 6, opt.TabSize)
for ; cursor < i2-i1; cursor++ {
texts := splitText(diff.A[i1+cursor], mid-6, opt.TabSize)
buf.WriteString(
splittedLine(
fmt.Sprintf("%*d", lnSpaceSize, i1+cursor+1),
Expand All @@ -252,7 +252,7 @@ func WriteSplitDiff(
mid, opt.SpaceSizeAfterLn, 2,
),
)
for i:=1; i<len(texts); i++ {
for i := 1; i < len(texts); i++ {
buf.WriteString(
splittedLine(
strings.Repeat(" ", lnSpaceSize),
Expand Down

0 comments on commit 42abb37

Please sign in to comment.