1
0
Fork 0
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:
Sebastiaan van Stijn 2022-04-10 15:28:17 +02:00
parent bca8d9f2ce
commit 074bc1c3ab
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
2 changed files with 2 additions and 23 deletions

View file

@ -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 (
@ -18,8 +18,7 @@ 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://"},
"git": {"git://", "github.com/", "git@"},
}
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) {

View file

@ -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)
}
}
}