version

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ProjectName is the name of the project.
	ProjectName = "DXClusterGoAPI"

	// ProjectGitHubURL is the GitHub repository URL.
	ProjectGitHubURL = "https://github.com/user00265/dxclustergoapi"

	// BuildVersion represents the semantic version of the build.
	// This should be set via ldflags with a semver tag (e.g., v1.0.0).
	// If not set, it defaults to "unknown".
	BuildVersion = "unknown"

	// GitCommit represents the short Git commit hash.
	// This should be set via ldflags with the git commit hash.
	GitCommit = "unknown"
)

These variables are populated at build time using ldflags. Example: go build -ldflags "-X 'github.com/user00265/dxclustergoapi/internal/version.GitCommit=f80cf83' -X 'github.com/user00265/dxclustergoapi/internal/version.BuildVersion=1.0.0'" ...

View Source
var ProjectVersion = func() string {
	if BuildVersion != "unknown" && GitCommit != "unknown" {

		return fmt.Sprintf("%s+%s", strings.TrimPrefix(BuildVersion, "v"), GitCommit[:7])
	}
	return "unknown"
}()

ProjectVersion constructs the full project version string. If BuildVersion is a valid semver and GitCommit is available, it's "vX.Y.Z+COMMIT". Otherwise, it's just "unknown".

UserAgent is the full User-Agent string to be used in HTTP requests.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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