internal/testprotos/legacy: rename and regenerate

Avoid dots and dashes in the directory to avoid issues on
build systems that cannot support them well.

Change-Id: I7ea5e6ce0b16c7158c7e53bcf5c3c1a334fe4718
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/214342
Reviewed-by: Damien Neil <dneil@google.com>
diff --git a/internal/cmd/generate-protos/main.go b/internal/cmd/generate-protos/main.go
index 734aa26..1415b93 100644
--- a/internal/cmd/generate-protos/main.go
+++ b/internal/cmd/generate-protos/main.go
@@ -114,7 +114,7 @@
 		{path: "encoding/testprotos"},
 		{path: "reflect/protoregistry/testprotos"},
 	}
-	semVerRx := regexp.MustCompile(`v[0-9]+\.[0-9]+\.[0-9]+`)
+	excludeRx := regexp.MustCompile(`legacy/proto[23]_[0-9]{8}_[0-9a-f]{8}/`)
 	for _, d := range dirs {
 		subDirs := map[string]bool{}
 
@@ -123,7 +123,7 @@
 
 		srcDir := filepath.Join(repoRoot, filepath.FromSlash(d.path))
 		filepath.Walk(srcDir, func(srcPath string, _ os.FileInfo, _ error) error {
-			if !strings.HasSuffix(srcPath, ".proto") || semVerRx.MatchString(srcPath) {
+			if !strings.HasSuffix(srcPath, ".proto") || excludeRx.MatchString(srcPath) {
 				return nil
 			}
 			relPath, err := filepath.Rel(srcDir, srcPath)