fieldtags

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package fieldtags defines an analyzer that identifies struct fields identified as sources via a field tag.

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: "fieldtags",
	Doc:  "This analyzer identifies Source fields based on their tags.",
	Run:  run,
	Requires: []*analysis.Analyzer{
		inspect.Analyzer,
	},
	ResultType: reflect.TypeOf(new(ResultType)).Elem(),
	FactTypes:  []analysis.Fact{new(isTaggedField)},
}

Functions

This section is empty.

Types

type ResultType

type ResultType map[types.Object]bool

ResultType is a map from types.Object to bool. It can be used to determine whether a field is a tagged Source field.

func (ResultType) IsSource added in v0.1.3

func (r ResultType) IsSource(field *types.Var) bool

IsSource determines whether a types.Var is a source, that is whether it refers to a field previously identified as a source.

func (ResultType) IsSourceField added in v0.1.5

func (r ResultType) IsSourceField(t types.Type, field int) bool

IsSourceField determines whether a field on a type is a source field, using the type of the struct holding the field as well as the index of the field.

Jump to

Keyboard shortcuts

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