func validateRegistryURL(registryURL string) error {
	var (
		u     *url.URL
		err   error
		parts = strings.SplitN(registryURL, "://", 2)
	)

	switch len(parts) {
	case 2:
		u, err = url.Parse(registryURL)
		if err != nil {
			return err
		}
		switch u.Scheme {
		case "http", "https":
		default:
			return fmt.Errorf("unsupported scheme: %s", u.Scheme)
		}
	case 1:
		u, err = url.Parse("https://" + registryURL)
		if err != nil {
			return err
		}
	}
	if len(u.Path) > 0 && u.Path != "/" {
		return errNoRegistryURLPathAllowed
	}
	if len(u.RawQuery) > 0 {
		return errNoRegistryURLQueryAllowed
	}
	if len(u.Host) == 0 {
		return errRegistryURLHostEmpty
	}
	return nil
}
// validateRegistryURL returns error if the given input is not a valid registry URL. The url may be prefixed
// with http:// or https:// schema. It may not contain any path or query after the host:[port].
validateRegistryURL returns error if the given input is not a valid registry URL. The url may be prefixed
with http:// or https:// schema. It may not contain any path or query after the host:[port].
// validateRegistryURL returns error if the given input is not a valid registry URL . The url may be prefixed // with http : // or https : // schema . It may not contain any path or query after the host : [ port ] .
func validateRegistryURL(registryURL string) error {
	var (
		u     *url.URL
		err   error
		parts = strings.SplitN(registryURL, "://", 2)
	)
	switch len(parts) {
	case 2:
		u, err = url.Parse(registryURL)
		if err != nil {
			return err
		}
		switch u.Scheme {
		case "http", "https":
		default:
			return fmt.Errorf("unsupported scheme: %s", u.Scheme)
		}
	case 1:
		u, err = url.Parse("https://" + registryURL)
		if err != nil {
			return err
		}
	}
	if len(u.Path) > 0 && u.Path != "/" {
		return errNoRegistryURLPathAllowed
	}
	if len(u.RawQuery) > 0 {
		return errNoRegistryURLQueryAllowed
	}
	if len(u.Host) == 0 {
		return errRegistryURLHostEmpty
	}
	return nil
}
func validateRegistryURL ( registryURL string ) error { var ( u * url . URL err error parts = strings . SplitN ( registryURL , " " , 2 ) ) switch len ( parts ) { case 2 : u , err = url . Parse ( registryURL ) if err != nil { return err } switch u . Scheme { case " " , " " : default : return fmt . Errorf ( " " , u . Scheme ) } case 1 : u , err = url . Parse ( " " + registryURL ) if err != nil { return err } } if len ( u . Path ) > 0 && u . Path != " " { return errNoRegistryURLPathAllowed } if len ( u . RawQuery ) > 0 { return errNoRegistryURLQueryAllowed } if len ( u . Host ) == 0 { return errRegistryURLHostEmpty } return nil }
validateRegistryURL returns error if the given input is not a valid registry URL.
validateRegistryURL returns error if the given input is not a valid registry URL .