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

panic: Only a pointer to struct can be unmarshaled from TOML #95

Closed
dcwills opened this issue Apr 16, 2018 · 7 comments · Fixed by #96
Closed

panic: Only a pointer to struct can be unmarshaled from TOML #95

dcwills opened this issue Apr 16, 2018 · 7 comments · Fixed by #96
Labels
bug Not working as intended.

Comments

@dcwills
Copy link

dcwills commented Apr 16, 2018

I'm a newb to this project, and I think I'm following the instructions, but perhaps I'm missing something?

This code generates the error in the subject line:

bundle := i18n.NewBundle(language.English) bundle.RegisterUnmarshalFunc("toml", toml.Unmarshal) bundle.MustLoadMessageFile(path.Dir(os.Args[0]) + "/i18n/active.fr.toml")

The toml file originates from a goi18n extract.

In addition, the MustLocalize example on this page generates the same error:

https://godoc.org/github.com/nicksnyder/go-i18n/v2/i18n#pkg-examples

Thank you in advance.

@nicksnyder
Copy link
Owner

Just tagged 2.0.0.beta.1 so there may be some bugs. I will take a look

@nicksnyder nicksnyder added the bug Not working as intended. label Apr 17, 2018
@dcwills
Copy link
Author

dcwills commented Apr 17, 2018 via email

@nicksnyder
Copy link
Owner

You probably need to go get -u github.com/nicksnyder/go-i18n. If you are using a dependency manager then you will probably need to update the version it points to (although I haven't tagged a new release so you would need to reference by commit hash).

If you are still having issues, please post what your toml file looks like.

@dcwills
Copy link
Author

dcwills commented Apr 17, 2018 via email

@nicksnyder
Copy link
Owner

Examples are automatically run and verified as part of unit tests (https://github.com/nicksnyder/go-i18n/blob/master/v2/i18n/example_test.go), so there must be a difference between the example code and what you are actually running if it is failing for you.

@dcwills
Copy link
Author

dcwills commented Apr 17, 2018 via email

@nicksnyder
Copy link
Owner

Glad you were able to figure it out. Versioning dependencies (and declaring which dependencies a package depends on) is an active area of development in the Go community. You may be interested to read this: https://research.swtch.com/vgo-intro

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

Successfully merging a pull request may close this issue.

2 participants