jsonnetmod

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewImporter

func NewImporter(ctx context.Context, resolver Resolver) jsonnet.Importer

func WithOpts

func WithOpts(ctx context.Context, fns ...OptFn) context.Context

Types

type ImportPath

type ImportPath struct {
	*Mod
	SubPath string
	// contains filtered or unexported fields
}

func ImportPathFor

func ImportPathFor(mod *Mod, importPath string) *ImportPath

func (*ImportPath) ImportPath added in v0.1.0

func (i *ImportPath) ImportPath() string

func (*ImportPath) RepoDir added in v0.1.0

func (i *ImportPath) RepoDir() string

func (*ImportPath) ResolvedImportPath added in v0.1.0

func (i *ImportPath) ResolvedImportPath() string

func (*ImportPath) SetJPath added in v0.1.0

func (i *ImportPath) SetJPath(jpath string)

func (*ImportPath) SymlinkOrTouchImportStub added in v0.1.0

func (i *ImportPath) SymlinkOrTouchImportStub(ctx context.Context) error

func (ImportPath) WithReplace added in v0.1.0

func (i ImportPath) WithReplace(from string, to string) *ImportPath

type Importer

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

func (*Importer) Import

func (i *Importer) Import(importedFrom, importedPath string) (jsonnet.Contents, string, error)

type Mod

type Mod struct {
	modfile.ModFile
	modfile.ModVersion
	// Repo
	Repo string
	// Dir module absolute dir
	Dir string
	// RepoSum repo absolute dir sum
	RepoSum string
}

func (*Mod) LoadInfo

func (m *Mod) LoadInfo() (bool, error)

func (*Mod) ResolveImportPath

func (m *Mod) ResolveImportPath(ctx context.Context, cache *ModCache, importPath string, version string) (*ImportPath, error)

func (*Mod) Resolved

func (m *Mod) Resolved() bool

func (*Mod) SetRequire

func (m *Mod) SetRequire(module string, modVersion modfile.ModVersion, indirect bool)

func (*Mod) String

func (m *Mod) String() string

type ModCache

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

func NewModCache

func NewModCache() *ModCache

func (*ModCache) Collect

func (c *ModCache) Collect(ctx context.Context, mod *Mod)

func (*ModCache) Get

func (c *ModCache) Get(ctx context.Context, pkgImportPath string, version string, fixVersion VersionFixer) (*Mod, error)

func (*ModCache) LookupReplace

func (c *ModCache) LookupReplace(importPath string) (matched modfile.PathIdentity, replace modfile.PathIdentity, exists bool)

func (*ModCache) RepoVersion

func (c *ModCache) RepoVersion(repo string) modfile.ModVersion

func (*ModCache) SetRepoVersion

func (c *ModCache) SetRepoVersion(module string, version modfile.ModVersion)

type OptFn

type OptFn = func(o *Opts)

func OptUpgrade

func OptUpgrade(b bool) OptFn

func OptVerbose

func OptVerbose(v bool) OptFn

type Opts

type Opts struct {
	Upgrade bool `name:"upgrade,u" usage:"need upgrade dependencies"`
	Verbose bool `name:"verbose,v" usage:"verbose"`
}

func OptsFromContext

func OptsFromContext(ctx context.Context) Opts

type Resolver

type Resolver interface {
	Resolve(ctx context.Context, importedPath string, importedFrom string) (founded string, err error)
}

type VMod

type VMod struct {
	*Mod
	// contains filtered or unexported fields
}

func VModFor

func VModFor(root string) *VMod

func (*VMod) Get

func (v *VMod) Get(ctx context.Context, i string) error

func (*VMod) ListJsonnet

func (v *VMod) ListJsonnet(fromPath string) ([]string, error)

func (*VMod) MakeVM

func (v *VMod) MakeVM(ctx context.Context) *jsonnet.VM

func (*VMod) Resolve

func (v *VMod) Resolve(ctx context.Context, importPath string, importedFrom string) (string, error)

func (*VMod) SetRequireFromImportPath

func (v *VMod) SetRequireFromImportPath(ctx context.Context, p *ImportPath, indirect bool) error

type VersionFixer

type VersionFixer = func(repo string, version string) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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