package sourcecheck¶
Functions¶
func CheckLibraryFile¶
CheckLibraryFile checks every exported composite body in file.
func CheckUBLibrary¶
CheckUBLibrary checks every exported composite body in source.
Types¶
type ImportAnalysis¶
type ImportAnalysis struct {
Top []resolve.Resolution
Libraries map[string]*runtime.Library
GoImports map[string]string
GoModules map[string]string
UBImports map[string]string
UBPackages map[string][]byte
}
ImportAnalysis is the resolved import data shared by source checks, compile, and graph printing.
func AnalyzeImports¶
func AnalyzeImports(
refs map[string]resolve.ImportRef,
opts ImportAnalysisOptions,
) (*ImportAnalysis, error)
AnalyzeImports resolves refs once and builds the data each caller needs.
type ImportAnalysisOptions¶
type ImportAnalysisOptions struct {
ProjectDir string
Source *resolve.Source
Resolver resolve.Resolver
Versions map[string]string
SchemaCache *SchemaCache
WarnOut io.Writer
Mode Mode
StackName string
GeneratePackages bool
ValidateCompositeBodies bool
}
ImportAnalysisOptions configures AnalyzeImports.
type Mode¶
Mode controls whether remote imports may be fetched.
type Options¶
type Options struct {
ProjectDir string
Source *resolve.Source
Resolver resolve.Resolver
Versions map[string]string
SchemaCache *SchemaCache
WarnOut io.Writer
Mode Mode
}
Options configures source checks.
type Result¶
Result is the source-check result for a factory or composite body.
func CheckFactoryBody¶
CheckFactoryBody resolves imports and runs compile-time checks for body.
type SchemaCache¶
SchemaCache memoizes Go library schema reads by source path.
func NewSchemaCache¶
NewSchemaCache returns a cache that reads Go source with extra module roots.
func NewSchemaCacheWithReader¶
func NewSchemaCacheWithReader(
read func(sourcePath string) (*runtime.LibrarySchema, []string, error),
) *SchemaCache
NewSchemaCacheWithReader returns a cache that reads Go schemas through read.
func (*SchemaCache) Read¶
Read returns the schema and warnings for sourcePath, reading it once.