chore(parser/diff): rename size to length
All checks were successful
submodules sync / sync (push) Successful in 38s
build / build (push) Successful in 1m20s
build / trigger-build-image (push) Successful in 7s

This commit is contained in:
张泊明518370910136 2024-11-04 08:40:52 -05:00
parent 5d5bc21447
commit e5ae6fc223
GPG Key ID: D47306D7062CDA9D

View File

@ -228,7 +228,7 @@ func reverse(s []operation) []operation {
// generateDiffWithContext creates a diff block with surrounding context from stdout and result. // generateDiffWithContext creates a diff block with surrounding context from stdout and result.
func generateDiffWithContext( func generateDiffWithContext(
stdoutLines, resultLines []string, ops []operation, maxSize int, stdoutLines, resultLines []string, ops []operation, maxLength int,
) string { ) string {
var diffBuilder strings.Builder var diffBuilder strings.Builder
@ -255,8 +255,8 @@ func generateDiffWithContext(
lineCount += 1 lineCount += 1
} }
} }
if maxSize > 0 && diffBuilder.Len()+len(s) > maxSize { if maxLength > 0 && diffBuilder.Len()+len(s) > maxLength {
remaining := maxSize - diffBuilder.Len() remaining := maxLength - diffBuilder.Len()
if remaining > 0 { if remaining > 0 {
diffBuilder.WriteString(s[:remaining]) diffBuilder.WriteString(s[:remaining])
} }