Skip to content

Commit 091db60

Browse files
cbleckerclaude
andcommitted
Make year range dynamic based on current year
Replace hard-coded year range ending at 2030 with a dynamic approach that calculates the end year as current year + 5. This eliminates the need for manual updates and ensures the tool continues working without maintenance as time progresses. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 41f0f4a commit 091db60

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

hack/verify-steering-election-tool.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"path/filepath"
2323
"regexp"
2424
"strings"
25+
"time"
2526

2627
yaml "gopkg.in/yaml.v3"
2728
)
@@ -135,7 +136,11 @@ func findBioFiles(electionsPath string) ([]string, error) {
135136
// Only include elections from 2025 forward
136137
pathLower := strings.ToLower(path)
137138
includeFile := false
138-
for year := 2025; year <= 2030; year++ { // Check current year and a few years ahead
139+
currentYear := time.Now().Year()
140+
// Check from 2025 to a few years ahead of current year
141+
startYear := 2025
142+
endYear := currentYear + 5
143+
for year := startYear; year <= endYear; year++ {
139144
yearStr := fmt.Sprintf("/%d/", year)
140145
if strings.Contains(pathLower, yearStr) {
141146
includeFile = true

0 commit comments

Comments
 (0)