x/model: remove part getters; these should rarely be needed if ever

This commit is contained in:
Blake Mizerany 2024-04-05 20:55:31 -07:00
parent c5768ceffe
commit 9821ca28e8
2 changed files with 5 additions and 11 deletions

View File

@ -280,12 +280,6 @@ func (r Name) Parts() []string {
} }
} }
func (r Name) Host() string { return r.host }
func (r Name) Namespace() string { return r.namespace }
func (r Name) Model() string { return r.model }
func (r Name) Tag() string { return r.tag }
func (r Name) Build() string { return r.build }
// EqualFold reports whether r and o are equivalent model names, ignoring // EqualFold reports whether r and o are equivalent model names, ignoring
// case. // case.
func (r Name) EqualFold(o Name) bool { func (r Name) EqualFold(o Name) bool {

View File

@ -121,10 +121,10 @@ func TestParseName(t *testing.T) {
t.Errorf("String() = %s; want %s", got.String(), baseName) t.Errorf("String() = %s; want %s", got.String(), baseName)
} }
if got.Valid() && got.Model() == "" { if got.Valid() && got.model == "" {
t.Errorf("Valid() = true; Model() = %q; want non-empty name", got.Model()) t.Errorf("Valid() = true; Model() = %q; want non-empty name", got.model)
} else if !got.Valid() && got.Model() != "" { } else if !got.Valid() && got.DisplayModel() != "" {
t.Errorf("Valid() = false; Model() = %q; want empty name", got.Model()) t.Errorf("Valid() = false; Model() = %q; want empty name", got.model)
} }
}) })
} }
@ -223,7 +223,7 @@ func TestNameDisplay(t *testing.T) {
if g := p.String(); g != tt.in { if g := p.String(); g != tt.in {
t.Errorf("String(%q) = %q; want %q", tt.in, g, tt.in) t.Errorf("String(%q) = %q; want %q", tt.in, g, tt.in)
} }
if g := p.Model(); g != tt.wantModel { if g := p.DisplayModel(); g != tt.wantModel {
t.Errorf("Model = %q; want %q", g, tt.wantModel) t.Errorf("Model = %q; want %q", g, tt.wantModel)
} }
if g, w := fmt.Sprintf("%#v", p), p.DisplayComplete(); g != w { if g, w := fmt.Sprintf("%#v", p), p.DisplayComplete(); g != w {