mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
pkg/urlutil: remove unused IsTransportURL()
This function is no longer used (either internally, or externally), so can be removed. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
bca8d9f2ce
commit
074bc1c3ab
2 changed files with 2 additions and 23 deletions
|
@ -1,5 +1,5 @@
|
|||
// Package urlutil provides helper function to check urls kind.
|
||||
// It supports http urls, git urls and transport url (tcp://, …)
|
||||
// It supports http and git urls.
|
||||
package urlutil // import "github.com/docker/docker/pkg/urlutil"
|
||||
|
||||
import (
|
||||
|
@ -19,7 +19,6 @@ var (
|
|||
// Going forward, no additional prefixes should be added, and users should
|
||||
// be encouraged to use explicit URLs (https://github.com/user/repo.git) instead.
|
||||
"git": {"git://", "github.com/", "git@"},
|
||||
"transport": {"tcp://", "tcp+tls://", "udp://", "unix://", "unixgram://"},
|
||||
}
|
||||
urlPathWithFragmentSuffix = regexp.MustCompile(".git(?:#.+)?$")
|
||||
)
|
||||
|
@ -37,11 +36,6 @@ func IsGitURL(str string) bool {
|
|||
return checkURL(str, "git")
|
||||
}
|
||||
|
||||
// IsTransportURL returns true if the provided str is a transport (tcp, tcp+tls, udp, unix) URL.
|
||||
func IsTransportURL(str string) bool {
|
||||
return checkURL(str, "transport")
|
||||
}
|
||||
|
||||
func checkURL(str, kind string) bool {
|
||||
for _, prefix := range validPrefixes[kind] {
|
||||
if strings.HasPrefix(str, prefix) {
|
||||
|
|
|
@ -18,13 +18,6 @@ var (
|
|||
invalidGitUrls = []string{
|
||||
"http://github.com/docker/docker.git:#branch",
|
||||
}
|
||||
transportUrls = []string{
|
||||
"tcp://example.com",
|
||||
"tcp+tls://example.com",
|
||||
"udp://example.com",
|
||||
"unix:///example",
|
||||
"unixgram:///example",
|
||||
}
|
||||
)
|
||||
|
||||
func TestIsGIT(t *testing.T) {
|
||||
|
@ -46,11 +39,3 @@ func TestIsGIT(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsTransport(t *testing.T) {
|
||||
for _, url := range transportUrls {
|
||||
if !IsTransportURL(url) {
|
||||
t.Fatalf("%q should be detected as valid Transport url", url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue