fix: Windows build + gosec lint errors (#585)

Fixes Windows build by adding platform-specific inode handling via build tags. Also fixes gosec lint warnings in migrate_tombstones.go.

Thanks @deblasis!
This commit is contained in:
Alessandro De Blasis
2025-12-16 22:26:51 +01:00
committed by GitHub
parent aed166fe85
commit 1ba12e1620
4 changed files with 41 additions and 16 deletions

View File

@@ -42,7 +42,7 @@ func MigrateTombstones(path string) error {
// Load existing JSONL to check for already-existing tombstones
existingTombstones := make(map[string]bool)
if file, err := os.Open(jsonlPath); err == nil {
if file, err := os.Open(filepath.Clean(jsonlPath)); err == nil {
scanner := bufio.NewScanner(file)
scanner.Buffer(make([]byte, 0, 64*1024), 10*1024*1024)
for scanner.Scan() {
@@ -56,7 +56,7 @@ func MigrateTombstones(path string) error {
}
}
}
file.Close()
_ = file.Close()
}
// Convert deletions to tombstones
@@ -74,7 +74,7 @@ func MigrateTombstones(path string) error {
fmt.Printf(" All %d deletion(s) already have tombstones - archiving deletions.jsonl\n", skipped)
} else {
// Append tombstones to issues.jsonl
file, err := os.OpenFile(jsonlPath, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0644)
file, err := os.OpenFile(filepath.Clean(jsonlPath), os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600)
if err != nil {
return fmt.Errorf("failed to open issues.jsonl: %w", err)
}