versionx

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 1 Imported by: 0

README

versionx 包 Package

versionx 定义构建版本元数据和基础兼容性判断。

Use BuildInfo or the VersionInfo alias to expose release metadata in L1 packages; Compatibility can match module and major version.

Documentation

Overview

Package versionx 定义构建版本元数据和兼容性判断。

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildInfo

type BuildInfo struct {
	Module    string `json:"module"`
	Version   string `json:"version"`
	Commit    string `json:"commit"`
	BuildTime string `json:"build_time"` // Prefer time.Time for new code; string retained for backward compatibility.
	GoVersion string `json:"go_version"`
}

func NewBuildInfo

func NewBuildInfo(module, version, commit, buildTime, goVersion string) BuildInfo
Example
package main

import (
	"github.com/ZoneCNH/kernel/versionx"
)

func main() {
	_ = versionx.NewBuildInfo("github.com/ZoneCNH/kernel", "v0.1.0", "local", "2026-06-01T00:00:00Z", "go1.23")
}

type Compatibility

type Compatibility struct {
	Module string
	Major  string
}

func (Compatibility) CompatibleWith

func (c Compatibility) CompatibleWith(info BuildInfo) bool

type VersionInfo deprecated

type VersionInfo = BuildInfo

VersionInfo is an alias for BuildInfo.

Deprecated: Use BuildInfo directly.

func NewVersionInfo

func NewVersionInfo(module, version, commit, buildTime, goVersion string) VersionInfo

Jump to

Keyboard shortcuts

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