mirror of
https://github.com/docker/docker-credential-helpers.git
synced 2026-06-13 16:01:28 +05:30
registryurl: deprecate GetHostname(), GetPort()
These were just wrappers for url.Hostname() and url.Port() Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -138,7 +138,7 @@ func (h Osxkeychain) List() (map[string]string, error) {
|
|||||||
listLen = int(listLenC)
|
listLen = int(listLenC)
|
||||||
pathTmp := (*[1 << 30]*C.char)(unsafe.Pointer(pathsC))[:listLen:listLen]
|
pathTmp := (*[1 << 30]*C.char)(unsafe.Pointer(pathsC))[:listLen:listLen]
|
||||||
acctTmp := (*[1 << 30]*C.char)(unsafe.Pointer(acctsC))[:listLen:listLen]
|
acctTmp := (*[1 << 30]*C.char)(unsafe.Pointer(acctsC))[:listLen:listLen]
|
||||||
//taking the array of c strings into go while ignoring all the stuff irrelevant to credentials-helper
|
// taking the array of c strings into go while ignoring all the stuff irrelevant to credentials-helper
|
||||||
resp := make(map[string]string)
|
resp := make(map[string]string)
|
||||||
for i := 0; i < listLen; i++ {
|
for i := 0; i < listLen; i++ {
|
||||||
if C.GoString(pathTmp[i]) == "0" {
|
if C.GoString(pathTmp[i]) == "0" {
|
||||||
@@ -160,7 +160,7 @@ func splitServer(serverURL string) (*C.struct_Server, error) {
|
|||||||
proto = C.kSecProtocolTypeHTTP
|
proto = C.kSecProtocolTypeHTTP
|
||||||
}
|
}
|
||||||
var port int
|
var port int
|
||||||
p := registryurl.GetPort(u)
|
p := u.Port()
|
||||||
if p != "" {
|
if p != "" {
|
||||||
port, err = strconv.Atoi(p)
|
port, err = strconv.Atoi(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -170,7 +170,7 @@ func splitServer(serverURL string) (*C.struct_Server, error) {
|
|||||||
|
|
||||||
return &C.struct_Server{
|
return &C.struct_Server{
|
||||||
proto: C.SecProtocolType(proto),
|
proto: C.SecProtocolType(proto),
|
||||||
host: C.CString(registryurl.GetHostname(u)),
|
host: C.CString(u.Hostname()),
|
||||||
port: C.uint(port),
|
port: C.uint(port),
|
||||||
path: C.CString(u.Path),
|
path: C.CString(u.Path),
|
||||||
}, nil
|
}, nil
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ func Parse(registryURL string) (*url.URL, error) {
|
|||||||
return nil, errors.New("unsupported scheme: " + u.Scheme)
|
return nil, errors.New("unsupported scheme: " + u.Scheme)
|
||||||
}
|
}
|
||||||
|
|
||||||
if GetHostname(u) == "" {
|
if u.Hostname() == "" {
|
||||||
return nil, errors.New("no hostname in URL")
|
return nil, errors.New("no hostname in URL")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,11 +37,15 @@ func Parse(registryURL string) (*url.URL, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetHostname returns the hostname of the URL
|
// GetHostname returns the hostname of the URL
|
||||||
|
//
|
||||||
|
// Deprecated: use url.Hostname()
|
||||||
func GetHostname(u *url.URL) string {
|
func GetHostname(u *url.URL) string {
|
||||||
return u.Hostname()
|
return u.Hostname()
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPort returns the port number of the URL
|
// GetPort returns the port number of the URL
|
||||||
|
//
|
||||||
|
// Deprecated: use url.Port()
|
||||||
func GetPort(u *url.URL) string {
|
func GetPort(u *url.URL) string {
|
||||||
return u.Port()
|
return u.Port()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user