tools

package
v0.0.0-...-82c290f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2018 License: BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTagsFlag

func AddTagsFlag(fs *flag.FlagSet, to *[]string)

AddTagsFlag registers the buildutil.TagsFlag flag.

func AddTagsFlagDefault

func AddTagsFlagDefault()

AddTagsFlagDefault calls AddTagFlag with the default flag set and build context.

func BuildTagsFrom

func BuildTagsFrom(filename string) ([]byte, error)

func Deps

func Deps(buildTags []string, imp string) ([]string, error)

Deps gets the transitive dependencies of import path imp from go list.

func FilesToSlice

func FilesToSlice(pkg *ast.Package) []*ast.File

FilesToSlice returns pkg.Files as a slice.

func GoList

func GoList(buildTags, args []string) ([]string, error)

GoList invokes "go list" with args and returns the output.

It outputs errors from go list directly to stderr.

func Gofmt

func Gofmt(file string, write func(io.Writer) error) error

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

func MakeFileCheck(files []string) func(os.FileInfo) bool

MakeFileCheck creates a file checker for go/parser.ParseDir.

func OverwriteCheck

func OverwriteCheck(filename, toolname string) error

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

func PackageName(buildTags []string, imp string) (string, error)

PackageName gets the name of the package at import path imp via go list.

func Rdeps

func Rdeps(buildTags []string, imp string) ([]string, error)

Rdeps invokes rdeps on import path imp to gather its reverse dependencies.

rdeps is part of honnef.co/go/tools/...

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL