You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use vim to edit translation files. I had a translation file (locales/ru-RU/messages.gotext.json) opened in vim and tried to run gotext update.
What did you expect to see?
gotext generating new catalog file without errors.
What did you see instead?
gotext: import failed: parsing translation file failed: invalid character 'b' looking for beginning of value
Investigation
As I figured out, gotext attempts to parse vim's temporary file locales/ru-RU/.messages.gotext.json.swp as if it were a translation file. I suppose, gotext should ignore such files (i. e. all dotfiles, or only parse files with .json extension).
The text was updated successfully, but these errors were encountered:
seankhliao
changed the title
x/text: gotext attempts to parse an editor temporary file as json
x/text/cmd/gotext: gotext attempts to parse an editor temporary file as json
Oct 21, 2021
dmitshur
added
NeedsFix
The path to resolution is known, but the work has not been done.
and removed
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
labels
Nov 9, 2021
Exclude files with other extensions like .json.swp from editors.
Fixesgolang/go#48983
Change-Id: Id74ca7ae208688cf900661d641e5403d453da33c
Reviewed-on: https://go-review.googlesource.com/c/text/+/357734
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
Trust: Marcel van Lohuizen <mpvl@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I use vim to edit translation files. I had a translation file (
locales/ru-RU/messages.gotext.json
) opened in vim and tried to rungotext update
.What did you expect to see?
gotext
generating new catalog file without errors.What did you see instead?
Investigation
As I figured out, gotext attempts to parse vim's temporary file
locales/ru-RU/.messages.gotext.json.swp
as if it were a translation file. I suppose, gotext should ignore such files (i. e. all dotfiles, or only parse files with.json
extension).The text was updated successfully, but these errors were encountered: