github.com/google/syzkaller@v0.0.0-20251211124644-a066d2bc4b02/prog/meta.go (about) 1 // Copyright 2020 syzkaller project authors. All rights reserved. 2 // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. 3 4 package prog 5 6 import ( 7 "strings" 8 "time" 9 ) 10 11 const defaultGitRevision = "unknown" 12 13 var ( 14 GitRevision = defaultGitRevision // emitted by Makefile, may contain + at the end 15 GitRevisionBase string // without + 16 gitRevisionDate string // emitted by Makefile 17 GitRevisionDate time.Time // parsed from gitRevisionDate 18 ) 19 20 func GitRevisionKnown() bool { 21 return GitRevision != defaultGitRevision 22 } 23 24 func init() { 25 GitRevisionBase = strings.ReplaceAll(GitRevision, "+", "") 26 if gitRevisionDate != "" { 27 var err error 28 if GitRevisionDate, err = time.Parse("20060102-150405", gitRevisionDate); err != nil { 29 panic(err) 30 } 31 } 32 }