package module

import "cmd/go/internal/module"

Package module defines the module.Version type along with support code.

Index

Functions

func Check

func Check(path, version string) error

Check checks that a given module path, version pair is valid. In addition to the path being a valid module path and the version being a valid semantic version, the two must correspond. For example, the path "yaml/v2" only corresponds to semantic versions beginning with "v2.".

func CheckPath

func CheckPath(path string) error

CheckPath checks that a module path is valid.

func MatchPathMajor

func MatchPathMajor(v, pathMajor string) bool

MatchPathMajor reports whether the semantic version v matches the path major version pathMajor.

func SplitPathVersion

func SplitPathVersion(path string) (prefix, pathMajor string, ok bool)

SplitPathVersion returns prefix and major version such that prefix+pathMajor == path and version is either empty or "/vN" for N >= 2. As a special case, gopkg.in paths are recognized directly; they require ".vN" instead of "/vN", and for all N, not just N >= 2.

Types

type Version

type Version struct {
	Path    string
	Version string
}

A Version is defined by a module path and version pair.

Source Files

module.go

Version
v1.11.0-beta.1
Published
Jun 26, 2018
Platform
js/wasm
Imports
5 packages
Last checked
15 seconds ago

Tools for package owners.