label

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clean

func Clean(pkg string) (string, error)

Clean returns the shortest pkg name equivalent to pkg and checks the pkg path for errors. It replaces multiple slashes with a single slash and rejects pkg paths that contain colons, '..' or '.' elements.

func Dir

func Dir(pkg string) string

Dir returns the last component of pkg.

func Join

func Join(elem ...string) (string, error)

Join joins any number of path elements into a single path, separating them with slashes. Empty elements are ignored. The result is Cleaned. However, if the argument list is empty or all its elements are empty, Join returns an empty string.

func Parent

func Parent(pkg string) string

Parent returns the parent of pkg.

func Split

func Split(pkg string) []string

Split splits a package path into its components. If the path is absolute, the first component will be "//". Multiple slashes separating components are treated as a single slash.

Types

type Label

type Label struct {
	Kind    string
	Module  string
	Version *semver.Version
	Package string
	Name    string
}

A Label represents a parsed label.

The general form represented is:

[kind:][[module[+version]@][//]package][:name]

If the package is omitted and the name is present, the label is relative to the current package.

func New

func New(kind, module, pkg, name string) (*Label, error)

func Parse

func Parse(rawlabel string) (*Label, error)

Parse parses rawlabel into a Label structure.

func (*Label) Attr added in v0.1.1

func (l *Label) Attr(name string) (starlark.Value, error)

starlark.HasAttrs

func (*Label) AttrNames added in v0.1.1

func (l *Label) AttrNames() []string

func (*Label) CompareSameType added in v0.1.1

func (l *Label) CompareSameType(op syntax.Token, y starlark.Value, depth int) (bool, error)

starlark.Comparable

func (*Label) Freeze added in v0.1.1

func (l *Label) Freeze()

func (*Label) Hash added in v0.1.1

func (l *Label) Hash() (uint32, error)

func (*Label) IsAbs

func (l *Label) IsAbs() bool

func (*Label) MarshalText

func (l *Label) MarshalText() ([]byte, error)

func (*Label) RelativeTo

func (l *Label) RelativeTo(pkg string) (*Label, error)

func (*Label) String

func (l *Label) String() string

func (*Label) Truth added in v0.1.1

func (l *Label) Truth() starlark.Bool

func (*Label) Type added in v0.1.1

func (l *Label) Type() string

starlark.Value

func (*Label) UnmarshalText

func (l *Label) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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