location

package
v0.14.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package location holds where GitOps files live: the Repository and the Location (repository, branch and directory), parsed from a repository URL or named by the caller. Each GitOps tool's resolver builds a Location from that tool's objects (target/flux for Flux). The package talks to no cluster.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoBranch is returned for a location without a branch: a GitOps
	// source that follows a tag, semver range or commit cannot receive a
	// commit.
	ErrNoBranch = errors.New("git repository follows no branch")
	// ErrNotGitHub is returned for a repository URL that is not a GitHub
	// owner/name repository.
	ErrNotGitHub = errors.New("not a GitHub repository URL")
	// ErrInvalidPath is returned for a directory or file name that is absolute
	// or leaves the location's directory.
	ErrInvalidPath = errors.New("path leaves the repository directory")
)

Functions

This section is empty.

Types

type Location

type Location struct {
	Repository Repository
	Branch     string
	// Directory is repository-relative without a leading "./" or trailing "/";
	// the empty string is the repository root.
	Directory string
}

Location is where a target's files live: a directory on a branch of a repository.

func Explicit

func Explicit(repository, branch, directory string) (Location, error)

Explicit returns the location the caller names: repository as owner/name, the branch, and a repository-relative directory ("" or "." for the root).

func (Location) Path

func (l Location) Path(name string) (string, error)

Path returns the repository-relative path of a file in the location. A name that is absolute or climbs out of the directory is refused.

type Repository

type Repository struct {
	Owner string
	Name  string
}

Repository is a GitHub repository.

func ParseRepositoryURL

func ParseRepositoryURL(raw string) (Repository, error)

ParseRepositoryURL returns the GitHub repository a Flux GitRepository URL names, in its https, ssh:// or scp-like git@ form, with or without ".git", on github.com or on GitHub's SSH endpoint on port 443, ssh.github.com.

func (Repository) String

func (r Repository) String() string

String returns owner/name.

Jump to

Keyboard shortcuts

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