Skip to content

time: remove unnecessary if condition segment Mon <= dec31wday since it is always true in ISOWeek() #22241

@msimonsson

Description

@msimonsson

Hi,

In ISOWeek() Mon is the first day of the week.

https://github.com/golang/go/blob/master/src/time/time.go#L565

if dec31wday := (wday + 31 - day) % 7; Mon <= dec31wday && dec31wday <= Wed {

The condition Mon <= dec31wday is always true and the line can be changed to:

if dec31wday := (wday + 31 - day) % 7; dec31wday <= Wed {

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions