path.Clean
Returns the shortest path name equivalent to the given path, after replacing path separators with slashes (/).
- Syntax
- path.Clean PATH
- Returns
- string
See Go’s path.Clean documentation for details.
{{ path.Clean "foo/bar" }} → foo/bar
{{ path.Clean "/foo/bar" }} → /foo/bar
{{ path.Clean "/foo/bar/" }} → /foo/bar
{{ path.Clean "/foo//bar/" }} → /foo/bar
{{ path.Clean "/foo/./bar/" }} → /foo/bar
{{ path.Clean "/foo/../bar/" }} → /bar
{{ path.Clean "/../foo/../bar/" }} → /bar
{{ path.Clean "" }} → .Last updated:
October 10, 2026
:
theme: Migrate aliases to a redirects data file (b732eba6c)
Improve this page