mirror of
https://github.com/golang/go
synced 2024-11-18 19:44:46 -07:00
go/vcs: allow go get on github.com/ import paths with Unicode letters
Manually apply same change as CL 41822 did for cmd/go/internal/get, but for golang.org/x/tools/go/vcs, to help keep them in sync. Updates golang/go#18660. Helps golang/go#11490. Change-Id: I6c7759c073583dea771bc438b70f8c2eb7b5ebfb Reviewed-on: https://go-review.googlesource.com/42017 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
b6d1a163df
commit
2382e3994d
@ -602,7 +602,7 @@ var vcsPaths = []*vcsPath{
|
||||
// Github
|
||||
{
|
||||
prefix: "github.com/",
|
||||
re: `^(?P<root>github\.com/[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+)(/[A-Za-z0-9_.\-]+)*$`,
|
||||
re: `^(?P<root>github\.com/[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+)(/[\p{L}0-9_.\-]+)*$`,
|
||||
vcs: "git",
|
||||
repo: "https://{root}",
|
||||
check: noVCSSuffix,
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user