Skip to content

time: don't print nil Location as "UTC" #11059

Closed
@178inaba

Description

@178inaba

Hi there
The first time I'll post.

http://play.golang.org/p/TAyGLFfUUa

time.LoadLocation() If an invalid value is passed on, it is displayed in fmt.Println() "UTC".
However, actually nil so panic occurs when you use the Location.
This behavior is
https://github.com/golang/go/blob/master/src/time/zoneinfo.go#L73
Due to that it returns the UTC above.

I think this behavior had better fix.
Location I think is that we should be printed as if nil "".
Or, I think Location came back is good if it is available as UTC.
In that case,
https://github.com/golang/go/blob/master/src/time/zoneinfo_unix.go#L89
I think I should I return the UTC above.

I think this sentence because English is not good I wrote in the google translation.
I'm sorry if there is an unknown sentence.

Thank you for reading to the last.
golang love! Fun!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions