func (ns *Namespace) ResolveCaveat(cav Caveat) Caveat {
	// TODO(rog) If a namespace isn't registered, try to resolve it by
	// resolving it to the latest compatible version that is
	// registered.
	if cav.Namespace == "" || cav.Location != "" {
		return cav
	}
	prefix, ok := ns.Resolve(cav.Namespace)
	if !ok {
		errCav := ErrorCaveatf("caveat %q in unregistered namespace %q", cav.Condition, cav.Namespace)
		if errCav.Namespace != cav.Namespace {
			prefix, _ = ns.Resolve(errCav.Namespace)
		}
		cav = errCav
	}
	if prefix != "" {
		cav.Condition = ConditionWithPrefix(prefix, cav.Condition)
	}
	cav.Namespace = ""
	return cav
}
// ResolveCaveat resolves the given caveat by using
// Resolve to map from its schema namespace to the appropriate prefix using
// Resolve. If there is no registered prefix for the namespace,
// it returns an error caveat.
//
// If ns.Namespace is empty or ns.Location is non-empty, it returns cav unchanged.
//
// If ns is nil, it is treated as if it were empty.
//
// ResolveCaveat does not mutate ns and may be called concurrently
// with other non-mutating Namespace methods.
ResolveCaveat resolves the given caveat by using
Resolve to map from its schema namespace to the appropriate prefix using
Resolve. If there is no registered prefix for the namespace,
it returns an error caveat.

If ns.Namespace is empty or ns.Location is non-empty, it returns cav unchanged.

If ns is nil, it is treated as if it were empty.

ResolveCaveat does not mutate ns and may be called concurrently
with other non-mutating Namespace methods.
// ResolveCaveat resolves the given caveat by using // Resolve to map from its schema namespace to the appropriate prefix using // Resolve . If there is no registered prefix for the namespace // it returns an error caveat . // // If ns . Namespace is empty or ns . Location is non - empty it returns cav unchanged . // // If ns is nil it is treated as if it were empty . // // ResolveCaveat does not mutate ns and may be called concurrently // with other non - mutating Namespace methods .
func (ns *Namespace) ResolveCaveat(cav Caveat) Caveat {
	if cav.Namespace == "" || cav.Location != "" {
		return cav
	}
	prefix, ok := ns.Resolve(cav.Namespace)
	if !ok {
		errCav := ErrorCaveatf("caveat %q in unregistered namespace %q", cav.Condition, cav.Namespace)
		if errCav.Namespace != cav.Namespace {
			prefix, _ = ns.Resolve(errCav.Namespace)
		}
		cav = errCav
	}
	if prefix != "" {
		cav.Condition = ConditionWithPrefix(prefix, cav.Condition)
	}
	cav.Namespace = ""
	return cav
}
func ( ns * Namespace ) ResolveCaveat ( cav Caveat ) Caveat { if cav . Namespace == " " || cav . Location != " " { return cav } prefix , ok := ns . Resolve ( cav . Namespace ) if ! ok { errCav := ErrorCaveatf ( " " , cav . Condition , cav . Namespace ) if errCav . Namespace != cav . Namespace { prefix , _ = ns . Resolve ( errCav . Namespace ) } cav = errCav } if prefix != " " { cav . Condition = ConditionWithPrefix ( prefix , cav . Condition ) } cav . Namespace = " " return cav }
ResolveCaveat resolves the given caveat by using
Resolve to map from its schema namespace to the appropriate prefix using
Resolve.
ResolveCaveat resolves the given caveat by using Resolve to map from its schema namespace to the appropriate prefix using Resolve .
// TODO(rog) If a namespace isn't registered, try to resolve it by // resolving it to the latest compatible version that is // registered.