-
Notifications
You must be signed in to change notification settings - Fork 2
Revert strconv changes - keep fmt.Sprintf to pass linter #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
| import ( | ||
| "database/sql" | ||
| "fmt" | ||
| "strconv" | ||
|
Check failure on line 6 in internal/repository/holiday_repository.go
|
||
| "strings" | ||
| "time" | ||
|
|
||
|
|
@@ -90,17 +90,17 @@ | |
|
|
||
| if filter.Year != nil { | ||
| whereConditions = append(whereConditions, "strftime('%Y', date) = ?") | ||
| args = append(args, strconv.Itoa(*filter.Year)) | ||
| args = append(args, fmt.Sprintf("%d", *filter.Year)) | ||
| } | ||
|
|
||
| if filter.Month != nil { | ||
| whereConditions = append(whereConditions, "strftime('%m', date) = ?") | ||
| args = append(args, strconv.Itoa(*filter.Month)) | ||
| args = append(args, fmt.Sprintf("%02d", *filter.Month)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. WARNING: Repository expects month in "%02d" format (e.g., "01", "02"), but the handler sends month as integer (1, 2) to the repository. This will cause month filtering to silently fail. |
||
| } | ||
|
|
||
| if filter.Day != nil { | ||
| whereConditions = append(whereConditions, "strftime('%d', date) = ?") | ||
| args = append(args, strconv.Itoa(*filter.Day)) | ||
| args = append(args, fmt.Sprintf("%02d", *filter.Day)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. WARNING: Same issue as line 98 - day filter expects "%02d" format but receives integer. |
||
| } | ||
|
|
||
| if filter.Type != nil { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,6 @@ import ( | |
| "encoding/json" | ||
| "fmt" | ||
| "net/http" | ||
| "strconv" | ||
| "time" | ||
| ) | ||
|
|
||
|
|
@@ -102,10 +101,10 @@ func (c *Client) GetHolidays(ctx context.Context, year, month *int, holidayType | |
|
|
||
| q := req.URL.Query() | ||
| if year != nil { | ||
| q.Add("year", strconv.Itoa(*year)) | ||
| q.Add("year", fmt.Sprintf("%d", *year)) | ||
| } | ||
| if month != nil { | ||
| q.Add("month", strconv.Itoa(*month)) | ||
| q.Add("month", fmt.Sprintf("%d", *month)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CRITICAL: Month filtering will break - the API handler parses month as integer (1-12), but this sends zero-padded string (01-12). When user passes month=1, this sends "01" which fails the integer parsing in the handler (strconv.Atoi("01") returns 1, but the filter won't match the "01" in SQL).
Comment on lines
103
to
+107
|
||
| } | ||
| if holidayType != "" { | ||
| q.Add("type", holidayType) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt.Sprintf("%d", *filter.Year)is also likely to triggerstaticcheckS1039 (unnecessarySprintf). Usingstrconv.Itoa(*filter.Year)avoids the lint issue and would also make the existingstrconvimport in this file meaningful (right now it’s unused, which will fail the build).