Help us shape the future of Go! Take the 2026 Go Developer Survey

urls

package
v1.9.16 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeChart

func NormalizeChart(repo string) string

NormalizeChart normalizes a chart repository URL for purposes of comparison. Crucially, this function removes the oci:// prefix from the URL if there is one.

func NormalizeGit

func NormalizeGit(repo string) string

NormalizeGit normalizes Git URLs of the following forms:

  • http[s]://[proxy-user:proxy-pass@]host.xz[:port][/path/to/repo[.git][/]]
  • ssh://[user@]host.xz[:port][/path/to/repo[.git][/]]
  • [user@]host.xz[:path/to/repo[.git][/]]

This is useful for the purposes of comparison and also in cases where a canonical representation of a Git URL is needed. Any URL that cannot be normalized will be returned as-is.

func NormalizeImage

func NormalizeImage(repoURL string) string

NormalizeImage normalizes image repository URLs. Notably, hostnames docker.io and index.docker.io, if present, are dropped. The optional /library prefix for official images from Docker Hub, if included, is also dropped. Valid, non-Docker Hub repository URLs will be returned unchanged.

This is useful for the purposes of comparison and also in cases where a canonical representation of a repository URL is needed. Any URL that cannot be normalized will be returned as-is.

func SanitizeURL added in v1.9.3

func SanitizeURL(url string) string

SanitizeURL removes leading and trailing whitespace only from a string presumed to represent a URL. It additionally removes non-printable runes such as byte order marks (BOMs) from anywhere in a string. Leading whitespace and non-printable runes can easily be copied and pasted without a user realizing and are known to interfere with URL parsing.

Types

This section is empty.

Jump to

Keyboard shortcuts

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