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

x/text/cmd/gotext: gotext attempts to parse an editor temporary file as json #48983

Closed
mikhirev opened this issue Oct 14, 2021 · 1 comment
Closed
Labels
Milestone

Comments

@mikhirev
Copy link

@mikhirev mikhirev commented Oct 14, 2021

What version of Go are you using (go version)?

$ go version
go version go1.16.4 linux/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN="/home/dmitry/.local/bin"
GOCACHE="/home/dmitry/.cache/go-build"
GOENV="/home/dmitry/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/dmitry/go/pkg/mod"
GOOS="linux"
GOPATH="/home/dmitry/go"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.16"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.16/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.4"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3274181218=/tmp/go-build -gno-record-gcc-switches"

What 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 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).

@gopherbot gopherbot added this to the Unreleased milestone Oct 14, 2021
@seankhliao 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
@gopherbot
Copy link

@gopherbot gopherbot commented Oct 21, 2021

Change https://golang.org/cl/357734 mentions this issue: cmd/gotext: only match files ending with pattern

Loading

@gopherbot gopherbot closed this in 310d592 Nov 5, 2021
@dmitshur dmitshur removed this from the Unreleased milestone Nov 9, 2021
@dmitshur dmitshur added this to the Go1.18 milestone Nov 9, 2021
@dmitshur dmitshur removed this from the Go1.18 milestone Nov 9, 2021
@dmitshur dmitshur added this to the Unreleased milestone Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants