Skip to content

package golibrary

import "github.com/cloudboss/unobin/pkg/golibrary"

Functions

func FindModuleRoot

func FindModuleRoot(packageDir string) (string, error)

func SourceSnapshot

func SourceSnapshot(dir string, roots []ModuleSource) ([32]byte, error)

Types

type CompatibilityContext

type CompatibilityContext struct {
    // contains filtered or unexported fields
}

CompatibilityContext checks eligibility before registration or schema reads.

func NewCompatibilityContext

func NewCompatibilityContext(options CompatibilityOptions) (*CompatibilityContext, error)

NewCompatibilityContext validates the descriptor and effective core replacement.

func (*CompatibilityContext) CheckDirectory

func (c *CompatibilityContext) CheckDirectory(dir string, linked bool) error

func (*CompatibilityContext) CheckPackage

func (c *CompatibilityContext) CheckPackage(source PackageSource) error

CheckPackage validates eligibility and configuration dependencies without executing Go.

func (*CompatibilityContext) CheckPackages

func (c *CompatibilityContext) CheckPackages(sources []PackageSource) error

CheckPackages inspects every selected package before deriving schemas or executing Go.

func (*CompatibilityContext) DiagnosticDetails

func (c *CompatibilityContext) DiagnosticDetails(
    metadata PackageMetadata,
) *diagnostic.LibraryCompatibilityDetails

func (*CompatibilityContext) EndAnalysis

func (c *CompatibilityContext) EndAnalysis()

EndAnalysis restores current-source checks for subsequent reads.

func (*CompatibilityContext) ForAnalysis

func (c *CompatibilityContext) ForAnalysis() *CompatibilityContext

ForAnalysis returns an independent context for one import analysis. Call ValidateSources before using the result and EndAnalysis before later reads.

func (*CompatibilityContext) Manifest

func (c *CompatibilityContext) Manifest() []PackageMetadata

Manifest returns independent metadata records in deterministic package order.

func (*CompatibilityContext) ModuleSources

func (c *CompatibilityContext) ModuleSources() []ModuleSource

func (*CompatibilityContext) SourceSnapshot

func (c *CompatibilityContext) SourceSnapshot(dir string) ([32]byte, error)

func (*CompatibilityContext) ValidateSources

func (c *CompatibilityContext) ValidateSources() error

ValidateSources checks the source revisions used by this analysis.

func (*CompatibilityContext) WithModuleResolver

func (c *CompatibilityContext) WithModuleResolver(
    resolver func(string) (ModuleSource, error),
) (*CompatibilityContext, error)

func (*CompatibilityContext) WithModules

func (c *CompatibilityContext) WithModules(modules []ModuleSource) (*CompatibilityContext, error)

type CompatibilityDeclaration

type CompatibilityDeclaration struct {
    RequiredAPI                string
    SuggestedUnobinVersion     string
    Path                       string
    Span                       *diagnostic.Span
    RequiredAPISpan            *diagnostic.Span
    SuggestedUnobinVersionSpan *diagnostic.Span
}

func ReadCompatibility

func ReadCompatibility(moduleRoot, packageDir string) (*CompatibilityDeclaration, error)

type CompatibilityError

type CompatibilityError struct {
    Kind CompatibilityErrorKind
    // contains filtered or unexported fields
}

func (*CompatibilityError) Diagnostics

func (e *CompatibilityError) Diagnostics() []diagnostic.Diagnostic

func (*CompatibilityError) Error

func (e *CompatibilityError) Error() string

type CompatibilityErrorKind

type CompatibilityErrorKind uint8

type CompatibilityOptions

type CompatibilityOptions struct {
    Descriptor      *libraryapi.Descriptor
    UnobinVersion   string
    CoreReplacement string
    ToolchainPin    string
    ProjectFile     string
    Modules         []ModuleSource
    ResolveModule   func(string) (ModuleSource, error)
}

CompatibilityOptions supplies one operation's toolchain and selected sources.

type ConfigurationSourceError

type ConfigurationSourceError struct {
    Message string
    Cause   error
}

ConfigurationSourceError identifies unavailable or unreadable configuration source.

func (*ConfigurationSourceError) Error

func (e *ConfigurationSourceError) Error() string

func (*ConfigurationSourceError) Unwrap

func (e *ConfigurationSourceError) Unwrap() error

type CoreDescriptorError

type CoreDescriptorError struct {
    Path    string
    Message string
    Cause   error
}

CoreDescriptorError identifies an unusable effective toolchain descriptor.

func (*CoreDescriptorError) Error

func (e *CoreDescriptorError) Error() string

func (*CoreDescriptorError) Unwrap

func (e *CoreDescriptorError) Unwrap() error

type CoreFloorError

type CoreFloorError struct {
    RequiredVersion string
    UnobinVersion   string
}

CoreFloorError identifies a linked module requiring a newer core release.

func (*CoreFloorError) Error

func (e *CoreFloorError) Error() string

type ModuleSource

type ModuleSource struct {
    Path        string
    Dir         string
    Dependency  string
    Version     string
    Commit      string
    Replacement string
}

ModuleSource identifies a selected Go module and its effective source.

func ModuleSourceAt

func ModuleSourceAt(dir string) (ModuleSource, error)

type PackageMetadata

type PackageMetadata struct {
    Source                     PackageSource
    Package                    string
    Declaration                CompatibilityDeclaration
    RequiredCoreVersion        string
    MinimumGoVersion           string
    HasConfigurationEntryPoint bool
}

PackageMetadata records the declaration and module requirements used by a check.

type PackageSource

type PackageSource struct {
    Module ModuleSource
    Dir    string
    Linked bool
}

PackageSource identifies an inspected package and whether the build links it.

type ToolchainPinError

type ToolchainPinError struct {
    Pin           string
    UnobinVersion string
}

func (*ToolchainPinError) Error

func (e *ToolchainPinError) Error() string

type Validation

type Validation struct {
    ModulePath       string
    PackageName      string
    HasResources     bool
    HasData          bool
    HasActions       bool
    HasFunctions     bool
    HasConfiguration bool
}

func ValidatePackage

func ValidatePackage(moduleRoot, packageDir string) (*Validation, error)