Skip to content

time: Time.Format() should fail when the layout string is unexpected #34997

@jqll

Description

@jqll

What version of Go are you using (go version)?

$ go version
go1.13

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOHOSTOS="linux"

What did you do?

On 2019-10-18, run time.Now().Format("2006-01-01") (instead of the correct magic string "2006-01-02")

What did you expect to see?

  1. Go magically understands the format and returns the correct time with this format.
    or
  2. It complains the given format string is unexpected, either during compiling or at run time.

What did you see instead?

It returns a wrong time "2019-10-10".

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions