diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-02-11 12:14:07 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-02-11 12:14:07 +0100 |
commit | c4c55c0fa591b2e354dbb085e0e1c83bb3bce210 (patch) | |
tree | 6e1261d349a533d1bc99eb87aa90ac1fe6d27a20 /clients/common.go | |
parent | d3a39f2797d817a402ffdd8d1e321bf9c5700647 (diff) | |
download | go-git-c4c55c0fa591b2e354dbb085e0e1c83bb3bce210.tar.gz |
clients: cleanup
Diffstat (limited to 'clients/common.go')
-rw-r--r-- | clients/common.go | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/clients/common.go b/clients/common.go index 24b3d63..039404d 100644 --- a/clients/common.go +++ b/clients/common.go @@ -20,14 +20,7 @@ import ( "gopkg.in/src-d/go-git.v2/clients/ssh" ) -// ServiceFromURLFunc defines a service returning function for a given -// URL. -type ServiceFromURLFunc func(url string) common.GitUploadPackService - // DefaultProtocols are the protocols supported by default. -// Wrapping is needed because you can not cast a function that -// returns an implementation of an interface to a function that -// returns the interface. var DefaultProtocols = map[string]common.GitUploadPackService{ "http": http.NewGitUploadPackService(), "https": http.NewGitUploadPackService(), @@ -41,8 +34,17 @@ var KnownProtocols = make(map[string]common.GitUploadPackService, len(DefaultPro func init() { for k, v := range DefaultProtocols { - KnownProtocols[k] = v + InstallProtocol(k, v) + } +} + +// InstallProtocol adds or modifies an existing protocol. +func InstallProtocol(scheme string, service common.GitUploadPackService) { + if service == nil { + panic("nil service") } + + KnownProtocols[scheme] = service } // NewGitUploadPackService returns the appropiate upload pack service @@ -60,12 +62,3 @@ func NewGitUploadPackService(repoURL string) (common.GitUploadPackService, error return service, nil } - -// InstallProtocol adds or modifies an existing protocol. -func InstallProtocol(scheme string, service common.GitUploadPackService) { - if service == nil { - panic("nil service") - } - - KnownProtocols[scheme] = service -} |