mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 00:43:20 +01:00
37 lines
715 B
Go
37 lines
715 B
Go
package version
|
|
|
|
import (
|
|
"fmt"
|
|
"runtime"
|
|
)
|
|
|
|
const valueNotProvided = "[not provided]"
|
|
|
|
var version = valueNotProvided
|
|
var gitCommit = valueNotProvided
|
|
var gitTreeState = valueNotProvided
|
|
var buildDate = valueNotProvided
|
|
var platform = fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH)
|
|
|
|
type Version struct {
|
|
Version string
|
|
GitCommit string
|
|
GitTreeState string
|
|
BuildDate string
|
|
GoVersion string
|
|
Compiler string
|
|
Platform string
|
|
}
|
|
|
|
func FromBuild() Version {
|
|
return Version{
|
|
Version: version,
|
|
GitCommit: gitCommit,
|
|
GitTreeState: gitTreeState,
|
|
BuildDate: buildDate,
|
|
GoVersion: runtime.Version(),
|
|
Compiler: runtime.Compiler,
|
|
Platform: platform,
|
|
}
|
|
}
|