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

pathutil

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package pathutil compares file paths the way the filesystem does.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Real

func Real(p string) string

Real resolves symlinks in p, or in its directory when p itself is gone (an undone creation, a file not written yet). It returns p when neither resolves.

func Same

func Same(a, b string) bool

Same reports whether a and b name the same file: equal once absolute and clean, once symlinks are resolved (macOS temp and home directories are often symlinked), or, when both exist, by file identity (letter case on a case-insensitive volume, a hard link). Windows paths compare without case.

func Within

func Within(dir, path string) bool

Within reports whether path is dir or lies under it. It is lexical, as filepath.Rel is: nothing is resolved, so callers that care about symlinks resolve both paths first, and letter case compares as filepath.Rel compares it. A path on another Windows volume is never within dir.

Types

This section is empty.

Jump to

Keyboard shortcuts

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