1
0
mirror of https://github.com/danog/gojekyll.git synced 2024-12-12 12:27:22 +01:00
gojekyll/commands/version.go

29 lines
471 B
Go
Raw Normal View History

2017-07-19 22:06:43 +02:00
package commands
2017-07-05 17:18:46 +02:00
2017-07-18 15:34:54 +02:00
import (
"fmt"
"os"
"time"
)
// Make initializes Version to the git commit hash, and BuildDate.
var (
Version string
BuildDate string
BuildTime time.Time
)
2017-07-05 17:18:46 +02:00
func init() {
if Version == "" {
Version = "develop"
}
2017-07-18 15:34:54 +02:00
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)
}
}
2017-07-05 17:18:46 +02:00
}