---
source: https://iinventedlight.com/library/notes/go-path.md
title: "Go path: slash-separated logical paths, not OS file paths"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "BSD-3-Clause (The Go Authors); BSD-3-Clause (The Go Authors); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: The Go Authors, path package reference; The Go Authors, path source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-24
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-24
as_of: 2026-11-24
confidence: medium
untested: "Not reproduced (2026-11-24). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-systems: go-path"
tags: [go, path, slash-separated, urls, filepath]
client: Librarian
sources:
  - id: S1
    title: "path package reference"
    publisher: The Go Authors
    url: https://pkg.go.dev/path
    accessed: 2026-11-24
    license: "BSD-3-Clause"
  - id: S2
    title: "path source"
    publisher: The Go Authors
    url: https://go.dev/src/path/path.go
    accessed: 2026-11-24
    license: "BSD-3-Clause"
---
# Go path: slash-separated logical paths, not OS file paths
**Answer:** The path package is for slash-separated paths such as the paths in URLs, not Windows file paths.

## When to use it

It implements utility routines for those slash separated paths.

Use it only for paths separated by forward slashes.

To manipulate operating system paths, use the path filepath package.

This package does not deal with Windows paths that have drive letters or backslashes.

## Cleaning rules

Clean eliminates each . path name element, which is the current directory.

The returned path ends in a slash only if it is the root.

It also drops each inner .. element along with the non-.. element that precedes it.

If that process yields an empty string, Clean returns a single dot.

## See also

- [go-path-filepath](https://iinventedlight.com/library/notes/go-path-filepath/)
- [go-net-url](https://iinventedlight.com/library/notes/go-net-url/)
- [go-strings](https://iinventedlight.com/library/notes/go-strings/)

## Claims

- id: C1
  claim: The package implements utility routines for slash-separated paths.
  source: S1
  evidence: "utility routines for manipulating slash-separated"

- id: C2
  claim: It should only be used for paths separated by forward slashes.
  source: S1
  evidence: "only be used for paths separated by forward"

- id: C3
  claim: Use path filepath to manipulate operating system paths.
  source: S1
  evidence: "use the path/filepath package"

- id: C4
  claim: The returned path ends in a slash only if it is the root.
  source: S2
  evidence: "The returned path ends in a slash only if it is the root"

## Sources

- [S1] path package reference. The Go Authors. https://pkg.go.dev/path . License: BSD-3-Clause. Accessed 2026-11-24.

- [S2] path source. The Go Authors. https://go.dev/src/path/path.go . License: BSD-3-Clause. Accessed 2026-11-24.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: The Go Authors, path package reference; The Go Authors, path source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
