package resolution import ( "fmt" "strings" mcat "git.novox.be/novox/mesh-sdk/go/catalogue" ) // HeldTemplateProblem is why a manifest cannot be held by the mesh because it still names a template, or "": the // manifest the mesh holds carries every file's text, which a build reads back from its templates archive. One // naming a template was resolved by a builder that does not read templates, and would compose files with no text. func HeldTemplateProblem(m mcat.Manifest) string { var named []string for _, r := range m.Resources { if t, has := r[mcat.TemplateField]; has { named = append(named, fmt.Sprintf("%v (%v)", r["id"], t)) } } for _, it := range m.Items { if it.Template != "" { named = append(named, fmt.Sprintf("its item of %s (%s)", it.Collection, it.Template)) } } if len(named) == 0 { return "" } return fmt.Sprintf("%s still names the template(s) of %s: the manifest the mesh holds carries each file's "+ "text, read back from the build's templates archive — this one was resolved by a builder that does not "+ "read templates, or not built at all (novox/hq ADR 0349 §2)", m.Module, strings.Join(named, ", ")) }