diff --git a/go/vcs/vcs.go b/go/vcs/vcs.go index 7a11391054d..3c56a950977 100644 --- a/go/vcs/vcs.go +++ b/go/vcs/vcs.go @@ -602,7 +602,7 @@ var vcsPaths = []*vcsPath{ // Github { prefix: "github.com/", - re: `^(?Pgithub\.com/[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+)(/[A-Za-z0-9_.\-]+)*$`, + re: `^(?Pgithub\.com/[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+)(/[\p{L}0-9_.\-]+)*$`, vcs: "git", repo: "https://{root}", check: noVCSSuffix, diff --git a/go/vcs/vcs_test.go b/go/vcs/vcs_test.go index 5817ded1e34..8f36cac70c7 100644 --- a/go/vcs/vcs_test.go +++ b/go/vcs/vcs_test.go @@ -33,17 +33,25 @@ func TestRepoRootForImportPath(t *testing.T) { Repo: "https://github.com/golang/groupcache", }, }, + // Unicode letters in directories (issue 18660). + { + "github.com/user/unicode/испытание", + &RepoRoot{ + VCS: vcsGit, + Repo: "https://github.com/user/unicode", + }, + }, } for _, test := range tests { got, err := RepoRootForImportPath(test.path, false) if err != nil { - t.Errorf("RepoRootForImport(%q): %v", test.path, err) + t.Errorf("RepoRootForImportPath(%q): %v", test.path, err) continue } want := test.want if got.VCS.Name != want.VCS.Name || got.Repo != want.Repo { - t.Errorf("RepoRootForImport(%q) = VCS(%s) Repo(%s), want VCS(%s) Repo(%s)", test.path, got.VCS, got.Repo, want.VCS, want.Repo) + t.Errorf("RepoRootForImportPath(%q) = VCS(%s) Repo(%s), want VCS(%s) Repo(%s)", test.path, got.VCS, got.Repo, want.VCS, want.Repo) } } }