SkillAgentSearch skills...

Pathlib.go

string types with path-manipulation methods

Install / Use

/learn @SKalt/Pathlib.go
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

pathlib.go

String types for path manipulation.

Benefits of using string types to represent paths

  1. you can treat paths exactly like strings
  2. String subtypes prevent common mix-ups: the go compiler will warn you about passing a string that could represent a file to a function that accepts a pathlib.Dir argument.
  3. Each string subtype can have associated methods, consolidating functionality from "path/filepath", "os", and "io/fs"

Prior art

Inspired by Python's pathlib and Go's filesystem methods scattered throughout the <abbr title="Standard library">stdlib</abbr>.

There are plenty of other ports of pathlib to go, but only one other package one other uses string types to represent paths.

Trade-offs

Using this library adds some overhead compared to using the stdlib functions directly. Rough measurements on my x86_64 machine indicated that linking pathlib adds around a kilobyte to the size of a binary that does nothing except links path/filepath.

View on GitHub
GitHub Stars4
CategoryDevelopment
Updated1mo ago
Forks0

Languages

Go

Security Score

85/100

Audited on Feb 13, 2026

No findings