From 0b652209368ddc7643acc519505d742a5d86ec96 Mon Sep 17 00:00:00 2001 From: Blake Mizerany Date: Fri, 5 Apr 2024 19:10:46 -0700 Subject: [PATCH] x/model: remove Has until needed --- x/model/name.go | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/x/model/name.go b/x/model/name.go index dbb5205e..84a99d09 100644 --- a/x/model/name.go +++ b/x/model/name.go @@ -167,23 +167,6 @@ func (r Name) WithBuild(build string) Name { return r } -// Has reports whether the Name has the given part kind. -func (r Name) Has(kind NamePartKind) bool { - switch kind { - case Host: - return r.host != "" - case Namespace: - return r.namespace != "" - case Model: - return r.model != "" - case Tag: - return r.tag != "" - case Build: - return r.build != "" - } - return false -} - var mapHashSeed = maphash.MakeSeed() // MapHash returns a case insensitive hash for use in maps and equality @@ -404,7 +387,7 @@ func NameParts(s string) iter.Seq2[NamePartKind, string] { func (r Name) Valid() bool { // Parts ensures we only have valid parts, so no need to validate // them here, only check if we have a name or not. - return r.Has(Model) + return r.model != "" } // isValidPart returns true if given part is valid ascii [a-zA-Z0-9_\.-]