scheme.go
func registerAlias(name, alias string, doSort bool) {
	scheme, ok := schemeMap[name]
	if !ok {
		panic(fmt.Sprintf("scheme %s not registered", name))
	}

	if doSort && has(scheme.Aliases, alias) {
		panic(fmt.Sprintf("scheme %s already has alias %s", name, alias))
	}

	if _, ok := schemeMap[alias]; ok {
		panic(fmt.Sprintf("scheme %s already registered", alias))
	}

	scheme.Aliases = append(scheme.Aliases, alias)
	if doSort {
		sort.Sort(ss(scheme.Aliases))
	}

	schemeMap[alias] = scheme
}
func registerAlias(name, alias string, doSort bool) {
	scheme, ok := schemeMap[name]
	if !ok {
		panic(fmt.Sprintf("scheme %s not registered", name))
	}

	if doSort && has(scheme.Aliases, alias) {
		panic(fmt.Sprintf("scheme %s already has alias %s", name, alias))
	}

	if _, ok := schemeMap[alias]; ok {
		panic(fmt.Sprintf("scheme %s already registered", alias))
	}

	scheme.Aliases = append(scheme.Aliases, alias)
	if doSort {
		sort.Sort(ss(scheme.Aliases))
	}

	schemeMap[alias] = scheme
}
func registerAlias ( name , alias string , doSort bool ) { scheme , ok := schemeMap [ name ] if ! ok { panic ( fmt . Sprintf ( " " , name ) ) } if doSort && has ( scheme . Aliases , alias ) { panic ( fmt . Sprintf ( " " , name , alias ) ) } if _ , ok := schemeMap [ alias ] ; ok { panic ( fmt . Sprintf ( " " , alias ) ) } scheme . Aliases = append ( scheme . Aliases , alias ) if doSort { sort . Sort ( ss ( scheme . Aliases ) ) } schemeMap [ alias ] = scheme }
// registerAlias registers a alias for an already registered Scheme.
registerAlias registers a alias for an already registered Scheme .