cosmos-sdk: Index | Files

package version

import ""

Package version is a convenience utility that provides SDK consumers with a ready-to-use version command that produces apps versioning information based on flags passed at compile time.

Configure the version command

The version command can be just added to your cobra root command. At build time, the variables Name, Version, Commit, and BuildTags can be passed as build flags as shown in the following example:

go build -X \
 -X \
 -X \
 -X \
 -X " darwin amd64"


Package Files

command.go version.go


var (
    // application's name
    Name = ""
    // application binary name
    AppName = "<appd>"
    // application's version string
    Version = ""
    // commit
    Commit = ""
    // build tags
    BuildTags = ""

func NewVersionCommand Uses

func NewVersionCommand() *cobra.Command

type Info Uses

type Info struct {
    Name      string `json:"name" yaml:"name"`
    AppName   string `json:"server_name" yaml:"server_name"`
    Version   string `json:"version" yaml:"version"`
    GitCommit string `json:"commit" yaml:"commit"`
    BuildTags string `json:"build_tags" yaml:"build_tags"`
    GoVersion string `json:"go" yaml:"go"`

Info defines the application version information.

func NewInfo Uses

func NewInfo() Info

func (Info) String Uses

func (vi Info) String() string

Package version imports 7 packages (graph) and is imported by 80 packages. Updated 2020-07-12. Refresh now. Tools for package owners.