add params

This commit is contained in:
2025-11-21 13:30:53 +03:00
parent 72ef747541
commit 6300b35296
10 changed files with 152 additions and 7 deletions

View File

@@ -2,7 +2,6 @@ package generate
import "text/template"
//nolint:gochecknoglobals
var (
tpl = template.Must(template.New("tpls").Parse(baseTemplate))
baseTemplate = `// Code generated gitoa.ru/go-4devs/config DO NOT EDIT.

View File

@@ -8,7 +8,6 @@ import (
"gitoa.ru/go-4devs/config/definition"
)
//nolint:gochecknoglobals
var handlers = sync.Map{}
func Add(kind string, h Handle) error {

View File

@@ -73,7 +73,6 @@ func (v View) StructName() string {
return generate.FuncName(v.Prefix + v.Name + v.Suffix)
}
//nolint:gochecknoglobals
var (
tpl = template.Must(template.New("tpls").Parse(gpoupTemplate))
gpoupTemplate = `type {{.StructName}} struct {

View File

@@ -19,7 +19,6 @@ import (
//go:embed tpl/*
var tpls embed.FS
//nolint:gochecknoglobals
var tpl = template.Must(template.New("tpls").ParseFS(tpls, "tpl/*.tmpl"))
//nolint:gochecknoinits
@@ -141,7 +140,6 @@ func (v View) Parse(valName string, value string, keys []string) string {
return data
}
//nolint:gochecknoglobals
var parses = map[string]func(data ParseData) (string, error){
typesIntreface[0].Name(): func(data ParseData) (string, error) {
var b bytes.Buffer
@@ -192,7 +190,6 @@ func internal(data ParseData) (string, error) {
return b.String(), nil
}
//nolint:gochecknoglobals
var typesIntreface = [...]reflect.Type{
reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem(),
reflect.TypeOf((*json.Unmarshaler)(nil)).Elem(),

View File

@@ -40,7 +40,6 @@ func handle(w io.Writer, data generate.Handler, opt definition.Option) error {
return fmt.Errorf("%w:%T", generate.ErrWrongType, opt)
}
//nolint:gochecknoglobals
var (
tpl = template.Must(template.New("tpls").Funcs(template.FuncMap{"join": strings.Join}).Parse(templateOption))
templateOption = `// read{{.FuncName}} {{.Description}}.