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

fsutil

package
v0.35.0 Latest Latest
Warning

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

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

Documentation

Overview

Package fsutil provides small, filesystem-shaped helpers shared by skillet tools. The functions take an fs.FS rather than touching the OS directly, so callers inject os.DirFS in production and testing/fstest.MapFS in tests, and the discovery logic stays pure and independently testable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SubdirsContaining

func SubdirsContaining(fsys fs.FS, dir, marker string) ([]string, error)

SubdirsContaining returns the immediate subdirectories of dir (within fsys) that directly contain a file named marker, as slash paths joined onto dir. The result is sorted by name, because fs.ReadDir returns entries in order.

It returns an error if dir cannot be read. Pass "." for the root of fsys. This is the single-tree discovery shape (a marker file in each candidate child of one parent directory).

func SubdirsContainingAny

func SubdirsContainingAny(fsys fs.FS, dirs []string, marker string) ([]string, error)

SubdirsContainingAny unions SubdirsContaining across dirs, deduplicating repeated subdirectory paths and preserving order — dirs in the given order, subdirectories sorted within each. A dir that does not exist is skipped, modelling an optional root absent in the current environment; any other read error is returned, so a permission fault is surfaced rather than hidden. This is the multi-root discovery shape (scan several candidate parents at once).

Types

This section is empty.

Jump to

Keyboard shortcuts

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