version

package
v1.0.0-...-4f7f1ef Latest Latest
Warning

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

Go to latest
Published: May 31, 2016 License: LGPL-3.0 Imports: 2 Imported by: 0

README

KDGoLib version package

Usage

  • import package
import "github.com/tsaikd/KDGoLib/version"
  • initialize version
func init() {
	version.VERSION = "0.0.1"
}
  • show version in somewhere
func main() {
	fmt.Println(version.String())
}
  • config LDFLAGS when compile time
githash="$(git rev-parse HEAD | cut -c1-8)"
buildtime="$(date +%Y-%m-%d)"

LDFLAGS="${LDFLAGS} -X github.com/tsaikd/KDGoLib/version.BUILDTIME ${buildtime}"
LDFLAGS="${LDFLAGS} -X github.com/tsaikd/KDGoLib/version.GITCOMMIT ${githash}"

go build -ldflags "${LDFLAGS}"

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	VERSION   = "0.0.0"
	BUILDTIME string
	GITCOMMIT string
	GODEPS    string
)

Functions

func Json

func Json() (output string, err error)

func String

func String() (output string)

Types

type Version

type Version struct {
	VERSION   string      `json:"version"`
	BUILDTIME string      `json:"buildtime,omitempty"`
	GITCOMMIT string      `json:"gitcommit,omitempty"`
	GODEPS    interface{} `json:"godeps,omitempty"`
}

func Get

func Get() (ver Version)

Jump to

Keyboard shortcuts

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