nicksnyder / go-i18n

Translate your Go program into multiple languages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

CorentinClabaut opened this issue · comments

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.

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

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.

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