Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenImports ¶
GenImports generates an import declaration from the given map of import:alias pairs. If an alias is blank, then the path is imported directly.
Example ¶
imports := GenImports(map[string]string{ "os": "", "some/custom/import": "alias", }) fmt.Println(imports)
Output: import ( "os" alias "some/custom/import" )
Example (Empty) ¶
imports := GenImports(map[string]string{}) fmt.Println(imports)
Output:
func GenLicense ¶
func GenLicense() string
GenLicense generates the license header.
Example ¶
lic := GenLicense() currentYear := fmt.Sprintf("%d", time.Now().Year()) fmt.Println("license contains year?", strings.Contains(lic, currentYear)) fmt.Println("license contains apache text?", strings.Contains(lic, "Licensed under the Apache License, Version 2.0"))
Output: license contains year? true license contains apache text? true
func GenNotice ¶
GenNotice generates a notice that the file was auto-generated.
Example ¶
fmt.Println(GenNotice("some-file.go"))
Output: // This file was generated with some-file.go, DO NOT EDIT IT.
func TemplateFuncs ¶
TemplateFuncs returns the functions provided by generator available for consumption in a template.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.