Help us shape the future of Go! Take the 2026 Go Developer Survey

pathutil

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package pathutil holds boundary-safe path predicates over filesystem paths. Comparisons canonicalise both sides (clean + symlink-resolve) then use an explicit separator boundary so "/a/bc" is never nested under "/a/b".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Canonical

func Canonical(abs string) string

Canonical cleans abs and symlink-resolves the longest existing prefix so that macOS /var vs /private/var (and other symlink spellings of the same directory) collapse to one form. A missing tail is rejoined after the resolved prefix. Callers should pass an absolute path; relative inputs are cleaned only.

func Overlap

func Overlap(a, b string) bool

Overlap reports whether a and b are equal or one is nested within the other (both sides canonicalised).

func UnderOrEqual

func UnderOrEqual(child, ancestor string) bool

UnderOrEqual reports whether child is the same as ancestor or lies within it after both paths are canonicalised, on a path-separator boundary.

Types

This section is empty.

Jump to

Keyboard shortcuts

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