version

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package version exposes build-time identifiers stamped via -ldflags.

Index

Constants

This section is empty.

Variables

View Source
var (
	Version   = "dev"
	Commit    = "none"
	BuildDate = "unknown"
)

Populated by the build via -ldflags. Defaults make `go run` informative even without -ldflags.

Version is the output of `git describe --tags --always`: a semver tag (e.g. "v0.2.0"), a tag plus distance (e.g. "v0.2.0-3-gf1fd170"), or — when no tag is reachable from HEAD — a bare short commit hash (e.g. "f1fd170").

Functions

func CompareVersions

func CompareVersions(current, latest string) int

CompareVersions compares two "vX.Y.Z" semver strings. Returns -1 (current<latest), 0 (equal), 1 (current>latest). "dev"/"none"/empty current → -1.

func Display

func Display() string

Display returns the human-facing version label, used for the startup banner and `dsc version`. It guarantees exactly one "v" prefix for a semver-shaped Version and never fakes one for an untagged build:

"v0.2.0"            → "v0.2.0"          (already prefixed by git describe)
"v0.2.0-3-gf1fd170" → "v0.2.0-3-gf1fd170"
"0.2.0"             → "v0.2.0"          (tag created without the "v")
"f1fd170"           → "build f1fd170"   (bare commit hash — not a version)
"dev" / "none" / "" → "dev"

The callers must NOT prepend their own "v"; doing so used to render a bare commit hash as a pseudo-version ("v0612286") and would double-prefix a real tag ("vv0.2.0").

func LatestRelease

func LatestRelease(ctx context.Context) (tag, htmlURL string, err error)

LatestRelease queries GitHub for the newest release of amemiya02/deepseekcode.

func String

func String() string

String returns a "<display> (commit, date)" rendering for `dsc version`.

Types

type Method

type Method string
const (
	MethodBrew      Method = "brew"
	MethodCurl      Method = "curl"
	MethodGoInstall Method = "go-install"
	MethodManual    Method = "manual"
)

func DetectInstallMethod

func DetectInstallMethod(execPath string) Method

DetectInstallMethod infers the install method from the resolved executable path. Callers must filepath.EvalSymlinks before passing.

Jump to

Keyboard shortcuts

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