sourcepath

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package sourcepath handles filesystem paths recorded on a machine whose OS may differ from the process reading them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasPathSuffix

func HasPathSuffix(value, suffix string) bool

HasPathSuffix reports whether an absolute path ends at a repository-relative path boundary.

func IsAbsolute

func IsAbsolute(value string) bool

IsAbsolute reports whether value includes a complete POSIX, drive, or UNC root.

func IsRepositoryRelative

func IsRepositoryRelative(value string) bool

IsRepositoryRelative reports whether value safely names a path below a repository root.

func Join

func Join(base, child string) string

Join resolves a repository-relative child below base using the recorded path syntax.

func Normalize

func Normalize(value string) string

Normalize returns the canonical spelling of a recorded path.

func Rel

func Rel(base, target string) (string, bool)

Rel returns target relative to base when both use compatible absolute roots.

Types

type Path

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

Path is a lexically normalized recorded path. It does not inspect the local filesystem and therefore keeps the source machine's path semantics.

func Parse

func Parse(raw string) Path

func (Path) IsAbsolute

func (p Path) IsAbsolute() bool

func (Path) IsRepositoryRelative

func (p Path) IsRepositoryRelative() bool

func (Path) String

func (p Path) String() string

func (Path) Style

func (p Path) Style() Style

func (Path) Valid

func (p Path) Valid() bool

type Style

type Style uint8

Style identifies the path syntax found in recorded data.

const (
	StyleInvalid Style = iota
	StyleRelative
	StylePOSIX
	StyleWindowsDrive
	StyleWindowsUNC
	StyleWindowsDriveRelative
	StyleWindowsRooted
)

Jump to

Keyboard shortcuts

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