1 // Copyright (c) 2019 Cisco and/or its affiliates.
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at:
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
24 // Following variables should normally be updated via `-ldflags "-X ..."`.
25 // However, the version string is hard-coded to ensure it is always included
26 // even with bare go build/install.
29 version = "v0.4.0-dev"
40 buildstampInt64, _ := strconv.ParseInt(buildStamp, 10, 64)
41 if buildstampInt64 == 0 {
42 buildstampInt64 = time.Now().Unix()
44 buildDate = time.Unix(buildstampInt64, 0)
47 func Version() string {
52 return fmt.Sprintf(`%s %s`, name, version)
55 func Verbose() string {
56 return fmt.Sprintf(`%s
62 Go runtime: %s (%s/%s)`,
64 version, branch, commit,
65 buildUser, buildHost, buildDate.Format(time.UnixDate),
66 runtime.Version(), runtime.GOOS, runtime.GOARCH,