feat(server): Use hash of Nixery source as version

Uses a hash of Nixery's sources as the version displayed when Nixery
launches or logs an error. This makes it possible to distinguish
between errors logged from different versions.

The source hashes should be reproducible between different checkouts
of the same source tree.
This commit is contained in:
Vincent Ambo 2019-10-05 22:33:41 +01:00 committed by Vincent Ambo
parent 95abb1bcde
commit 6912658c72
4 changed files with 48 additions and 11 deletions

View file

@ -27,7 +27,6 @@ type reportLocation struct {
var nixeryContext = serviceContext{
Service: "nixery",
Version: "TODO(tazjin)", // angry?
}
// isError determines whether an entry should be logged as an error
@ -63,6 +62,7 @@ func (f stackdriverFormatter) Format(e *log.Entry) ([]byte, error) {
}
func init() {
nixeryContext.Version = version
log.SetReportCaller(true)
log.SetFormatter(stackdriverFormatter{})
}