MCPcopy Create free account
hub / github.com/abiosoft/mold / validateLayoutFile

Function validateLayoutFile

engine.go:272–284  ·  view source on GitHub ↗
(exts []string, name string)

Source from the content-addressed store, hash-verified

270}
271
272func validateLayoutFile(exts []string, name string) error {
273 ext := filepath.Ext(name)
274 if !hasExt(exts, ext) {
275 return fmt.Errorf("unsupported filename extension '%s'", ext)
276 }
277
278 nameOnly := strings.TrimSuffix(name, ext)
279 if !strings.HasSuffix(strings.ToLower(nameOnly), "layout") {
280 return fmt.Errorf("invalid file name, must be suffixed with 'layout'. e.g. layout%s", ext)
281 }
282
283 return nil
284}
285
286func placeholderFuncs() template.FuncMap {
287 return map[string]any{

Callers 2

walkFunction · 0.85
setupFunction · 0.85

Calls 1

hasExtFunction · 0.85

Tested by

no test coverage detected