...

Source file src/github.com/shurcooL/vfsgen/cmd/vfsgendev/generate.go

Documentation: github.com/shurcooL/vfsgen/cmd/vfsgendev

     1  package main
     2  
     3  import (
     4  	"strconv"
     5  	"text/template"
     6  )
     7  
     8  type data struct {
     9  	ImportPath      string
    10  	PackageName     string
    11  	BuildTags       string
    12  	VariableName    string
    13  	VariableComment string
    14  }
    15  
    16  var generateTemplate = template.Must(template.New("").Funcs(template.FuncMap{
    17  	"quote": strconv.Quote,
    18  }).Parse(`package main
    19  
    20  import (
    21  	"log"
    22  
    23  	"github.com/shurcooL/vfsgen"
    24  
    25  	sourcepkg {{.ImportPath | quote}}
    26  )
    27  
    28  func main() {
    29  	err := vfsgen.Generate(sourcepkg.{{.VariableName}}, vfsgen.Options{
    30  		PackageName:     {{.PackageName | quote}},
    31  		BuildTags:       {{.BuildTags | quote}},
    32  		VariableName:    {{.VariableName | quote}},
    33  		VariableComment: {{.VariableComment | quote}},
    34  	})
    35  	if err != nil {
    36  		log.Fatalln(err)
    37  	}
    38  }
    39  `))
    40  

View as plain text