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

goi18n extract doesn't seem to work for source file that use generics #287

Closed
CorentinClabaut opened this issue Nov 9, 2022 · 3 comments

Comments

@CorentinClabaut
Copy link

When trying to use goi18n extract on my project that uses generics I'm getting the following error:

10:17: expected '(', found '[' (and 3 more errors)

I'm guessing that is due to the generics type parameters that start with a [ when a regular function would directly have a ( before listing the regular parameters.

I'm guessing this issue comes from /v2/goi18n/extract_command.go:122 parser.ParseFile(fset, "", buf, parser.AllErrors)

Would increasing the version of golang used in this project from go1.12 to go1.18 fix this issue?
I'm guessing then the package go/parser would be able to parse generics correctly.

@nicksnyder
Copy link
Owner

I just upgraded the version of go and released 2.2.1. Can you upgrade and see it works now?

@CorentinClabaut
Copy link
Author

Hi @nicksnyder

Thanks for the quick fix.

I wanted to test it but go get -u github.com/nicksnyder/go-i18n/v2/goi18n doesn't seem to install goi18n

Am I supposed to do something else to install it?
I'm working on Linux.

@nicksnyder
Copy link
Owner

Try this: go install -v github.com/nicksnyder/go-i18n/v2/goi18n@latest

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

2 participants