v0.0.0-...-addcc3b Latest Latest

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 4 Imported by: 14



Package version provides a way for CIPD packaged Go binaries to discover their current package instance ID.

It's safe to link this library into arbitrary executables. It is small and doesn't pull in rest of CIPD client code.



This section is empty.


This section is empty.


func GetVersionFile

func GetVersionFile(exePath string) string

GetVersionFile returns the path to the version file corresponding to the provided exe. This isn't typically needed, but can be useful for debugging.


type Info

type Info struct {
	PackageName string `json:"package_name"`
	InstanceID  string `json:"instance_id"`

Info describes JSON file with package version information that's deployed to a path specified in 'version_file' attribute of the manifest.

func GetCurrentVersion

func GetCurrentVersion() (Info, error)

GetCurrentVersion reads version file from disk.

Note that it may have been updated since the process started. This function always reads the latest values. Version file is expected to be found at <exe-path>.cipd_version.

Add following lines to package definition yaml to to set this up:

  - version_file: .versions/<exe-name>${exe_suffix}.cipd_version

Replace <exe-name> with name of the binary file.

If the version file is missing, returns empty Info{} and no error.

func GetStartupVersion

func GetStartupVersion() (Info, error)

GetStartupVersion returns value of version file as it was when the process has just started.

Jump to

Keyboard shortcuts

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