Go: fix warnings (#17738)

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-08-03 21:30:01 +08:00
committed by GitHub
parent d357eea8ef
commit 86021932ae
103 changed files with 437 additions and 439 deletions

View File

@@ -43,7 +43,7 @@ func ResolvePageSpan(pageNum int, bottom float64, pageHeights map[int]float64) (
return
}
// boxesToSections converts layout boxes to section format with position tags.
// BoxesToSections converts layout boxes to section format with position tags.
//
// pageHeights provides the PDF-point height of each page (image height / zoom).
// Boxes that extend beyond their page produce multi-page position tags

View File

@@ -122,7 +122,7 @@ func splitLineByXGap(chars []pdf.TextChar, threshold float64) [][]pdf.TextChar {
// ---- internal helpers ----
// groupCharsToLines groups characters into horizontal lines based on vertical overlap.
// GroupCharsToLines groups characters into horizontal lines based on vertical overlap.
func GroupCharsToLines(chars []pdf.TextChar, sortByTop bool) [][]pdf.TextChar {
if len(chars) == 0 {
return nil

View File

@@ -328,7 +328,7 @@ func cellName(col, row int) string {
return s
}
// including per-cell text comparison.
// CompareTablesWithPython including per-cell text comparison.
func CompareTablesWithPython(log TLogger, goTablesDir, pyTablesDir string) {
goEntries, err := os.ReadDir(goTablesDir)
if err != nil {

View File

@@ -240,7 +240,7 @@ func CropSectionImage(posTag string, decodedImages map[int]image.Image, zoom flo
return base64.StdEncoding.EncodeToString(data)
}
// cropSectionByDLA crops a section using the best-overlapping DLA region,
// CropSectionByDLA crops a section using the best-overlapping DLA region,
// mimicking Python's cropout() in deepdoc/parser/pdf_parser.py (around line
// 1307). Unlike the original Go version (which only cropped the first page),
// it now walks every position and every page the section spans, crops each
@@ -483,7 +483,7 @@ func rotateCoordCW(x, y float64, origW, origH int, angle int) (float64, float64)
}
}
// rotateImageCW rotates an image clockwise. Only 0/90/180/270 supported;
// RotateImageCW rotates an image clockwise. Only 0/90/180/270 supported;
// other values return nil. Matches Python PIL.Image.rotate(-angle, expand=True).
func RotateImageCW(img image.Image, angle int) *image.RGBA {
b := img.Bounds()
@@ -509,7 +509,7 @@ func RotateImageCW(img image.Image, angle int) *image.RGBA {
return dst
}
// mapRotatedPointToOriginal maps a point from rotated image coords back to
// MapRotatedPointToOriginal maps a point from rotated image coords back to
// original coords. angle is the clockwise rotation applied. origW, origH
// are the ORIGINAL (pre-rotation) image dimensions.
//

View File

@@ -189,7 +189,7 @@ func RectOverlap(a, b Rect) float64 {
return OverlapRatioMax(a, b)
}
// fastCrop copies a rectangular region from src to a new *image.RGBA.
// FastCrop copies a rectangular region from src to a new *image.RGBA.
// Uses direct Pix slice copy for *image.RGBA sources (zero allocation per row);
// falls back to pixel-by-pixel for other image types.
func FastCrop(src image.Image, x0, y0, x1, y1 int) *image.RGBA {