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

paths

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

README

core/paths

The path helpers AutoDoc's core packages share, written once. Paths are slash-separated and clean, relative to a workspace or absolute.

Function Answers
Under(p, dir) whether p is dir or inside it, by whole segments; every relative path is under "."
ExpandHome(p) p with a leading ~ or ~/ made the home directory (ErrNoHome when there is none); any other path as it is. Used by the config's paths and a workspace's root

Functions with no disk I/O, safe for concurrent use (ExpandHome reads the home directory from the environment). An SQL form of Under (a dao.Predicate) lives with the queries that need it, in core/index and core/pgstore.

Documentation

Overview

Package paths is the path helpers AutoDoc's core packages share, so each is written once. Paths are slash-separated and clean: a workspace's relative paths, or absolute ones.

Concurrency: the package is functions of their arguments (ExpandHome also reads the home directory from the environment); any number of goroutines may call them.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoHome = errs.Sentinel(errs.ErrInvalidArgument, "paths: no home directory")

ErrNoHome is a "~" path expanded with no home directory to put in its place.

Functions

func ExpandHome

func ExpandHome(p string) (string, error)

ExpandHome is p with a leading "~" or "~/" made the user's home directory. Any other path is returned as it is.

func Under

func Under(p, dir string) bool

Under reports whether p is dir or inside it, by whole segments: "a/bc" is not under "a/b". Every relative path is under ".".

Types

This section is empty.

Jump to

Keyboard shortcuts

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