mirror of
https://github.com/nxshock/gron.git
synced 2024-11-27 03:41:00 +05:00
14 lines
284 B
Go
14 lines
284 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"strings"
|
||
|
"text/template"
|
||
|
)
|
||
|
|
||
|
func format(fmt string, v interface{}) string {
|
||
|
t := new(template.Template)
|
||
|
b := new(strings.Builder)
|
||
|
template.Must(t.Parse(fmt)).Execute(b, v) // TODO: обработать возможные ошибки
|
||
|
return b.String()
|
||
|
}
|