Skip to content
This repository has been archived by the owner on Jan 16, 2021. It is now read-only.

Commit

Permalink
Allow username in package name
Browse files Browse the repository at this point in the history
Don't fail if a vanity service returns
a package name with a SSH url and a
username, such as ssh://[email protected]/org/package.
  • Loading branch information
Himanshu Rathod committed Oct 9, 2018
1 parent 6c03585 commit 4eeecce
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion gosrc/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ func IsValidRemotePath(importPath string) bool {
return false
}

if !validHost.MatchString(parts[0]) {
// use only the hostname, if there is a username in the package name
hostparts := strings.Split(parts[0], "@")
host := hostparts[0]
if len(hostparts) > 1 {
host = hostparts[1]
}

if !validHost.MatchString(host) {
return false
}

Expand Down

0 comments on commit 4eeecce

Please sign in to comment.