-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathversion.go
55 lines (46 loc) · 1.23 KB
/
version.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2023-present Datadog, Inc.
package version
import "runtime/debug"
const (
// tag specifies the current release tag. It needs to be manually updated.
tag = "v1.1.0-rc.1"
devSuffix = "+devel"
)
var (
buildInfoVersion string
buildInfoIsDev bool
)
// Tag returns the version tag for this orchestrion build.
func Tag() string {
if buildInfoVersion != "" {
return buildInfoVersion
}
return tag
}
// TagInfo returns the static tag and a boolean determining whether this is a
// development build.
func TagInfo() (staticTag string, isDev bool) {
return tag, buildInfoIsDev
}
func init() {
bi, ok := debug.ReadBuildInfo()
if !ok {
return
}
version := bi.Main.Version
if bi.Main.Replace != nil {
version = bi.Main.Replace.Version
}
switch version {
case "", "(devel)":
// In tests, the [debug.BuildInfo.Main] has an empty version; and in builds
// of the command, it has a "(devel)" version.
buildInfoVersion = tag + devSuffix
buildInfoIsDev = true
default:
buildInfoVersion = bi.Main.Version
}
}