소스 검색

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

Blake Mizerany 1 년 전
부모
커밋
a4fd06d603
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  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://") {