@@ -26,15 +26,27 @@ var (
2626 defaultVersionString = "0.3.7-alpha.preview"
2727 versionString = ""
2828 commit = ""
29- buildDate = time. Time {}
29+ buildDate = rfc3339Time {}
3030)
3131
32+ type rfc3339Time struct {
33+ time.Time
34+ }
35+
36+ func (r rfc3339Time ) format () string {
37+ return r .Time .Format (time .RFC3339 )
38+ }
39+
40+ func (r rfc3339Time ) MarshalJSON () ([]byte , error ) {
41+ return []byte (`"` + r .format () + `"` ), nil
42+ }
43+
3244// Info FIXMEDOC
3345type Info struct {
34- Application string `json:"Application"`
35- VersionString string `json:"VersionString"`
36- Commit string `json:"Commit"`
37- BuildDate time. Time `json:"BuildDate"`
46+ Application string `json:"Application"`
47+ VersionString string `json:"VersionString"`
48+ Commit string `json:"Commit"`
49+ BuildDate rfc3339Time `json:"BuildDate"`
3850}
3951
4052// NewInfo FIXMEDOC
@@ -48,13 +60,13 @@ func NewInfo(application string) *Info {
4860}
4961
5062func (i * Info ) String () string {
51- return fmt .Sprintf ("%s Version: %s Commit: %s BuildDate: %s" , i .Application , i .VersionString , i .Commit , i .BuildDate )
63+ return fmt .Sprintf ("%s Version: %s Commit: %s BuildDate: %s" , i .Application , i .VersionString , i .Commit , i .BuildDate . format () )
5264}
5365
5466//nolint:gochecknoinits
5567func init () {
5668 if versionString == "" {
5769 versionString = defaultVersionString
5870 }
59- buildDate = time .Now ().UTC ()
71+ buildDate = rfc3339Time { time .Now ().UTC ()}
6072}
0 commit comments