Skip to main content

package_url

Function package_url 

Source
pub fn package_url(module_path: &str) -> String
Expand description

Returns the URL for a module’s documentation page on pkg.go.dev.

Each /-separated path segment is percent-encoded individually via urlencoding::encode (the same helper every other ecosystem uses), so / survives as the legitimate path separator in Go module paths (e.g. github.com/gin-gonic/gin) while every other character — including %, which a hand-rolled denylist would otherwise miss — is escaped.

Display link only, never fetched by this process — unlike a registry-fetch URL builder, so it is deliberately not gated against a ./.. module-path segment (see deps_core::is_dot_segment’s doc for the fetch-sink-vs-display-link scope split, #379).