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

repourl

package
v0.53.0 Latest Latest
Warning

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

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

Documentation

Overview

Package repourl decides whether two spellings of a Git repository URL name the same repository.

One repository has many spellings: GitHub hands out https://github.com/acme/platform.git, git@github.com:acme/platform.git and https://github.com/acme/platform in the same payload, and a GitProvider's spec.url can be any of them. Comparing the strings would call those three different repositories, so a relay that names the repository one way would be ignored for a provider that spells it another.

The comparison is deliberately loose about transport and strict about identity: scheme, userinfo, default ports, a trailing ".git" and case are dropped, while the host, a non-default port and the path are kept. Case is dropped from the path too, because the hosts this is used with (GitHub, GitLab, Gitea) resolve repository paths case-insensitively.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Normalize

func Normalize(raw string) string

Normalize returns the canonical "host[:port]/path" form of a repository URL, or "" for an empty one. It accepts URL forms (https://, http://, ssh://, git://) and the scp-like SSH form "[user@]host:path". A string it cannot parse is returned lowercased and trimmed, so it can still only ever equal itself.

func Same

func Same(a, b string) bool

Same reports whether a and b name the same repository. Two empty URLs are not the same repository: an absent value is no evidence of a match.

Types

This section is empty.

Jump to

Keyboard shortcuts

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