MCPcopy Index your code
hub / github.com/coder/coder / Version

Function Version

buildinfo/buildinfo.go:49–70  ·  view source on GitHub ↗

Version returns the semantic version of the build. Use golang.org/x/mod/semver to compare versions.

()

Source from the content-addressed store, hash-verified

47// Version returns the semantic version of the build.
48// Use golang.org/x/mod/semver to compare versions.
49func Version() string {
50 readVersion.Do(func() {
51 revision, valid := Revision()
52 if valid {
53 revision = "+" + revision[:7]
54 }
55 if tag == "" {
56 // This occurs when the tag hasn't been injected,
57 // like when using "go run".
58 // <version>-<pre-release>+<revision>
59 version = fmt.Sprintf("%s-%s%s", noVersion, develPreRelease, revision)
60 return
61 }
62 version = "v" + tag
63 // The tag must be prefixed with "v" otherwise the
64 // semver library will return an empty string.
65 if semver.Build(version) == "" {
66 version += revision
67 }
68 })
69 return version
70}
71
72// VersionsMatch compares the two versions. It assumes the versions match if
73// the major and the minor versions are equivalent. Patch versions are

Callers 15

NewFunction · 0.92
TestBuildInfoFunction · 0.92
updateCheckMethod · 0.92
mockTelemetryServerFunction · 0.92
reportSyncMethod · 0.92
deploymentMethod · 0.92
RunFunction · 0.92
UserAgentFunction · 0.92
TestUserAgentFunction · 0.92
connectOneFunction · 0.92

Calls 3

RevisionFunction · 0.85
DoMethod · 0.65
BuildMethod · 0.65

Tested by 15

TestBuildInfoFunction · 0.74
mockTelemetryServerFunction · 0.74
TestUserAgentFunction · 0.74
setupFunction · 0.74
TestBuildInfoFunction · 0.74
mockTelemetryServerFunction · 0.74
TestRootFunction · 0.74