github.com/sandwich-go/boost@v1.3.29/geom/internal/export.go (about)

     1  package main
     2  
     3  import (
     4  	"github.com/sandwich-go/boost/geom/internal/template2"
     5  	"github.com/sandwich-go/boost/internal/log"
     6  	"github.com/sandwich-go/boost/misc/xtemplate"
     7  )
     8  
     9  func main() {
    10  	for _, src := range []struct {
    11  		Name     string
    12  		FileName string
    13  		TPL      string
    14  		Args     interface{}
    15  	}{
    16  		{Name: "int", FileName: "./../int.go", TPL: template2.GeomTPL, Args: map[string]interface{}{"Key": "int"}},
    17  		{Name: "int_test", FileName: "./../int_test.go", TPL: template2.GeomTestTPL, Args: map[string]interface{}{"Key": "int"}},
    18  
    19  		{Name: "int8", FileName: "./../int8.go", TPL: template2.GeomTPL, Args: map[string]interface{}{"Key": "int8"}},
    20  		{Name: "int8_test", FileName: "./../int8_test.go", TPL: template2.GeomTestTPL, Args: map[string]interface{}{"Key": "int8"}},
    21  
    22  		{Name: "int16", FileName: "./../int16.go", TPL: template2.GeomTPL, Args: map[string]interface{}{"Key": "int16"}},
    23  		{Name: "int16_test", FileName: "./../int16_test.go", TPL: template2.GeomTestTPL, Args: map[string]interface{}{"Key": "int16"}},
    24  
    25  		{Name: "int32", FileName: "./../int32.go", TPL: template2.GeomTPL, Args: map[string]interface{}{"Key": "int32"}},
    26  		{Name: "int32_test", FileName: "./../int32_test.go", TPL: template2.GeomTestTPL, Args: map[string]interface{}{"Key": "int32"}},
    27  
    28  		{Name: "int64", FileName: "./../int64.go", TPL: template2.GeomTPL, Args: map[string]interface{}{"Key": "int64"}},
    29  		{Name: "int64_test", FileName: "./../int64_test.go", TPL: template2.GeomTestTPL, Args: map[string]interface{}{"Key": "int64"}},
    30  	} {
    31  		_, err := xtemplate.Execute(src.TPL, src.Args,
    32  			xtemplate.WithOptionName(src.Name),
    33  			xtemplate.WithOptionFileName(src.FileName),
    34  		)
    35  		if err != nil {
    36  			log.Fatal(err.Error())
    37  		}
    38  	}
    39  }