module

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package module owns Go module identity and source discovery.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ImportPathLocal

func ImportPathLocal(root, modulePath, directory string) (string, error)

func ParsePath

func ParsePath(name string, content []byte) (string, error)

ParsePath reads the module directive using Go's module-file parser.

Types

type BuildError

type BuildError struct{ Err string }

type BuildModule

type BuildModule struct {
	Path, Dir string
	Main      bool
}

type BuildPackage

type BuildPackage struct {
	Dir, ImportPath, Name string
	GoFiles, CgoFiles     []string
	DepOnly, Standard     bool
	Module                *BuildModule
	Error                 *BuildError
	DepsErrors            []BuildError
}

type BuildSelection

type BuildSelection struct{ Packages []BuildPackage }

BuildSelection is a serializable snapshot of Go's source selection. Paths remain source-backed; it is not a relocatable deployment bundle.

func (*BuildSelection) Workspace

func (s *BuildSelection) Workspace() *Workspace

type BuildWorkspace

type BuildWorkspace struct {
	BaseDir  string
	Patterns []string
	Tags     string
	Env      []string
	Overlay  string
}

BuildWorkspace delegates module, workspace and target selection to the Go command. Env is a complete command environment; nil inherits the caller's environment. Patterns use Go's package syntax. No command in this owner executes application code.

func (BuildWorkspace) Resolve

func (b BuildWorkspace) Resolve(ctx context.Context) (*BuildSelection, error)

type File

type File struct {
	Path       string
	Dir        string
	ImportPath string
}

type Info

type Info struct {
	Dir  string
	Path string
}

func LocateFS

func LocateFS(fsys fs.FS, start string) (*Info, error)

func LocateLocal

func LocateLocal(start string) (*Info, error)

LocateLocal accepts an existing file/directory or a not-yet-created package directory and finds its nearest enclosing module without changing disk state.

type LocalDiscovery

type LocalDiscovery struct {
	BaseDir string
	Include []string
	Exclude []string
}

func (LocalDiscovery) Walk

func (d LocalDiscovery) Walk(ctx context.Context, visit func(File) error) error

type LocalWorkspace

type LocalWorkspace struct {
	BaseDir    string
	ModuleDirs []string
}

LocalWorkspace resolves explicitly available local source modules. It never downloads modules or treats imported dependency packages as selected roots.

func (LocalWorkspace) Resolve

func (w LocalWorkspace) Resolve(ctx context.Context) (*Workspace, error)

type PackageLocation

type PackageLocation struct {
	Module          *Info
	Dir, ImportPath string
}

type Workspace

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

func (*Workspace) Package

func (w *Workspace) Package(importPath string) (*PackageLocation, error)

Package resolves roots and applicable local replacements lazily. Missing unused developer replacements cannot invalidate unrelated selected packages.

func (*Workspace) SourceFS

func (w *Workspace) SourceFS(info *Info) fs.FS

SourceFS retains normal resource access but filters Go directory entries to the exact build-selected files. Metadata loaders share the compiler's choice.

func (*Workspace) Walk

func (w *Workspace) Walk(ctx context.Context, include, exclude []string, visit func(File) error) error

Jump to

Keyboard shortcuts

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