v1.35.3 Latest Latest

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

Go to latest
Published: Apr 12, 2024 License: MPL-2.0 Imports: 13 Imported by: 0




This section is empty.


View Source
var (
	ErrConfigUsedOutsideOfService = errRange.New(
		"Invalid call to config.Load[T]()",
		"A call to config.Load[T]() can only be made from within a service.",

	ErrConfigUsedInSubPackage = errRange.New(
		"Invalid call to config.Load[T]()",
		"A call to config.Load[T]() can only be made from the top level package of a service.",

	ErrCrossServiceConfigUse = errRange.New(
		"Cross service config use",
		"A config instance can only be referenced from within the service that the call to `config.Load[T]()` was made in.",
View Source
var LoadParser = &resourceparser.Parser{
	Name: "ConfigLoad",

	InterestingImports: []paths.Pkg{""},
	Run: func(p *resourceparser.Pass) {
		name := pkginfo.QualifiedName{PkgPath: "", Name: "Load"}

		spec := &parseutil.ReferenceSpec{
			MinTypeArgs: 0,
			MaxTypeArgs: 1,
			Parse:       parseLoad,
		parseutil.FindPkgNameRefs(p.Pkg, []pkginfo.QualifiedName{name}, func(file *pkginfo.File, name pkginfo.QualifiedName, stack []ast.Node) {
			parseutil.ParseReference(p, spec, parseutil.ReferenceData{
				File:         file,
				Stack:        stack,
				ResourceFunc: name,


func ResolveConfigUsage

func ResolveConfigUsage(data usage.ResolveData, load *Load) usage.Usage


type Load

type Load struct {
	AST  *ast.CallExpr
	File *pkginfo.File

	// Type is the type of the config struct being loaded.
	// It's guaranteed to be a (possibly pointer to a) named struct type.
	Type schema.Type

	// FuncCall is the AST node that represents the config.Load expression.
	FuncCall *ast.CallExpr

Load represents a config load statement.

func (*Load) ASTExpr

func (l *Load) ASTExpr() ast.Expr

func (*Load) End

func (l *Load) End() token.Pos

func (*Load) Kind

func (*Load) Kind() resource.Kind

func (*Load) Package

func (l *Load) Package() *pkginfo.Package

func (*Load) Pos

func (l *Load) Pos() token.Pos

func (*Load) SortKey added in v1.16.3

func (l *Load) SortKey() string

type ReferenceUsage

type ReferenceUsage struct {

	// Load is the config load being used.
	Cfg *Load

Jump to

Keyboard shortcuts

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