paths

package
v0.15.4 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 7 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodePath added in v0.1.0

func DecodePath(encoding string) (path string, err error)

DecodePath returns the module path of the given safe encoding. It fails if the encoding is invalid or encodes an invalid path.

func GetModule

func GetModule(r *http.Request) (string, error)

GetModule gets the module from the path of a ?go-get=1 request.

func GetVersion added in v0.1.0

func GetVersion(r *http.Request) (string, error)

GetVersion gets the version from the path of a ?go-get=1 request.

func MatchesPattern added in v0.7.0

func MatchesPattern(pattern, target string) bool

MatchesPattern reports whether the path prefix of target matches pattern (as defined by path.Match).

This tries to keep the same behavior as GOPRIVATE/GONOPROXY/GONOSUMDB, and is adopted from: https://github.com/golang/go/blob/a11644a26557ea436d456f005f39f4e01902bafe/src/cmd/go/internal/str/path.go#L58

Types

type AllPathParams

type AllPathParams struct {
	Module  string `json:"module"`
	Version string `json:"version"`
}

AllPathParams holds the module and version in the path of a ?go-get=1 request.

func GetAllParams

func GetAllParams(r *http.Request) (*AllPathParams, error)

GetAllParams fetches the path params from r and returns them.

Jump to

Keyboard shortcuts

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