Source File
provider.go
Belonging Package
go.pact.im/x/plumb/internal/discover
package discoverimport ()// Package is one loaded, type-checked Go package as the core consumes it. The// loaders (the real go/packages loader and the in-memory test loader) produce// values of this shape; the core never loads anything itself. It is discover’s// input contract (the first phase defines what a loaded package must carry),// and the later phases and the cli read the same shape.type Package struct {// PkgPath is the package’s import path (e.g. "example.com/app"). It is the// identity used to decide qualification against the destination.PkgPath string// Name is the package clause name (e.g. "app").Name string// Fset is the file set the package’s positions live in. All scanned// packages share one Fset so positions are globally comparable.Fset *token.FileSet// Syntax is the parsed source of the package (with comments), used to find// directives and the declarations they attach to.Syntax []*ast.File// Types is the type-checked package, used to resolve provider and signature// types.Types *types.Package// Info carries the type information gathered during checking (Defs, Uses,// Types, Selections).Info *types.Info}// ProviderKind enumerates the surface forms a directive can tag. They all reduce// to the same abstraction (inputs, results, a render rule), which is what lets// the wiring code in the solve package ignore the kind almost entirely.type ProviderKind int// The provider kinds, one per surface form a directive can tag.const (KindFunc ProviderKind = iota // package-level functionKindMethod // method on a concrete or interface receiverKindSymbol // reference to a package-level var or typed constKindField // struct fieldKindStruct // struct type that builds itself via a composite literalKindConvert // conversion provider: var _ T = expr)func ( ProviderKind) () string {switch {case KindFunc:return "func"case KindMethod:return "method"case KindSymbol:return "symbol"case KindField:return "field"case KindStruct:return "struct"case KindConvert:return "convert"}return "?"}// Provider is one discovered directive occurrence. A declaration tagged with N// directives yields N providers (one per set name), so each provider belongs to// exactly one set.type Provider struct {SetName stringKind ProviderKindPos token.Position // identifying position, for ordering and diagnosticsName string // human-readable name for the -v report and diagnosticsPkg *types.Package // the declaring package// Origin objects, by kind. Only the fields relevant to Kind are set.Fn *types.Func // KindFunc, KindMethodSym types.Object // KindSymbol (a var or typed const), KindField (the field)Owner types.Type // KindMethod, KindField: *Named, or *Alias for a member of an alias to an anonymous compositeDeclared types.Type // KindStruct: the directive’s declared type (a *Named or *Alias), rendered as writtenConvertTo types.Type // KindConvert: the target type producedConvertFrom types.Type // KindConvert: the source type consumedRparams *types.TypeParamList // receiver type parameters (methods and fields)Tparams *types.TypeParamList // function, method, or struct type parameters}// TypeParams yields receiver parameters followed by declaration parameters.func ( *Provider) ( func(*types.TypeParam) bool) {for , := range []*types.TypeParamList{.Rparams, .Tparams} {for := range .TypeParams() {if !() {return}}}}// Generic reports whether the provider is a template.func ( *Provider) () bool {return .Rparams.Len() > 0 || .Tparams.Len() > 0}
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64)