Skip to content

Commit a12ec5e

Browse files
authored
Refactor date parsing error handling
Updated error handling for date parsing to avoid unnecessary assignment.
1 parent 5bb2934 commit a12ec5e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

deepobject.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,7 @@ func assignPathValues(dst interface{}, pathValues fieldOrValue) error {
255255
tm, err = time.Parse(time.RFC3339Nano, pathValues.value)
256256
if err != nil {
257257
// Fall back to parsing it as a date.
258-
// TODO: why is this marked as an ineffassign?
259-
tm, err = time.Parse(types.DateFormat, pathValues.value) //nolint:ineffassign,staticcheck
258+
_, err = time.Parse(types.DateFormat, pathValues.value) // the time result is never used, so it doesn't need to be assigned
260259
if err != nil {
261260
return fmt.Errorf("error parsing '%s' as RFC3339 or 2006-01-02 time: %w", pathValues.value, err)
262261
}

0 commit comments

Comments
 (0)