binding: precompile template, remove useless error condition
This commit is contained in:
parent
a7f86dcb7f
commit
be02eea7b1
1 changed files with 3 additions and 6 deletions
|
@ -79,6 +79,8 @@ type (
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var srcTemplate = template.Must(template.New("generate").Parse(srcTmpl))
|
||||||
|
|
||||||
// NewConfig initializes and returns a new config instance.
|
// NewConfig initializes and returns a new config instance.
|
||||||
func NewConfig() Config {
|
func NewConfig() Config {
|
||||||
return Config{
|
return Config{
|
||||||
|
@ -97,12 +99,7 @@ func Generate(cfg Config) error {
|
||||||
ctr.Imports = append(ctr.Imports, "github.com/nspcc-dev/neo-go/pkg/interop/neogointernal")
|
ctr.Imports = append(ctr.Imports, "github.com/nspcc-dev/neo-go/pkg/interop/neogointernal")
|
||||||
sort.Strings(ctr.Imports)
|
sort.Strings(ctr.Imports)
|
||||||
|
|
||||||
tmp, err := template.New("generate").Parse(srcTmpl)
|
return srcTemplate.Execute(cfg.Output, ctr)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return tmp.Execute(cfg.Output, ctr)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func scTypeToGo(name string, typ smartcontract.ParamType, overrides map[string]Override) (string, string) {
|
func scTypeToGo(name string, typ smartcontract.ParamType, overrides map[string]Override) (string, string) {
|
||||||
|
|
Loading…
Reference in a new issue