fc644ecd6e
Reemplaza el scaffold del echobot por la plataforma completa de bots traida desde ~/DataProyects/Github/agents_and_robots tras la operacion Matrix-out: los bots ya no hablan por Matrix sino por el bus unibus (modelo todo-rooms + E2E via shell/transportunibus sobre github.com/enmanuel/unibus/pkg/client). - go.mod: replace de unibus -> ../unibus y de fn-registry -> ../../../.. (paths relativos reajustados a la nueva ubicacion dentro de fn_registry). - app.md: bump a 0.2.0, descripcion + arquitectura + comandos + gotchas reales. - modulo Go conservado como github.com/enmanuel/agents (sin reescribir imports). agents_and_robots queda archivado como museo de la era Matrix.
29 lines
562 B
Go
29 lines
562 B
Go
package message
|
|
|
|
import (
|
|
"bytes"
|
|
"text/template"
|
|
)
|
|
|
|
// Render executes a Go template string with the given data. Pure.
|
|
func Render(tmpl string, data any) (string, error) {
|
|
t, err := template.New("").Parse(tmpl)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
var buf bytes.Buffer
|
|
if err := t.Execute(&buf, data); err != nil {
|
|
return "", err
|
|
}
|
|
return buf.String(), nil
|
|
}
|
|
|
|
// MustRender is like Render but panics on error. Use only in tests.
|
|
func MustRender(tmpl string, data any) string {
|
|
s, err := Render(tmpl, data)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return s
|
|
}
|