util

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2019 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildString

func BuildString(version *Version) string

BuildString ...

func GOBDecode added in v0.5.0

func GOBDecode(b []byte, result interface{}) error

GOBDecode ...

func GOBEncode added in v0.5.0

func GOBEncode(v interface{}) ([]byte, error)

GOBEncode ...

func GetBuildTime added in v0.2.0

func GetBuildTime(version *Version) *time.Time

GetBuildTime ...

func VersionString

func VersionString(version *Version) string

VersionString ...

func VersionedBuildString

func VersionedBuildString(version *Version) string

VersionedBuildString ...

Types

type CallerTree added in v0.4.0

type CallerTree struct {
	DotPath          string
	DotDotPath       string
	DotDotDotPath    string
	DotDotDotDotPath string
}

CallerTree returns data that precomputes paths for convenience

func CallerPaths added in v0.4.0

func CallerPaths(pc uintptr, file string, line int, ok bool) *CallerTree

CallerPaths takes as input the results from calling runtime.Caller(0) and returns a data structure of current caller's path and a set of parent paths. In a Golang-standard project directory for this project, the following would be true:

paths := CallerPaths(pc, file, line, ok) strings.HasSuffix(paths.DotPath, "/github.com/bluest-eel/common/util") strings.HasSuffix(paths.DotDotPath, "/github.com/bluest-eel/common") strings.HasSuffix(paths.DotDotDotPath, "/github.com/bluest-eel") strings.HasSuffix(paths.DotDotDotDotPath, "/github.com")

type Version

type Version struct {
	Semantic   string     `json:"semantic"`
	BuildDate  string     `json:"build-date"`
	BuildTime  *time.Time `json:"build-time"`
	GitCommit  string     `json:"git-commit"`
	GitBranch  string     `json:"git-branch"`
	GitSummary string     `json:"git-summary"`
}

Version data

Jump to

Keyboard shortcuts

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