소스 검색

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>
Sebastiaan van Stijn 3 년 전
부모
커밋
074bc1c3ab
2개의 변경된 파일2개의 추가작업 그리고 23개의 파일을 삭제
  1. 2 8
      pkg/urlutil/urlutil.go
  2. 0 15
      pkg/urlutil/urlutil_test.go

+ 2 - 8
pkg/urlutil/urlutil.go

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

+ 0 - 15
pkg/urlutil/urlutil_test.go

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