types

package
v0.0.0-...-d8354c5 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsInterfaceReceiver

func IsInterfaceReceiver(func_decl *types.Func) bool

Types

type TargetArgument

type TargetArgument struct {
	Name string
	Type string
	// 0 == not ptr, 1 == *, 2 == **
	Pointer int
	Array   bool
}

func (TargetArgument) IsIncludable

func (a TargetArgument) IsIncludable() bool

func (TargetArgument) Print

func (a TargetArgument) Print()

pretty print TargetArgument for debugging purposes

type TargetFunction

type TargetFunction struct {
	Name     string
	IsMethod bool
	Receiver string
	//StructType string
	Args        []TargetArgument
	PackageName string
	PackagePath string
	PackageDir  string
	TypesFunc   *types.Func // func info from go/types library
}

func (TargetFunction) IsConstructor

func (f TargetFunction) IsConstructor() bool

isConstructor reports if f is a constructor. It cannot have a receiver, must return a named type or pointer to named type as its first return value, and can optionally have its second return value be type error. This is a more narrow definition than for example 'go doc', which allows any number of builtin types to be returned in addition to a single named type.

func (TargetFunction) IsIncludable

func (f TargetFunction) IsIncludable(target_config TargetRepoConfig) bool

func (TargetFunction) Print

func (f TargetFunction) Print()

pretty print TargetFunction for debugging purposes

func (TargetFunction) UniqueName

func (f TargetFunction) UniqueName() string

since functions can be defined more than once with the same name and different function interfaces we need to make a unique wrapper function name this function hashes information about the function interface to do so

type TargetPackage

type TargetPackage struct {
	RealPath           string
	Name               string
	ImportPath         string
	TargetFunctions    []TargetFunction
	TargetConstructors []TargetFunction
}

func NewTargetPackage

func NewTargetPackage(name string, real_path string, target_config TargetRepoConfig) TargetPackage

helper function for creating new TargetPackage objects

func (TargetPackage) GenerateHarnessPath

func (pkg TargetPackage) GenerateHarnessPath() string

func (TargetPackage) IsIncludable

func (pkg TargetPackage) IsIncludable(target_config TargetRepoConfig) bool

checks various things to see if we should exclude the package

func (TargetPackage) Print

func (pkg TargetPackage) Print()

pretty print TargetPackage for debugging purposes

func (TargetPackage) UniqueID

func (pkg TargetPackage) UniqueID() string

returns a truncated hash of the import path for uniqueness

type TargetRepoConfig

type TargetRepoConfig struct {
	TargetRepo              string   `yaml:"target_repo_name"`
	TargetRepoURL           string   `yaml:"target_repo_url"`
	TargetRepoBranch        string   `yaml:"target_repo_branch"`
	TargetRepoImportPrefix  string   `yaml:"target_repo_import_prefix"`
	TargetModuleDeclaration string   `yaml:"target_mod_self_declaration"`
	TargetGoVersion         string   `yaml:"go_version"`
	HarnessGenDeps          []string `yaml:"harness_gen_deps"`
	IgnorePackages          []string `yaml:"ignore_packages"`
	IgnoreFunctions         []string `yaml:"ignore_functions"`
	IgnoreTypes             []string `yaml:"ignore_types"`
	//TODO:
	//substitute_packages:
	TestTimeSeconds int `yaml:"seconds_per_target_function"`
}

func ParseTargetConfig

func ParseTargetConfig(yaml_file string) TargetRepoConfig

parse YAML file with target configuration

func (*TargetRepoConfig) Parse

func (c *TargetRepoConfig) Parse(data []byte) error

YAML unmarshal

Jump to

Keyboard shortcuts

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