Files
kubesphere/vendor/github.com/open-policy-agent/opa/version/version_go1.18.go
hongzhouzi ef03b1e3df Upgrade dependent version: github.com/open-policy-agent/opa (#5315)
Upgrade dependent version: github.com/open-policy-agent/opa v0.18.0 -> v0.45.0

Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io>

Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io>
2022-10-31 10:58:55 +08:00

34 lines
559 B
Go

// Copyright 2022 The OPA Authors. All rights reserved.
// Use of this source code is governed by an Apache2
// license that can be found in the LICENSE file.
//go:build go1.18
// +build go1.18
package version
import (
"runtime/debug"
)
func init() {
bi, ok := debug.ReadBuildInfo()
if !ok {
return
}
dirty := false
for _, s := range bi.Settings {
switch s.Key {
case "vcs.time":
Timestamp = s.Value
case "vcs.revision":
Vcs = s.Value
case "vcs.modified":
dirty = s.Value == "true"
}
}
if dirty {
Vcs = Vcs + "-dirty"
}
}