package version

import "github.com/moby/swarmkit/v2/version"

Index

Variables

var (
	// Cmd can be added to other commands to provide a version subcommand with
	// the correct version of swarm.
	Cmd = &cobra.Command{
		Use:   "version",
		Short: "Print version number of swarm",
		RunE: func(cmd *cobra.Command, args []string) error {
			if len(args) != 0 {
				return errors.New("version command takes no arguments")
			}

			PrintVersion()
			return nil
		},
	}
)
var Package = "github.com/moby/swarmkit/v2"

Package is the overall, canonical project import path under which the package was built.

var Version = "cba102b+unknown"

Version indicates which version of the binary is running. This is set to the latest release tag by hand, always suffixed by "+unknown". During build, it will be replaced by the actual version. The value here will be used if the registry is run after a go get based install.

Functions

func FprintVersion

func FprintVersion(w io.Writer)

FprintVersion outputs the version string to the writer, in the following format, followed by a newline:

<cmd> <project> <version>

For example, a binary "registry" built from github.com/docker/distribution with version "v2.0" would print the following:

registry github.com/docker/distribution v2.0

func PrintVersion

func PrintVersion()

PrintVersion outputs the version information, from Fprint, to stdout.

Source Files

cmd.go print.go version.go

Version
v2.0.0-20250103191802-8c1959736554 (latest)
Published
Jan 3, 2025
Platform
linux/amd64
Imports
5 packages
Last checked
1 week ago

Tools for package owners.