Debian Codegraph @

docs/content/en/functions/path/Clean.md

raw
1 ---
2 title: path.Clean
3 description: Returns the shortest path name equivalent to the given path, after replacing path separators with slashes (`/`).
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 aliases: []
9 returnType: string
10 signatures: [path.Clean PATH]
11 aliases: [/functions/path.clean]
12 ---
13
14 See Go's [`path.Clean`][] documentation for details.
15
16 ```go-html-template
17 {{ path.Clean "foo/bar" }} → foo/bar
18 {{ path.Clean "/foo/bar" }} → /foo/bar
19 {{ path.Clean "/foo/bar/" }} → /foo/bar
20 {{ path.Clean "/foo//bar/" }} → /foo/bar
21 {{ path.Clean "/foo/./bar/" }} → /foo/bar
22 {{ path.Clean "/foo/../bar/" }} → /bar
23 {{ path.Clean "/../foo/../bar/" }} → /bar
24 {{ path.Clean "" }} → .
25 ```
26
27 [`path.Clean`]: https://pkg.go.dev/path#Clean