Documentation ¶
Index ¶
- func AddTagsFlag(fs *flag.FlagSet, to *[]string)
- func AddTagsFlagDefault()
- func BuildTagsFrom(filename string) ([]byte, error)
- func Deps(buildTags []string, imp string) ([]string, error)
- func FilesToSlice(pkg *ast.Package) []*ast.File
- func GoList(buildTags, args []string) ([]string, error)
- func Gofmt(file string, write func(io.Writer) error) error
- func MakeFileCheck(files []string) func(os.FileInfo) bool
- func OverwriteCheck(filename, toolname string) error
- func PackageName(buildTags []string, imp string) (string, error)
- func Rdeps(buildTags []string, imp string) ([]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddTagsFlag ¶
AddTagsFlag registers the buildutil.TagsFlag flag.
func AddTagsFlagDefault ¶
func AddTagsFlagDefault()
AddTagsFlagDefault calls AddTagFlag with the default flag set and build context.
func BuildTagsFrom ¶
func FilesToSlice ¶
FilesToSlice returns pkg.Files as a slice.
func GoList ¶
GoList invokes "go list" with args and returns the output.
It outputs errors from go list directly to stderr.
func Gofmt ¶
Gofmt the template to file.
The template should contain
// Code generated by {name} - DO NOT EDIT.
on the first line as OverwriteCheck expects that exact format and placement.
func MakeFileCheck ¶
MakeFileCheck creates a file checker for go/parser.ParseDir.
func OverwriteCheck ¶
OverwriteCheck return nil if filename does not exist or if it does but was created by toolname.
This is of course racy so it cannot prevent many errors, but it can catch some silly human-scale mistakes.
func PackageName ¶
PackageName gets the name of the package at import path imp via go list.
Types ¶
This section is empty.