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

Correctly quote date-like strings #213

Closed
wants to merge 2 commits into from

Conversation

autrilla
Copy link

@autrilla autrilla commented Oct 20, 2016

Fixes #192

(this is a copy of #193, but since then, we've needed to move the fix to another branch)

@autrilla
Copy link
Author

I'm not sure why this is broken on tip

@vinzenz
Copy link

vinzenz commented Nov 3, 2016

@autrilla It's fixed by #217 - It's a change in the time stdlib

@rogpeppe
Copy link
Contributor

rogpeppe commented Jan 8, 2018

Fixed by #310.

@rogpeppe rogpeppe closed this Jan 8, 2018
@autrilla
Copy link
Author

autrilla commented Jan 8, 2018

@rogpeppe I'm not sure this is fixed, unless I'm misunderstanding things. Running the reproduction case from the issue:

cd /tmp && mkdir gotmp && export GOPATH=/tmp/gotmp && go get -u gopkg.in/yaml.v2 && cat <<EOF > main.go && go run main.go
package main

import (
    "fmt"
    "gopkg.in/yaml.v2"
)

func main() {
    m := make(map[string]string)
    m["foo"] = "2006-01-02T15:04:05Z"
    out, _ := yaml.Marshal(m)
    fmt.Println(string(out))
}
EOF

Outputs:

foo: 2006-01-02T15:04:05Z

But if it was fixed, it should have output the date string quoted with single or double quotes.

Edit: Oh, never mind, I see this is on the devel branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Marshaler incorrectly marshals date strings
3 participants