semver

package
v1.94.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultVersionFile = "module.properties"
)

Variables

This section is empty.

Functions

func Canonical

func Canonical(v string) (canonical string, err error)

Canonical will return the canonical form of the version with the .MAJOR .MINOR and .PATCH whilst discarding build information It will return an error if the version is not valid semver (unlike Canonical() in golang.org/x/mod/semver) Use CanonicalWithGoPrefix() if you want the 'v' prefix for compatibility with golang.org/x/mod/semver

func CanonicalWithGoPrefix

func CanonicalWithGoPrefix(v string) (canonical string, err error)

CanonicalWithGoPrefix will return the canonical form of the version with the .MAJOR .MINOR and .PATCH whilst discarding build information It will return an error if the version is not valid semver (unlike Canonical() in golang.org/x/mod/semver) It will prepend 'v' if necessary for compatibility with 'golang.org/x/mod/semver'. Use Canonical() if you don't want the 'v' prefix

func DetermineEmbeddedVersion added in v1.84.0

func DetermineEmbeddedVersion(ctx context.Context, fs *embed.FS, versionFilePath *string) (version string, err error)

DetermineEmbeddedVersion retrieves the version information of a project from embedded files.

func DetermineVersionFromFile added in v1.84.0

func DetermineVersionFromFile(ctx context.Context, fs filesystem.FS, versionFilePath string) (version string, err error)

DetermineVersionFromFile retrieves the information about the version of a project based on a version file generated by [autoversion](https://github.com/ARMmbed/autoversion). The Canonical version is returned.

func SanitiseVersionMajor

func SanitiseVersionMajor(version string) (majorMinor string, err error)

SanitiseVersionMajor will return the major part of the version with the 'v' prefix

func SanitiseVersionMajorMinor

func SanitiseVersionMajorMinor(version string) (majorMinor string, err error)

SanitiseVersionMajorMinor will return the major and minor parts of the version with the 'v' prefix

func TrimGoPrefix

func TrimGoPrefix(v string) string

TrimGoPrefix will trim the 'v' prefix from a string

Types

This section is empty.

Jump to

Keyboard shortcuts

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