Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: "generate_container_impl", Short: "generate container_impl.go", Run: func(cmd *cobra.Command, args []string) { container_impl_file := inputDir + "/container_impl.go.template" container_main_file := inputDir + "/main.go.template" impl_buf, err := ioutil.ReadFile(container_impl_file) if err != nil { cmd.Printf("failed to open %v: %v\n", container_impl_file, err) return } main_buf, err := ioutil.ReadFile(container_main_file) if err != nil { cmd.Printf("failed to open %v: %v\n", container_main_file, err) return } output_file, err := os.Create(output) if err != nil { cmd.Printf("failed to write file %v: %v\n", output, err) return } impl_tmpl := template.Must(template.New("container_impl").Parse(string(impl_buf))) impl_tmpl.Execute(output_file, struct{ Code string }{string(main_buf)}) cmd.Printf("Generated...\n") }, }
RootCmd represents the base command when called without any subcommands
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.