diff --git a/src/cmd/go/internal/vcs/vcs.go b/src/cmd/go/internal/vcs/vcs.go index 4f16bef90c..9ea8eb2bad 100644 --- a/src/cmd/go/internal/vcs/vcs.go +++ b/src/cmd/go/internal/vcs/vcs.go @@ -253,7 +253,7 @@ var vcsGit = &Cmd{ // scpSyntaxRe matches the SCP-like addresses used by Git to access // repositories by SSH. -var scpSyntaxRe = lazyregexp.New(`^([a-zA-Z0-9_]+)@([a-zA-Z0-9._-]+):(.*)$`) +var scpSyntaxRe = lazyregexp.New(`^(\w+)@([\w.-]+):(.*)$`) func gitRemoteRepo(vcsGit *Cmd, rootDir string) (remoteRepo string, err error) { cmd := "config remote.origin.url" @@ -1438,7 +1438,7 @@ var vcsPaths = []*vcsPath{ // GitHub { pathPrefix: "github.com", - regexp: lazyregexp.New(`^(?Pgithub\.com/[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+)(/[A-Za-z0-9_.\-]+)*$`), + regexp: lazyregexp.New(`^(?Pgithub\.com/[\w.\-]+/[\w.\-]+)(/[\w.\-]+)*$`), vcs: "git", repo: "https://{root}", check: noVCSSuffix, @@ -1447,7 +1447,7 @@ var vcsPaths = []*vcsPath{ // Bitbucket { pathPrefix: "bitbucket.org", - regexp: lazyregexp.New(`^(?Pbitbucket\.org/(?P[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+))(/[A-Za-z0-9_.\-]+)*$`), + regexp: lazyregexp.New(`^(?Pbitbucket\.org/(?P[\w.\-]+/[\w.\-]+))(/[\w.\-]+)*$`), vcs: "git", repo: "https://{root}", check: noVCSSuffix, @@ -1456,7 +1456,7 @@ var vcsPaths = []*vcsPath{ // IBM DevOps Services (JazzHub) { pathPrefix: "hub.jazz.net/git", - regexp: lazyregexp.New(`^(?Phub\.jazz\.net/git/[a-z0-9]+/[A-Za-z0-9_.\-]+)(/[A-Za-z0-9_.\-]+)*$`), + regexp: lazyregexp.New(`^(?Phub\.jazz\.net/git/[a-z0-9]+/[\w.\-]+)(/[\w.\-]+)*$`), vcs: "git", repo: "https://{root}", check: noVCSSuffix, @@ -1465,7 +1465,7 @@ var vcsPaths = []*vcsPath{ // Git at Apache { pathPrefix: "git.apache.org", - regexp: lazyregexp.New(`^(?Pgit\.apache\.org/[a-z0-9_.\-]+\.git)(/[A-Za-z0-9_.\-]+)*$`), + regexp: lazyregexp.New(`^(?Pgit\.apache\.org/[a-z0-9_.\-]+\.git)(/[\w.\-]+)*$`), vcs: "git", repo: "https://{root}", }, @@ -1473,7 +1473,7 @@ var vcsPaths = []*vcsPath{ // Git at OpenStack { pathPrefix: "git.openstack.org", - regexp: lazyregexp.New(`^(?Pgit\.openstack\.org/[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+)(\.git)?(/[A-Za-z0-9_.\-]+)*$`), + regexp: lazyregexp.New(`^(?Pgit\.openstack\.org/[\w.\-]+/[\w.\-]+)(\.git)?(/[\w.\-]+)*$`), vcs: "git", repo: "https://{root}", }, @@ -1481,7 +1481,7 @@ var vcsPaths = []*vcsPath{ // chiselapp.com for fossil { pathPrefix: "chiselapp.com", - regexp: lazyregexp.New(`^(?Pchiselapp\.com/user/[A-Za-z0-9]+/repository/[A-Za-z0-9_.\-]+)$`), + regexp: lazyregexp.New(`^(?Pchiselapp\.com/user/[A-Za-z0-9]+/repository/[\w.\-]+)$`), vcs: "fossil", repo: "https://{root}", }, @@ -1489,7 +1489,7 @@ var vcsPaths = []*vcsPath{ // General syntax for any server. // Must be last. { - regexp: lazyregexp.New(`(?P(?P([a-z0-9.\-]+\.)+[a-z0-9.\-]+(:[0-9]+)?(/~?[A-Za-z0-9_.\-]+)+?)\.(?Pbzr|fossil|git|hg|svn))(/~?[A-Za-z0-9_.\-]+)*$`), + regexp: lazyregexp.New(`(?P(?P([a-z0-9.\-]+\.)+[a-z0-9.\-]+(:[0-9]+)?(/~?[\w.\-]+)+?)\.(?Pbzr|fossil|git|hg|svn))(/~?[\w.\-]+)*$`), schemelessRepo: true, }, } @@ -1502,7 +1502,7 @@ var vcsPathsAfterDynamic = []*vcsPath{ // Launchpad. See golang.org/issue/11436. { pathPrefix: "launchpad.net", - regexp: lazyregexp.New(`^(?Plaunchpad\.net/((?P[A-Za-z0-9_.\-]+)(?P/[A-Za-z0-9_.\-]+)?|~[A-Za-z0-9_.\-]+/(\+junk|[A-Za-z0-9_.\-]+)/[A-Za-z0-9_.\-]+))(/[A-Za-z0-9_.\-]+)*$`), + regexp: lazyregexp.New(`^(?Plaunchpad\.net/((?P[\w.\-]+)(?P/[\w.\-]+)?|~[\w.\-]+/(\+junk|[\w.\-]+)/[\w.\-]+))(/[\w.\-]+)*$`), vcs: "bzr", repo: "https://{root}", check: launchpadVCS,