Refactor date parsing error handling by jsnfwlr · Pull Request #88 · oapi-codegen/runtime
Expand Up
@@ -258,8 +258,7 @@ func assignPathValues(dst interface{}, pathValues fieldOrValue) error {
tm, err = time.Parse(time.RFC3339Nano, pathValues.value)
if err != nil {
// Fall back to parsing it as a date.
// TODO: why is this marked as an ineffassign?
tm, err = time.Parse(types.DateFormat, pathValues.value) //nolint:ineffassign,staticcheck
_, err = time.Parse(types.DateFormat, pathValues.value) // the time result is never used, so it doesn't need to be assigned
if err != nil {
return fmt.Errorf("error parsing '%s' as RFC3339 or 2006-01-02 time: %w", pathValues.value, err)
}
Expand Down