x/model: be more clear slice bound for CompleteNoBuild

Also, update TODO.
This commit is contained in:
Blake Mizerany 2024-04-06 14:06:31 -07:00
parent d35a6a577f
commit 2f241692bd

View File

@ -252,9 +252,6 @@ var builderPool = sync.Pool{
}, },
} }
// TODO(bmizerany): Add WriteTo and use in String and MarshalText with
// strings.Builder and bytes.Buffer, respectively.
// String returns the fullest possible display string in form: // String returns the fullest possible display string in form:
// //
// <host>/<namespace>/<model>:<tag>+<build> // <host>/<namespace>/<model>:<tag>+<build>
@ -331,7 +328,7 @@ func (r Name) Complete() bool {
// CompleteNoBuild is like [Name.Complete] but it does not require the // CompleteNoBuild is like [Name.Complete] but it does not require the
// build part to be present. // build part to be present.
func (r Name) CompleteNoBuild() bool { func (r Name) CompleteNoBuild() bool {
return !slices.Contains(r.parts[:Tag], "") return !slices.Contains(r.parts[:Build-1], "")
} }
// EqualFold reports whether r and o are equivalent model names, ignoring // EqualFold reports whether r and o are equivalent model names, ignoring