style: use += 1 instead of ++
All checks were successful
submodules sync / sync (push) Successful in 47s
build / build (push) Successful in 1m28s
build / trigger-build-image (push) Successful in 8s

This commit is contained in:
张泊明518370910136 2024-11-04 08:09:00 -05:00
parent 5fd7c19783
commit 59bbd98a58
GPG Key ID: D47306D7062CDA9D
2 changed files with 5 additions and 5 deletions

View File

@ -25,7 +25,7 @@ func (e *Sandbox) Run(cmds []stage.Cmd) ([]stage.ExecutorResult, error) {
} }
} }
// cannot use range loop since we need to change the value // cannot use range loop since we need to change the value
for i := 0; i < len(cmds); i++ { for i := 0; i < len(cmds); i += 1 {
cmd := &cmds[i] cmd := &cmds[i]
if cmd.CopyIn == nil { if cmd.CopyIn == nil {
cmd.CopyIn = make(map[string]stage.CmdFile) cmd.CopyIn = make(map[string]stage.CmdFile)

View File

@ -136,14 +136,14 @@ func myersDiff(src, dst []string) []operation {
var x, y int var x, y int
loop: loop:
for d := 0; d <= max; d++ { for d := 0; d <= max; d += 1 {
v := make(map[int]int, d+2) v := make(map[int]int, d+2)
trace = append(trace, v) trace = append(trace, v)
if d == 0 { if d == 0 {
t := 0 t := 0
for len(src) > t && len(dst) > t && src[t] == dst[t] { for len(src) > t && len(dst) > t && src[t] == dst[t] {
t++ t += 1
} }
v[0] = t v[0] = t
if t == len(src) && len(src) == len(dst) { if t == len(src) && len(src) == len(dst) {
@ -180,7 +180,7 @@ loop:
y = m y = m
var k, prevK, prevX, prevY int var k, prevK, prevX, prevY int
for d := len(trace) - 1; d > 0; d-- { for d := len(trace) - 1; d > 0; d -= 1 {
k = x - y k = x - y
lastV := trace[d-1] lastV := trace[d-1]
@ -209,7 +209,7 @@ loop:
} }
if trace[0][0] != 0 { if trace[0][0] != 0 {
for i := 0; i < trace[0][0]; i++ { for i := 0; i < trace[0][0]; i += 1 {
script = append(script, MOVE) script = append(script, MOVE)
} }
} }