func EnsureSchema(url string, defaultSchema Schema) (string, error) {
	u, err := gourl.Parse(url)
	if err != nil {
		return "", errors.Errorf("cannot parse charm or bundle URL: %q", url)
	}
	switch Schema(u.Scheme) {
	case CharmStore, CharmHub, Local, HTTP, HTTPS:
		return url, nil
	case Schema(""):
		// If the schema is empty, we fall back to the default schema.
		return defaultSchema.Prefix(url), nil
	default:
		return "", errors.NotValidf("schema %q", u.Scheme)
	}
}
// EnsureSchema will ensure that the scheme for a given URL is correct and
// valid. If the url does not specify a schema, the provided defaultSchema
// will be injected to it.
EnsureSchema will ensure that the scheme for a given URL is correct and
valid. If the url does not specify a schema, the provided defaultSchema
will be injected to it.
// EnsureSchema will ensure that the scheme for a given URL is correct and // valid . If the url does not specify a schema the provided defaultSchema // will be injected to it .
func EnsureSchema(url string, defaultSchema Schema) (string, error) {
	u, err := gourl.Parse(url)
	if err != nil {
		return "", errors.Errorf("cannot parse charm or bundle URL: %q", url)
	}
	switch Schema(u.Scheme) {
	case CharmStore, CharmHub, Local, HTTP, HTTPS:
		return url, nil
	case Schema(""):
		return defaultSchema.Prefix(url), nil
	default:
		return "", errors.NotValidf("schema %q", u.Scheme)
	}
}
func EnsureSchema ( url string , defaultSchema Schema ) ( string , error ) { u , err := gourl . Parse ( url ) if err != nil { return " " , errors . Errorf ( " " , url ) } switch Schema ( u . Scheme ) { case CharmStore , CharmHub , Local , HTTP , HTTPS : return url , nil case Schema ( " " ) : return defaultSchema . Prefix ( url ) , nil default : return " " , errors . NotValidf ( " " , u . Scheme ) } }
EnsureSchema will ensure that the scheme for a given URL is correct and
valid.
EnsureSchema will ensure that the scheme for a given URL is correct and valid .
// If the schema is empty, we fall back to the default schema.