Skip to content

Commit 3b7061e

Browse files
jsnfwlrmromaszewicz
authored andcommitted
Refactor date parsing error handling
Updated error handling for date parsing to avoid unnecessary assignment.
1 parent effec1a commit 3b7061e

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
@@ -258,8 +258,7 @@ func assignPathValues(dst interface{}, pathValues fieldOrValue) error {
258258
tm, err = time.Parse(time.RFC3339Nano, pathValues.value)
259259
if err != nil {
260260
// Fall back to parsing it as a date.
261-
// TODO: why is this marked as an ineffassign?
262-
tm, err = time.Parse(types.DateFormat, pathValues.value) //nolint:ineffassign,staticcheck
261+
_, err = time.Parse(types.DateFormat, pathValues.value) // the time result is never used, so it doesn't need to be assigned
263262
if err != nil {
264263
return fmt.Errorf("error parsing '%s' as RFC3339 or 2006-01-02 time: %w", pathValues.value, err)
265264
}

0 commit comments

Comments
 (0)