Merge commit 'f96384a3b596f9bc0a3a035970b09b2c601f0ccb'

This commit is contained in:
Bjørn Erik Pedersen
2023-05-22 16:47:07 +02:00
341 changed files with 3107 additions and 4238 deletions

View File

@@ -1,13 +1,10 @@
---
title: path.Clean
description: Replaces path separators with slashes (`/`) and removes extraneous separators.
date: 2021-10-08
# publishdate: 2018-11-28
# lastmod: 2018-11-28
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [path, clean]
signature: ["path.Clean PATH"]
relatedfuncs: [path.Base, path.BaseName, path.Dir, path.Ext, path.Join, path.Split]
@@ -15,13 +12,13 @@ relatedfuncs: [path.Base, path.BaseName, path.Dir, path.Ext, path.Join, path.Spl
`path.Clean` replaces path separators with slashes (`/`) and removes extraneous separators, including trailing separators.
```
```go-html-template
{{ path.Clean "foo//bar" }} → "foo/bar"
{{ path.Clean "/foo/bar/" }} → "/foo/bar"
```
On a Windows system, if `.File.Path` is `foo\bar.md`, then:
```
```go-html-template
{{ path.Clean .File.Path }} → "foo/bar.md"
```