cmd/gotext: only match files ending with pattern

Exclude files with other extensions like .json.swp from editors.

Fixes golang/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>
diff --git a/cmd/gotext/main.go b/cmd/gotext/main.go
index f31dd4f..c8dc799 100644
--- a/cmd/gotext/main.go
+++ b/cmd/gotext/main.go
@@ -48,7 +48,7 @@
 	return &pipeline.Config{
 		SourceLanguage:      tag,
 		Supported:           getLangs(),
-		TranslationsPattern: `messages\.(.*)\.json`,
+		TranslationsPattern: `messages\.(.*)\.json$`,
 		GenFile:             *out,
 	}, nil
 }