package version

import "github.com/gohugoio/hugo/common/version"

Index

Functions

func CompareVersions

func CompareVersions(v1 Version, v2 any) int

CompareVersion compares v1 with v2. It returns -1 if the v2 is less than, 0 if equal and 1 if greater than v1.

func GoMinorVersion

func GoMinorVersion() int

Types

type Version

type Version struct {
	Major int

	Minor int

	// Increment this for bug releases
	PatchLevel int

	// HugoVersionSuffix is the suffix used in the Hugo version string.
	// It will be blank for release versions.
	Suffix string
}

Version represents the Hugo build version.

func MustParseVersion

func MustParseVersion(s string) Version

MustParseVersion parses a version string and panics if any error occurs.

func ParseVersion

func ParseVersion(s string) (Version, error)

ParseVersion parses a version string.

func (Version) Compare

func (h Version) Compare(other any) int

Compare implements the compare.Comparer interface.

func (Version) IsAlphaBetaOrRC

func (v Version) IsAlphaBetaOrRC() bool

IsAlphaBetaOrRC returns whether this version is an alpha, beta, or release candidate.

func (Version) Next

func (v Version) Next() Version

Next returns the next Hugo release version.

func (Version) NextPatchLevel

func (v Version) NextPatchLevel(level int) Version

NextPatchLevel returns the next patch/bugfix Hugo version. This will be a patch increment on the previous Hugo version.

func (Version) Prev

func (v Version) Prev() Version

Prev returns the previous Hugo release version.

func (Version) ReleaseVersion

func (v Version) ReleaseVersion() Version

ReleaseVersion represents the release version.

func (Version) String

func (v Version) String() string

func (Version) Version

func (v Version) Version() VersionString

Version returns the Hugo version.

type VersionString

type VersionString string

VersionString represents a Hugo version string.

func (VersionString) Compare

func (h VersionString) Compare(other any) int

Compare implements the compare.Comparer interface.

func (VersionString) Eq

func (h VersionString) Eq(other any) bool

Eq implements the compare.Eqer interface.

func (VersionString) String

func (h VersionString) String() string

func (VersionString) Version

func (h VersionString) Version() Version

Source Files

version.go

Version
v0.153.4 (latest)
Published
Dec 28, 2025
Platform
linux/amd64
Imports
8 packages
Last checked
4 months ago

Tools for package owners.