may

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileContext

type FileContext struct {
	// FileContent is the content of the file to be matched.
	FileContent []byte

	// PackageName is the name of the package given as seen in `package main` for example.
	PackageName string
	// contains filtered or unexported fields
}

FileContext is the context for a file to be matched.

func (*FileContext) FileContains

func (ctx *FileContext) FileContains(content string) MatchType

type MatchType

type MatchType byte

MatchType is an enumeration of the possible outcomes of a join point

const (
	// Unknown indicates that the join point cannot determine whether it matches the given context
	Unknown MatchType = '?'
	// Match indicates that the join point may match the given context
	Match MatchType = 'Y'
	// NeverMatch indicates that the join point DOES NOT match the given context
	NeverMatch MatchType = 'N'
)

func (MatchType) And

func (m MatchType) And(other MatchType) MatchType

And returns the logical AND of two MatchType values Truth table:

| A | B | A AND B | |---|---|---------| | N | N | N | | N | ? | N | | N | Y | N | | ? | ? | ? | | ? | Y | ? | | Y | Y | Y |

func (MatchType) Not

func (m MatchType) Not() MatchType

Not returns the logical NOT of a MatchType value Truth table:

| A | NOT A | |---|-------| | N | Y | | ? | ? | | Y | N |

func (MatchType) Or

func (m MatchType) Or(other MatchType) MatchType

Or returns the logical OR of two MatchType values Truth table:

| A | B | A OR B | |---|---|---------| | N | N | N | | N | ? | ? | | N | Y | Y | | ? | ? | ? | | ? | Y | Y | | Y | Y | Y |

type PackageContext

type PackageContext struct {
	// ImportPath is the import path of the package in its module.
	ImportPath string

	// ImportMap is the map of import paths to their respective package archives
	ImportMap map[string]string

	// TestMain is true if the package is a test package.
	TestMain bool
}

PackageContext is the context for a package to be matched.

func (*PackageContext) PackageImports

func (ctx *PackageContext) PackageImports(path string) MatchType

Jump to

Keyboard shortcuts

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