func()

in wfn/uri.go [24:61]


func (a Attributes) BindToURI() string {
	var parts []string
	for i, v := range []string{
		a.Part,
		a.Vendor,
		a.Product,
		a.Version,
		a.Update,
		"",
		a.Language,
	} {
		if i != 5 { // other than edition
			parts = append(parts, bindValueURI(v))
			continue
		}
		edParts := make([]string, 5)
		allNAs := true
		for i, v2 := range []string{a.Edition, a.SWEdition, a.TargetSW, a.TargetHW, a.Other} {
			edParts[i] = bindValueURI(v2)
			if edParts[i] != "-" {
				allNAs = false
			}
		}
		if allNAs {
			parts = append(parts, "-")
		} else {
			parts = append(parts, pack(edParts))
		}
	}
	// empty elements at the end of the URI should be omitted
	for i := len(parts) - 1; i >= 0; i-- {
		if parts[i] != "" {
			break
		}
		parts = parts[:i]
	}
	return uriPrefix + strings.Join(parts, ":")
}