Ver Fonte

x/model: doc Merge semantics when dst is not valid

Blake Mizerany há 1 ano atrás
pai
commit
a4fd06d603
1 ficheiros alterados com 5 adições e 0 exclusões
  1. 5 0
      x/model/name.go

+ 5 - 0
x/model/name.go

@@ -181,6 +181,8 @@ func ParseName(s string) Name {
 //
 // Use this for merging a fully qualified ref with a partial ref, such as
 // when filling in a missing parts with defaults.
+//
+// The returned Name will only be valid if dst is valid.
 func Merge(dst, src Name) Name {
 	return Name{
 		// name is left untouched
@@ -204,6 +206,9 @@ func (r Name) WithBuild(build string) Name {
 //
 // It normalizes the input string by removing "http://" and "https://" only.
 // No other normalization is done.
+//
+// As a special case, question marks are ignored so they may be used as
+// placeholders for missing parts in string literals.
 func NameParts(s string) iter.Seq2[NamePart, string] {
 	return func(yield func(NamePart, string) bool) {
 		if strings.HasPrefix(s, "http://") {