featurebase/version.go
Maxton Huff dd8d6ebfb1 Respond to code review feedback
change logic in version.go so that the trial related messages only appear on trial versions of molecula
convert Command methods in trial.go to functions and  pass a loggerLogger variable instead since that was the only piece of Command being used
add a function named expireAfter which seperately runs similar functionality to what was previously in daily check with chnages directed at stopping users from changing their internal clock date
change variable names and placement to be more readable and organized
2021-02-11 11:01:16 -06:00

65 lines
1.7 KiB
Go

// Copyright 2017 Pilosa Corp.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package pilosa
import (
"runtime"
"time"
)
var Version string
var Commit string
var Variant string
var BuildTime string
var LatticeCommit string
var GoVersion string = runtime.Version()
var TrialDeadline string
func VersionInfo() string {
var prefix string
if Variant != "" {
prefix = Variant + " "
}
var suffix string
if Version != "" {
suffix = " " + Version
} else {
suffix = " v2.x"
}
buildTime := BuildTime
if buildTime != "" {
// Normalize the build time into a friendly format in the user's time zone.
if t, err := time.Parse("2006-01-02T15:04:05+0000", BuildTime); err == nil {
buildTime = t.Local().Format("Jan _2 2006 3:04PM")
}
}
switch {
case Commit != "" && buildTime != "":
suffix += " (" + buildTime + ", " + Commit + ")"
case Commit != "":
suffix += " (" + Commit + ")"
case buildTime != "":
suffix += " (" + buildTime + ")"
}
suffix += " " + GoVersion
if TrialDeadline != "" {
suffix += " limited time trial ends at: " + TrialDeadline
}
return prefix + "Pilosa" + suffix
}
func LatticeVersionInfo() string {
return "g" + LatticeCommit
}