Documentation ¶
Index ¶
- Variables
- func GetBuildDate(versionInfo *VersionInfo, timeLayout string) string
- func GetBuildDebug(versionInfo *VersionInfo) bool
- func GetBuildGoVersion(versionInfo *VersionInfo) string
- func GetBuildMethod(versionInfo *VersionInfo) string
- func GetBuildVersion(versionInfo *VersionInfo) string
- func GetGitCommit(versionInfo *VersionInfo) string
- func GetGitExactTag(versionInfo *VersionInfo) string
- func GetGitRepo(versionInfo *VersionInfo) string
- func GetGitSlug(versionInfo *VersionInfo) string
- func GetGitTag(versionInfo *VersionInfo) string
- func VersionHeaderMap() map[string]any
- type BuildInfo
- func (x *BuildInfo) ClearDate()
- func (x *BuildInfo) ClearDebug()
- func (x *BuildInfo) ClearGoVersion()
- func (x *BuildInfo) ClearMethod()
- func (x *BuildInfo) ClearVersion()
- func (x *BuildInfo) GetDate() *timestamppb.Timestamp
- func (x *BuildInfo) GetDebug() bool
- func (x *BuildInfo) GetGoVersion() string
- func (x *BuildInfo) GetMethod() string
- func (x *BuildInfo) GetVersion() string
- func (x *BuildInfo) HasDate() bool
- func (x *BuildInfo) HasDebug() bool
- func (x *BuildInfo) HasGoVersion() bool
- func (x *BuildInfo) HasMethod() bool
- func (x *BuildInfo) HasVersion() bool
- func (*BuildInfo) ProtoMessage()
- func (x *BuildInfo) ProtoReflect() protoreflect.Message
- func (x *BuildInfo) Reset()
- func (x *BuildInfo) SetDate(v *timestamppb.Timestamp)
- func (x *BuildInfo) SetDebug(v bool)
- func (x *BuildInfo) SetGoVersion(v string)
- func (x *BuildInfo) SetMethod(v string)
- func (x *BuildInfo) SetVersion(v string)
- func (x *BuildInfo) String() string
- type BuildInfo_builder
- type GitInfo
- func (x *GitInfo) ClearCommit()
- func (x *GitInfo) ClearExactTag()
- func (x *GitInfo) ClearRepo()
- func (x *GitInfo) ClearSlug()
- func (x *GitInfo) ClearTag()
- func (x *GitInfo) GetCommit() string
- func (x *GitInfo) GetExactTag() string
- func (x *GitInfo) GetRepo() string
- func (x *GitInfo) GetSlug() string
- func (x *GitInfo) GetTag() string
- func (x *GitInfo) HasCommit() bool
- func (x *GitInfo) HasExactTag() bool
- func (x *GitInfo) HasRepo() bool
- func (x *GitInfo) HasSlug() bool
- func (x *GitInfo) HasTag() bool
- func (*GitInfo) ProtoMessage()
- func (x *GitInfo) ProtoReflect() protoreflect.Message
- func (x *GitInfo) Reset()
- func (x *GitInfo) SetCommit(v string)
- func (x *GitInfo) SetExactTag(v string)
- func (x *GitInfo) SetRepo(v string)
- func (x *GitInfo) SetSlug(v string)
- func (x *GitInfo) SetTag(v string)
- func (x *GitInfo) String() string
- type GitInfo_builder
- type Time
- type VersionInfo
- func (x *VersionInfo) ClearBld()
- func (x *VersionInfo) ClearGit()
- func (x *VersionInfo) GetBld() *BuildInfo
- func (v *VersionInfo) GetBuild() *BuildInfodeprecated
- func (x *VersionInfo) GetGit() *GitInfo
- func (x *VersionInfo) HasBld() bool
- func (x *VersionInfo) HasGit() bool
- func (v *VersionInfo) JSON() ([]byte, error)
- func (*VersionInfo) ProtoMessage()
- func (x *VersionInfo) ProtoReflect() protoreflect.Message
- func (x *VersionInfo) Reset()
- func (x *VersionInfo) SetBld(v *BuildInfo)
- func (x *VersionInfo) SetGit(v *GitInfo)
- func (v *VersionInfo) SlogAttr(name string) slog.Attr
- func (x *VersionInfo) String() string
- func (v *VersionInfo) VersionString() string
- type VersionInfo_builder
Constants ¶
This section is empty.
Variables ¶
var ( BuildDate string BuildDebug string BuildMethod string BuildVersion string BuildGoVersion string GitRepo string GitSlug string GitCommit string GitTag string GitExactTag string )
var File_github_com_dosquad_go_cliversion_version_proto protoreflect.FileDescriptor
Functions ¶
func GetBuildDate ¶ added in v0.1.8
func GetBuildDate(versionInfo *VersionInfo, timeLayout string) string
GetBuildDate returns the versionInfo.GetBld().GetDate().AsTime().Format(timeLayout) if versionInfo.GetBld() is not nil, otherwise it returns an empty string.
func GetBuildDebug ¶ added in v0.1.8
func GetBuildDebug(versionInfo *VersionInfo) bool
GetBuildDebug returns the versionInfo.GetBld().GetDebug() if versionInfo.GetBld() is not nil, otherwise it returns true.
func GetBuildGoVersion ¶ added in v0.1.8
func GetBuildGoVersion(versionInfo *VersionInfo) string
GetBuildGoVersion returns the versionInfo.GetBld().GetGoVersion() if versionInfo.GetBld() is not nil, otherwise it returns an empty string.
func GetBuildMethod ¶ added in v0.1.8
func GetBuildMethod(versionInfo *VersionInfo) string
GetBuildMethod returns the versionInfo.GetBld().GetMethod() if versionInfo.GetBld() is not nil, otherwise it returns "not-set".
func GetBuildVersion ¶ added in v0.1.8
func GetBuildVersion(versionInfo *VersionInfo) string
GetBuildVersion returns the versionInfo.GetBld().GetVersion() if versionInfo.GetBld() is not nil, otherwise it returns an empty string.
func GetGitCommit ¶ added in v0.1.8
func GetGitCommit(versionInfo *VersionInfo) string
GetGitCommit returns the versionInfo.GetGit().GetCommit() if versionInfo.GetGit() is not nil, otherwise it returns an empty string.
func GetGitExactTag ¶ added in v0.1.8
func GetGitExactTag(versionInfo *VersionInfo) string
GetGitExactTag returns the versionInfo.GetGit().GetExactTag() if versionInfo.GetGit() is not nil, otherwise it returns an empty string.
func GetGitRepo ¶ added in v0.1.8
func GetGitRepo(versionInfo *VersionInfo) string
GetGitRepo returns the versionInfo.GetGit().GetRepo() if versionInfo.GetGit() is not nil, otherwise it returns an empty string.
func GetGitSlug ¶ added in v0.1.8
func GetGitSlug(versionInfo *VersionInfo) string
GetGitSlug returns the versionInfo.GetGit().GetSlug() if versionInfo.GetGit() is not nil, otherwise it returns an empty string.
func GetGitTag ¶ added in v0.1.8
func GetGitTag(versionInfo *VersionInfo) string
GetGitTag returns the versionInfo.GetGit().GetTag() if versionInfo.GetGit() is not nil, otherwise it returns an empty string.
func VersionHeaderMap ¶ added in v0.1.5
VersionHeaderMap returns the versionHeaderMap.
Types ¶
type BuildInfo ¶
type BuildInfo struct { XXX_raceDetectHookData protoimpl.RaceDetectHookData XXX_presence [1]uint32 // contains filtered or unexported fields }
func (*BuildInfo) ClearDebug ¶ added in v0.2.0
func (x *BuildInfo) ClearDebug()
func (*BuildInfo) ClearGoVersion ¶ added in v0.2.0
func (x *BuildInfo) ClearGoVersion()
func (*BuildInfo) ClearMethod ¶ added in v0.2.0
func (x *BuildInfo) ClearMethod()
func (*BuildInfo) ClearVersion ¶ added in v0.2.0
func (x *BuildInfo) ClearVersion()
func (*BuildInfo) GetDate ¶ added in v0.1.1
func (x *BuildInfo) GetDate() *timestamppb.Timestamp
func (*BuildInfo) GetGoVersion ¶ added in v0.1.1
func (*BuildInfo) GetVersion ¶ added in v0.1.1
func (*BuildInfo) HasGoVersion ¶ added in v0.2.0
func (*BuildInfo) HasVersion ¶ added in v0.2.0
func (*BuildInfo) ProtoMessage ¶ added in v0.1.1
func (*BuildInfo) ProtoMessage()
func (*BuildInfo) ProtoReflect ¶ added in v0.1.1
func (x *BuildInfo) ProtoReflect() protoreflect.Message
func (*BuildInfo) SetDate ¶ added in v0.2.0
func (x *BuildInfo) SetDate(v *timestamppb.Timestamp)
func (*BuildInfo) SetGoVersion ¶ added in v0.2.0
func (*BuildInfo) SetVersion ¶ added in v0.2.0
type BuildInfo_builder ¶ added in v0.2.0
type BuildInfo_builder struct { Debug *bool Method *string Date *timestamppb.Timestamp Version *string GoVersion *string // contains filtered or unexported fields }
func (BuildInfo_builder) Build ¶ added in v0.2.0
func (b0 BuildInfo_builder) Build() *BuildInfo
type GitInfo ¶
type GitInfo struct { XXX_raceDetectHookData protoimpl.RaceDetectHookData XXX_presence [1]uint32 // contains filtered or unexported fields }
func (*GitInfo) ClearCommit ¶ added in v0.2.0
func (x *GitInfo) ClearCommit()
func (*GitInfo) ClearExactTag ¶ added in v0.2.0
func (x *GitInfo) ClearExactTag()
func (*GitInfo) GetExactTag ¶ added in v0.1.1
func (*GitInfo) HasExactTag ¶ added in v0.2.0
func (*GitInfo) ProtoMessage ¶ added in v0.1.1
func (*GitInfo) ProtoMessage()
func (*GitInfo) ProtoReflect ¶ added in v0.1.1
func (x *GitInfo) ProtoReflect() protoreflect.Message
func (*GitInfo) SetExactTag ¶ added in v0.2.0
type GitInfo_builder ¶ added in v0.2.0
type GitInfo_builder struct { Repo *string Slug *string Commit *string Tag *string ExactTag *string // contains filtered or unexported fields }
func (GitInfo_builder) Build ¶ added in v0.2.0
func (b0 GitInfo_builder) Build() *GitInfo
type Time ¶
Time wraps time.Time to change the method of marshalling and unmarshalling Time.
func Parse ¶
Parse parses a formatted string and returns the time value it represents. See the documentation for the constant called Layout to see how to represent the format. The second argument must be parseable using the format string (layout) provided as the first argument.
The example for Time.Format demonstrates the working of the layout string in detail and is a good reference.
When parsing (only), the input may contain a fractional second field immediately after the seconds field, even if the layout does not signify its presence. In that case either a comma or a decimal point followed by a maximal series of digits is parsed as a fractional second. Fractional seconds are truncated to nanosecond precision.
Elements omitted from the layout are assumed to be zero or, when zero is impossible, one, so parsing "3:04pm" returns the time corresponding to Jan 1, year 0, 15:04:00 UTC (note that because the year is 0, this time is before the zero Time). Years must be in the range 0000..9999. The day of the week is checked for syntax but it is otherwise ignored.
For layouts specifying the two-digit year 06, a value NN >= 69 will be treated as 19NN and a value NN < 69 will be treated as 20NN.
The remainder of this comment describes the handling of time zones.
In the absence of a time zone indicator, Parse returns a time in UTC.
When parsing a time with a zone offset like -0700, if the offset corresponds to a time zone used by the current location (Local), then Parse uses that location and zone in the returned time. Otherwise it records the time as being in a fabricated location with time fixed at the given zone offset.
When parsing a time with a zone abbreviation like MST, if the zone abbreviation has a defined offset in the current location, then that offset is used. The zone abbreviation "UTC" is recognized as UTC regardless of location. If the zone abbreviation is unknown, Parse records the time as being in a fabricated location with the given zone abbreviation and a zero offset. This choice means that such a time can be parsed and reformatted with the same layout losslessly, but the exact instant used in the representation will differ by the actual zone offset. To avoid such problems, prefer time layouts that use a numeric zone offset, or use ParseInLocation.
func (Time) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface. The time is a quoted string in the RFC 3339 format with sub-second precision. If the timestamp cannot be represented as valid RFC 3339 (e.g., the year is out of range), then an error is reported.
type VersionInfo ¶
type VersionInfo struct {
// contains filtered or unexported fields
}
func (*VersionInfo) ClearBld ¶ added in v0.2.0
func (x *VersionInfo) ClearBld()
func (*VersionInfo) ClearGit ¶ added in v0.2.0
func (x *VersionInfo) ClearGit()
func (*VersionInfo) GetBld ¶ added in v0.2.0
func (x *VersionInfo) GetBld() *BuildInfo
func (*VersionInfo) GetBuild
deprecated
added in
v0.1.1
func (v *VersionInfo) GetBuild() *BuildInfo
GetBuild is the pre-protobuf editions compatibility.
Deprecated: GetBuild exists for historical compatibility and should not be used. To access the the BuildInfo use GetBld instead.
func (*VersionInfo) GetGit ¶ added in v0.1.1
func (x *VersionInfo) GetGit() *GitInfo
func (*VersionInfo) HasBld ¶ added in v0.2.0
func (x *VersionInfo) HasBld() bool
func (*VersionInfo) HasGit ¶ added in v0.2.0
func (x *VersionInfo) HasGit() bool
func (*VersionInfo) JSON ¶ added in v0.1.1
func (v *VersionInfo) JSON() ([]byte, error)
JSON returns the VersionInfo formatted into JSON format.
func (*VersionInfo) ProtoMessage ¶ added in v0.1.1
func (*VersionInfo) ProtoMessage()
func (*VersionInfo) ProtoReflect ¶ added in v0.1.1
func (x *VersionInfo) ProtoReflect() protoreflect.Message
func (*VersionInfo) Reset ¶ added in v0.1.1
func (x *VersionInfo) Reset()
func (*VersionInfo) SetBld ¶ added in v0.2.0
func (x *VersionInfo) SetBld(v *BuildInfo)
func (*VersionInfo) SetGit ¶ added in v0.2.0
func (x *VersionInfo) SetGit(v *GitInfo)
func (*VersionInfo) SlogAttr ¶ added in v0.1.7
func (v *VersionInfo) SlogAttr(name string) slog.Attr
SlogAttr returns a slog.Group consisting of the relevant parts of a VersionInfo to add to a slog message for starting an application.
func (*VersionInfo) String ¶ added in v0.1.1
func (x *VersionInfo) String() string
func (*VersionInfo) VersionString ¶ added in v0.1.3
func (v *VersionInfo) VersionString() string
VersionString returns the version as a string, compatible with display in a cli tool.
type VersionInfo_builder ¶ added in v0.2.0
type VersionInfo_builder struct { Bld *BuildInfo Git *GitInfo // contains filtered or unexported fields }
func (VersionInfo_builder) Build ¶ added in v0.2.0
func (b0 VersionInfo_builder) Build() *VersionInfo