buildtag

package module
v0.0.0-...-c32643c Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: MIT Imports: 14 Imported by: 0

README

buidtag

buildtag prints buildtags which are used in specified packages.

Install

$ go install github.com/gostaticanalysis/buildtag/cmd/buildtag@latest

Usage

$ buildtag golang.org/x/net/context
!go1.7 /Users/tenntenn/go/pkg/mod/golang.org/x/net@v0.0.0-20220107192237-5cfca573fb4d/context/context_test.go
go1.7 /Users/tenntenn/go/pkg/mod/golang.org/x/net@v0.0.0-20220107192237-5cfca573fb4d/context/go17.go
go1.9 /Users/tenntenn/go/pkg/mod/golang.org/x/net@v0.0.0-20220107192237-5cfca573fb4d/context/go19.go
!go1.7 /Users/tenntenn/go/pkg/mod/golang.org/x/net@v0.0.0-20220107192237-5cfca573fb4d/context/pre_go17.go
!go1.9 /Users/tenntenn/go/pkg/mod/golang.org/x/net@v0.0.0-20220107192237-5cfca573fb4d/context/pre_go19.go
$ buildtag -tag "^go1\.*" golang.org/x/net/context
/Users/tenntenn/go/pkg/mod/golang.org/x/net@v0.0.0-20220111093109-d55c255bac03/context/go17.go:go1.7
/Users/tenntenn/go/pkg/mod/golang.org/x/net@v0.0.0-20220111093109-d55c255bac03/context/go19.go:go1.9
$ buildtag -f="{{.Constraint}}" golang.org/x/net/context | sort | uniq
!go1.7
!go1.9
go1.7
go1.9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name:       "buildtag",
	Doc:        doc,
	Run:        run,
	ResultType: reflect.TypeOf((*Info)(nil)),
}

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Package    *types.Package
	File       string
	Pos        token.Pos
	Constraint constraint.Expr
}

type Info

type Info struct {
	Entries []Entry
}

func Load

func Load(patterns ...string) (*Info, error)

func (*Info) Find

func (info *Info) Find(f func(constraint string) bool) []Entry

func (*Info) FindByRegexp

func (info *Info) FindByRegexp(reg *regexp.Regexp) []Entry

func (*Info) Matches

func (info *Info) Matches(ok func(tag string) bool) []Entry

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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