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

     1  package main
     2  
     3  import (
     4  	"github.com/sandwich-go/boost/internal/log"
     5  	"github.com/sandwich-go/boost/misc/xtemplate"
     6  	"github.com/sandwich-go/boost/xslice/internal/template2"
     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: "slice", FileName: "./../slice.go", TPL: template2.SliceTPL, Args: template2.GetSliceTPLArgs()},
    17  		{Name: "slice_test", FileName: "./../slice_test.go", TPL: template2.SliceTestTPL, Args: template2.GetSliceTPLArgs()},
    18  	} {
    19  		_, err := xtemplate.Execute(src.TPL, src.Args,
    20  			xtemplate.WithOptionName(src.Name),
    21  			xtemplate.WithOptionFileName(src.FileName),
    22  		)
    23  		if err != nil {
    24  			log.Fatal(err.Error())
    25  		}
    26  	}
    27  }