Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

time.Time unexpected behavior in json+omitempty+time.Time #5218

Closed
gopherbot opened this issue Apr 5, 2013 · 1 comment
Closed

time.Time unexpected behavior in json+omitempty+time.Time #5218

gopherbot opened this issue Apr 5, 2013 · 1 comment

Comments

@gopherbot
Copy link
Contributor

by [email protected]:

When using GOLANG's encoding for JSON and the datatype is Time. "omitempty"
does not work. It always emits the default value '0001-01-01 00:00:00 +0000 UTC'. This
is not working as expected(http://play.golang.org/p/vHLyeMwwTX).


type Stuff struct {
  Cloned       time.Time   `json:"cloned,omitempty"`
  Expiration   time.Time   `json:"expiration,omitempty"`
}


What is the expected output?

-I expected the default value of time.Time to be empty. 

What do you see instead?

0001-01-01 00:00:00 +0000 UTC


Which compiler are you using (5g, 6g, 8g, gccgo)?

6

Which operating system are you using?

Win

Which version are you using?  (run 'go version')

go1.0.3

Please provide any additional information below.
@adg
Copy link
Contributor

adg commented Apr 8, 2013

Comment 1:

Status changed to Duplicate.

Merged into issue #4357.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants