Documentation
¶
Index ¶
- Constants
- Variables
- func Available() []string
- func Description(name string) string
- func Register(annotator Annotator)
- func Registered() []string
- func Verbosef(format string, args ...interface{})
- type AddLogCall
- type Annotation
- type Annotator
- type EnsureCopyrightAndLicense
- type EssentialOptions
- type LocateOptions
- type RmLogCall
- type Spec
Constants ¶
const AddLogCallDescription = `` /* 180-byte string literal not displayed */
AddLogCallDescription documents AddLogCall.
Variables ¶
var ( // Verbose controls verbose logging. Verbose = false )
Functions ¶
func Description ¶
Description returns the description for the annotator or annotation.
Types ¶
type AddLogCall ¶
type AddLogCall struct { EssentialOptions `yaml:",inline"` LocateOptions `yaml:",inline"` AtLeastStatements int `` /* 129-byte string literal not displayed */ NoAnnotationComment string `yaml:"noAnnotationComment" annotator:"do not annotate functions that contain this comment"` CallGenerator functions.Spec `yaml:"callGenerator" annotator:"the spec for the function call to be generated"` }
AddLogCall represents an annotator for adding a function call that logs the entry and exit to every function and method that is matched by the locator.
func (*AddLogCall) Describe ¶
func (lc *AddLogCall) Describe() string
Describe implements annotators.Annotation.
func (*AddLogCall) New ¶
func (lc *AddLogCall) New(name string) Annotation
New implements annotators.Annotator.
func (*AddLogCall) UnmarshalYAML ¶
func (lc *AddLogCall) UnmarshalYAML(buf []byte) error
UnmarshalYAML implements annotators.Annotation.
type Annotation ¶
type Annotation interface { // UnmarshalYAML unmarshals the annotator's yaml configuration. UnmarshalYAML(buf []byte) error // Do runs the annotator. Root specifies an alternate location for the // modified files, if it is empty, files are modified in place. The original // directory structure will be mirrored under root. // Packages is the set of packages to be annotated as requested on the // command line and which overrides any configured ones. Do(ctx context.Context, root string, packages []string) error // Describe returns a description for the annotation. Describe() string }
Annotation represents a configured instance of an Annotator.
func Lookup ¶
func Lookup(name string) Annotation
Lookup returns the annotation with the specified typeName, if any.
type Annotator ¶
type Annotator interface { // New creates a new instance of T. It used to create new configurations // as specified in config files, namely an 'annotation' New(name string) Annotation Describe() string }
Annotator represents the interface that all annotators must implement.
type EnsureCopyrightAndLicense ¶
type EnsureCopyrightAndLicense struct { EssentialOptions `yaml:",inline"` Copyright string `yaml:"copyright" annotator:"desired copyright notice."` Exclusions []string `yaml:"exclusions" annotator:"regular expressions for files to be excluded."` License string `yaml:"license" annotator:"desired license notice."` UpdateCopyright bool `yaml:"updateCopyright" annotator:"set to true to update existing copyright notice"` UpdateLicense bool `yaml:"updateLicense" annotator:"set to true to update existing license notice"` }
EnsureCopyrightAndLicense represents an annotator that can insert or replace copyright and license headers from go source code files.
func (*EnsureCopyrightAndLicense) Describe ¶
func (ec *EnsureCopyrightAndLicense) Describe() string
Describe implements annotators.Annotations.
func (*EnsureCopyrightAndLicense) New ¶
func (ec *EnsureCopyrightAndLicense) New(name string) Annotation
New implements annotators.Annotators.
func (*EnsureCopyrightAndLicense) UnmarshalYAML ¶
func (ec *EnsureCopyrightAndLicense) UnmarshalYAML(buf []byte) error
UnmarshalYAML implements annotators.Annotations.
type EssentialOptions ¶
type EssentialOptions struct { Type string `yaml:"type" annotator:"name of annotator type."` Name string `yaml:"name" annotator:"name of annotation."` Packages []string `yaml:"packages" annotator:"packages to be annotated"` Concurrency int `yaml:"concurrency" annotator:"the number of goroutines to use, zero for a sensible default."` }
EssentialOptions represents the configuration options required for all annotations.
type LocateOptions ¶
type LocateOptions struct { Interfaces []string `yaml:"interfaces" annotator:"list of interfaces whose implementations are to be annoated."` Functions []string `yaml:"functions" annotator:"list of functions that are to be annotated."` IncludeMethods bool `yaml:"includeMethods" annotator:"if set, methods as well as functions that match the function spec are annotated"` }
LocateOptions represents the configuration options used to locate specific interfaces and/or functions.
type RmLogCall ¶
type RmLogCall struct { EssentialOptions `yaml:",inline"` LocateOptions `yaml:",inline"` FunctionNameRE string `yaml:"functionNameRE" annotator:"the function call (regexp) to be removed"` Comment string `` /* 134-byte string literal not displayed */ Deferred bool `yaml:"deferred" annotator:"if set requires that the function to be removed must be defered."` }
RmLogCall represents an annotor for removing logging calls.
func (*RmLogCall) New ¶
func (rc *RmLogCall) New(name string) Annotation
New implements annotators.Annotator.
func (*RmLogCall) UnmarshalYAML ¶
UnmarshalYAML implements annotators.Annotation.
type Spec ¶
type Spec struct { yaml.MapSlice Name string `yaml:"name"` // Name identifies a particular configuration of an annotator type. Type string `yaml:"type"` // Type identifies the annotation to be performed. }
Spec represents the yaml configuration for an annotation. It has a common field for the type and name of the annotator but all other fields are delegated to the Unmarshal method of the annotator specuifed by the Type field.
func (*Spec) UnmarshalYAML ¶
UnmarshalYAML implements yaml.Unmarshaler.