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

isStandardFormat() incorrectly returns false if yaml file starts with a comment #70

Closed
tabacco opened this issue May 11, 2017 · 4 comments

Comments

@tabacco
Copy link

tabacco commented May 11, 2017

It looks like the recent change to support a flatter format might have some backwards-compatibility issues with yaml

https://github.com/nicksnyder/go-i18n/blob/master/i18n/bundle/bundle.go#L125

This line assumes that a standard format yaml file will start with a -, which is true unless there's a comment at the start of the file. In that case, it'll assume it's a flat format file and panic/error.

@nicksnyder
Copy link
Owner

Can you give an example file that is failing?

You can see here that we do try/intend to strip out leading comments.
https://github.com/nicksnyder/go-i18n/blob/master/i18n/bundle/bundle.go#L123

cc @BoGeM

@n10v
Copy link
Contributor

n10v commented May 12, 2017

We also have tests, that even start with 2 newlines and comments.

@nicksnyder
Copy link
Owner

It was fixed in HEAD but not in the latest release (1.8). I just released 1.8.1 which should solve your problem @tabacco

@tabacco
Copy link
Author

tabacco commented May 12, 2017

Excellent, thanks @nicksnyder!

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

No branches or pull requests

3 participants