pathkit

package
v0.296.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package pathkit implements utility routines for manipulating slash-separated paths.

The path package should only be used for paths separated by forward slashes, such as the paths in URLs. This package does not deal with Windows paths with drive letters or backslashes; to manipulate operating system paths, use the path/filepath package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Canonical

func Canonical(p string) string

func Clean

func Clean(p string) string

func Join

func Join(ps ...string) string

Join function makes it easy to combine different parts of a path, making sure slashes are handled correctly. If you provide a URL as the first thing in the Join function, it becomes the starting point for creating the final URL.

Double slashes prefixes are preserved as part of the joining. Instances of double slashes (//) in a path commonly denote a relative URL path. When a browser or HTTP client encounters // at the path's start, it omits the leading slashes, interpreting the remaining path as relative to the current URL's path. For instance, if the present URL is https://example.com/some/path, and you reference //foo/bar, the resulting URL becomes https://example.com/some/foo/bar.

func Split

func Split(path string) []string

func SplitBase added in v0.196.0

func SplitBase(uri string) (_baseURL string, _path string)

SplitBase will split a given uri into a base url and a request path.

func Unshift

func Unshift(rawPath string) (_pathParameter string, _remainingPath string)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL