Documentation
¶
Index ¶
- func AddOrUpdateAsset(lockFilePath string, ast *Asset) error
- func Marshal(lockFile *LockFile) ([]byte, error)
- func RemoveAsset(lockFilePath string, name, version string) error
- func RenameAsset(lockFilePath string, oldName, newName string) error
- func Write(lockFile *LockFile, filePath string) error
- type Asset
- type Dependency
- type LockFile
- type Scope
- type ScopeType
- type ScopedAsset
- type SourceGit
- type SourceHTTP
- type SourcePath
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddOrUpdateAsset ¶
AddOrUpdateAsset adds or updates an asset in the lock file Replaces any existing asset with the same name@version
func RemoveAsset ¶
RemoveAsset removes an asset and all its installations from a lock file
func RenameAsset ¶ added in v0.14.0
RenameAsset renames all entries of an asset in the lock file.
Types ¶
type Asset ¶
type Asset struct {
Name string `toml:"name"`
Version string `toml:"version"`
Type asset.Type `toml:"type"`
Clients []string `toml:"clients,omitempty"`
Dependencies []Dependency `toml:"dependencies,omitempty"`
// Source (one of these will be present)
SourceHTTP *SourceHTTP `toml:"source-http,omitempty"`
SourcePath *SourcePath `toml:"source-path,omitempty"`
SourceGit *SourceGit `toml:"source-git,omitempty"`
// Installation configurations - array of scope installations
// If empty, asset is installed globally
Scopes []Scope `toml:"scopes,omitempty"`
}
Asset represents an asset with its metadata, source, and installation configurations (formerly Artifact)
func FindAsset ¶
FindAsset finds an asset by name in a lock file Returns the asset and true if found, nil and false otherwise
func (*Asset) GetSourceConfig ¶
GetSourceConfig returns the source configuration as a map for generic handling
func (*Asset) GetSourceType ¶
GetSourceType returns the type of source for this asset
func (*Asset) IsGlobal ¶
IsGlobal returns true if asset is installed globally (no scope restrictions)
func (*Asset) MatchesClient ¶
MatchesClient returns true if the asset is compatible with the given client
type Dependency ¶
Dependency represents a dependency reference
type LockFile ¶
type LockFile struct {
LockVersion string `toml:"lock-version"`
Version string `toml:"version"`
CreatedBy string `toml:"created-by"`
Assets []Asset `toml:"assets"`
}
LockFile represents the complete lock file structure
func Parse ¶
Parse parses a lock file from bytes Supports both new "assets"/"scopes" and old "artifacts"/"repositories" field names
func (*LockFile) GroupByScope ¶
GroupByScope returns all assets grouped by their scope An asset can appear in multiple scopes
func (*LockFile) ValidateDependencies ¶
ValidateDependencies checks for circular dependencies using DFS
type Scope ¶
type Scope struct {
Repo string `toml:"repo"` // Repository URL
Paths []string `toml:"paths,omitempty"` // Specific paths within repo (if empty, entire repo)
}
Scope represents where an asset is installed within a repository (formerly Repository)
func (*Scope) GetScopeType ¶
GetScopeType returns the scope type for this scope entry - If paths is empty/nil, it's repo-scoped (entire repository) - If paths has entries, it's path-scoped (specific paths within repository)
type ScopedAsset ¶
ScopedAsset represents an asset with its scope information (formerly ScopedArtifact)
type SourceGit ¶
type SourceGit struct {
URL string `toml:"url"`
Ref string `toml:"ref"`
Subdirectory string `toml:"subdirectory,omitempty"`
}
SourceGit represents a Git repository source for an asset
type SourceHTTP ¶
type SourceHTTP struct {
URL string `toml:"url"`
Hashes map[string]string `toml:"hashes"`
Size int64 `toml:"size,omitempty"`
UploadedAt *time.Time `toml:"uploaded-at,omitempty"`
}
SourceHTTP represents an HTTP source for an asset
func (*SourceHTTP) Validate ¶
func (s *SourceHTTP) Validate() error
Validate validates an HTTP source
type SourcePath ¶
type SourcePath struct {
Path string `toml:"path"`
}
SourcePath represents a local path source for an asset
func (*SourcePath) Validate ¶
func (s *SourcePath) Validate() error
Validate validates a path source