MCPcopy Create free account
hub / github.com/coder/envbuilder / Version

Function Version

buildinfo/version.go:50–71  ·  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

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

Callers 2

runFunction · 0.92
RunCacheProbeFunction · 0.92

Calls 1

revisionFunction · 0.85

Tested by

no test coverage detected