Add debug logging for scanned files in fsurls.go to improve visibility during URL collection

This commit is contained in:
Luke Hagar
2025-09-11 18:58:43 +00:00
parent d3072d1f64
commit 1f593407ca
2 changed files with 6 additions and 2 deletions

View File

@@ -88,7 +88,7 @@ func init() {
// Emit GitHub Actions debug log for each URL.
// These lines appear only when step debug logging is enabled via the
// repository/organization secret ACTIONS_STEP_DEBUG=true.
fmt.Printf("::debug::URL %s status=%d ok=%v err=%s sources=%d\n", r.URL, r.Status, r.OK, r.ErrMsg, len(r.Sources))
fmt.Printf("::debug:: Scanned URL: %s status=%d ok=%v err=%s sources=%d\n", r.URL, r.Status, r.OK, r.ErrMsg, len(r.Sources))
if jsonOut != "" && !r.OK {
failures = append(failures, SerializableResult{
URL: r.URL,

View File

@@ -2,6 +2,7 @@ package fsurls
import (
"bufio"
"fmt"
"io"
"net/url"
"os"
@@ -106,6 +107,9 @@ func CollectURLs(rootPath string, globs []string) (map[string][]string, error) {
return nil
}
// Debug: announce file being parsed; GitHub shows ::debug only in debug runs
fmt.Printf("::debug:: Scanned File: %s\n", rel)
f, ferr := os.Open(path)
if ferr != nil {
return nil
@@ -207,7 +211,7 @@ func trimTrailingDelimiters(s string) string {
return s
}
last := s[len(s)-1]
if strings.ContainsRune(").,;:!?]'\"}", rune(last)) {
if strings.ContainsRune(").,;:!?]'"}", rune(last)) {
s = s[:len(s)-1]
continue
}