types/model: reduce Name.Filepath allocs from 5 to 2 (#4039)

This commit is contained in:
Blake Mizerany
2024-04-30 11:09:19 -07:00
committed by GitHub
parent 0a7fdbe533
commit 588901f449
2 changed files with 21 additions and 6 deletions

View File

@@ -231,12 +231,12 @@ func (n Name) Filepath() string {
if !n.IsFullyQualified() {
panic("illegal attempt to get filepath of invalid name")
}
return filepath.Join(
strings.ToLower(n.Host),
strings.ToLower(n.Namespace),
strings.ToLower(n.Model),
strings.ToLower(n.Tag),
)
return strings.ToLower(filepath.Join(
n.Host,
n.Namespace,
n.Model,
n.Tag,
))
}
// LogValue returns a slog.Value that represents the name as a string.