mirror of
https://github.com/danog/gojekyll.git
synced 2024-11-27 02:24:39 +01:00
29 lines
472 B
Go
29 lines
472 B
Go
|
package version
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"os"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
// "make" initializes Version to the git commit hash, and BuildDate.
|
||
|
var (
|
||
|
Version string
|
||
|
BuildDate string
|
||
|
BuildTime time.Time
|
||
|
)
|
||
|
|
||
|
func init() {
|
||
|
if Version == "" {
|
||
|
Version = "develop"
|
||
|
}
|
||
|
if BuildDate != "" {
|
||
|
bd, err := time.Parse("2006-01-02T15:04:05-0700", BuildDate)
|
||
|
if err != nil {
|
||
|
fmt.Fprintln(os.Stderr, "invalid BuildDate", BuildDate) // nolint: gas
|
||
|
} else {
|
||
|
BuildTime = bd.In(time.UTC)
|
||
|
}
|
||
|
}
|
||
|
}
|