i18n4go icon indicating copy to clipboard operation
i18n4go copied to clipboard

Missing placeholder for importing the go-bindata resource method in the template

Open Aerex opened this issue 11 months ago • 0 comments

Context

The CLI assumes that the user will use go-bindata to generate a binary file of the localization JSON files. When running the command rewrite-command the CLI will generate a i18n_init.go from a template provided by the CLI (assuming the --init-code-snippet-filename is not provided).

The generated i18n_init.go will call the method resources.Asset to retrieve the binary file. The file does not contain the import for calling the Asset method so a runtime error will be thrown when building the source code that was modified by the rewrite-command

Suggestions

  1. Include in the docs that the user must have generate the binary file using go-bindata and import the go file (i18n_resources.go) into the generated i18n_init.go
  2. Generate the binary data for the user and add the import to the generated i18n_init.go

Caveats

For options 2, go-bindata doesn't have a library that we can call to run the generation.

Aerex avatar Mar 01 '24 21:03 Aerex