Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/local-app/pkg/constants/constants.go
2500 views
1
// Copyright (c) 2023 Gitpod GmbH. All rights reserved.
2
// Licensed under the GNU Affero General Public License (AGPL).
3
// See License.AGPL.txt in the project root for license information.
4
5
package constants
6
7
import (
8
_ "embed"
9
"fmt"
10
"strconv"
11
"strings"
12
"time"
13
14
"github.com/Masterminds/semver/v3"
15
version "github.com/gitpod-io/local-app"
16
)
17
18
var (
19
// Version is fed from the main CLI version
20
Version = semver.MustParse(strings.TrimSpace(version.Version))
21
22
// GitCommit - set during build
23
GitCommit = "unknown"
24
25
// BuildTime - set during build
26
BuildTime = "unknown"
27
)
28
29
// MustParseBuildTime parses the build time or panics
30
func MustParseBuildTime() time.Time {
31
if BuildTime == "unknown" {
32
return time.Time{}
33
}
34
35
sec, err := strconv.ParseInt(BuildTime, 10, 64)
36
if err != nil {
37
panic(fmt.Sprintf("cannot parse build time: %v", err))
38
}
39
return time.Unix(sec, 0)
40
}
41
42