summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-10-28 15:16:08 +0100
committerChristopher Baines <mail@cbaines.net>2023-11-05 17:51:38 +0000
commitaa98a976079101318d53b412fef6c722bb4332c9 (patch)
tree5f54a9b433498406ab3bcc0f11af53f98790bb95
parent1eb3133355ef14d6d4c8648504a7e013338779a8 (diff)
downloadguix-aa98a976079101318d53b412fef6c722bb4332c9.tar.gz
lint: Speed up the formatting linter.
By using go-to-location which caches the number of bytes to seek by to get to
specific lines in a file.

* guix/lint.scm (report-formatting-issues): Use go-to-location.

Change-Id: I34e4d3acfbb1e14e026d2e7f712ba8d22b56c147
Signed-off-by: Christopher Baines <mail@cbaines.net>
-rw-r--r--guix/lint.scm3
1 files changed, 2 insertions, 1 deletions
diff --git a/guix/lint.scm b/guix/lint.scm
index 7ccf52dec1..861e352b93 100644
--- a/guix/lint.scm
+++ b/guix/lint.scm
@@ -1857,7 +1857,8 @@ them for PACKAGE."
 
   (call-with-input-file file
     (lambda (port)
-      (let loop ((line-number 1)
+      (go-to-location port starting-line 0)
+      (let loop ((line-number starting-line)
                  (last-line #f)
                  (warnings '()))
         (let ((line (read-line port)))