modfile

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: LGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindModuleRoot

func FindModuleRoot(startDir string) (string, bool)

FindModuleRoot resolves the Go module root using `go env GOMOD`.

func IsOlderThan

func IsOlderThan(ver, baseline string) bool

IsOlderThan returns true if ver is a valid semver version strictly less than baseline. Returns false if either version is invalid.

func ModuleDependencyVersion

func ModuleDependencyVersion(moduleRoot, modulePath string) (string, bool, error)

ModuleDependencyVersion returns the version for modulePath in the go.mod file for moduleRoot. Replace directives take precedence over require directives. If a replace exists without a version, it falls back to the require entry.

func ModuleReplace

func ModuleReplace(moduleRoot, modulePath string) (newVersion string, found bool, err error)

ModuleReplace reports whether modulePath is replaced in moduleRoot's go.mod and returns the replacement's New.Version. found is true when any replace directive matches modulePath by its old path — covering the same-path (version bump), fork, versioned-old, and path-only (local) replace forms. newVersion is the version the backend actually builds against for a versioned replace, and "" for a path-only local replace (e.g. "=> ./local"), whose effective version cannot be determined from go.mod alone.

ModuleDependencyVersion falls back to the require line for a path-only replace, which is indistinguishable from a plain, un-replaced dependency — use ModuleReplace to tell them apart so a path-only replace can skip a version comparison rather than compare a stale require hint.

Types

This section is empty.

Jump to

Keyboard shortcuts

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