Documentation
¶
Overview ¶
Package vcs provides utilities for working with version control systems.
This package extracts version control information from Go binaries built with module support and version control integration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Version ¶
func Version() string
Version returns the build time, revision hash, and revision integer. The returned string format is "time-revision-int" or "time-revision-int-dirty" if the working directory had uncommitted changes at build time. The integer is derived from the first 4 bytes of the git revision hash.
func VersionInt32 ¶ added in v0.7.7
VersionInt32 returns the git revision hash and its integer representation. The integer is derived from the first 4 bytes (8 hex characters) of the revision hash and is suitable for use as SQLite user_version (signed 32-bit integer).
This function extracts the vcs.revision value from the build information embedded in the binary during compilation with -buildvcs flag.
Returns:
- revision: The full git commit hash (e.g., "abc123def456...")
- revisionInt: A signed 32-bit integer representation (e.g., -1412567330)
- error: Non-nil if build info is unavailable, revision not found, or parsing fails
Types ¶
This section is empty.