/* * BSD 3-Clause License * Copyright (c) 2024, NetFireâ„¢ * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors * may be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package version import ( `time` ) // BuildInfo contains nativized version information. type BuildInfo struct { // RepoURI is where the source is from. RepoURI string // GoVersion is the version of the Go compiler used. GoVersion string // TagVersion is the most recent tag name on the current branch. TagVersion string // PostTagCommits is the number of commits after BuildInfo.TagVersion's commit on the current branch. PostTagCommits uint // CommitHash is the full commit hash. CommitHash string // CommitId is the "short" version of BuildInfo.CommitHash. CommitId string // BuildUser is the user the program was compiled under. BuildUser string // If compiled under sudo, BuildInfo.RealBuildUser is the user that called sudo. RealBuildUser string // BuildTime is the time and date of the program's build time. BuildTime time.Time // BuildHost is the host the binary was compiled on. BuildHost string // Dirty specifies if the source was "dirty" (uncommitted/unstaged etc. files) at the time of compilation. Dirty bool // SourceControl is the source control version used. Only relevant if not a "clean" build or untagged. SourceControl string // Major is the major version, expressed as an uint per spec. Major uint // Minor is the minor version, expressed as an uint per spec. Minor uint // Patch is the patch version, expressed as an uint per spec. Patch uint // Pre Pre string // Build Build string // isDefined specifies if this version was retrieved from the built-in values. isDefined bool // raw is the raw variable values. raw map[string]string /* verSplit is a slice of []string{Major, Minor, Patch, PreRelease, Build} If using an actual point release, PreRelease and Build are probably blank. */ verSplit [5]string // short is the condensed version of verSplit. short string }