diff --git a/doc/rest_docs.go b/doc/rest_docs.go index c33acc2b..7b9a2630 100644 --- a/doc/rest_docs.go +++ b/doc/rest_docs.go @@ -21,6 +21,7 @@ import ( "os" "path/filepath" "sort" + "strconv" "strings" "time" @@ -123,7 +124,14 @@ func GenReSTCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string, str buf.WriteString("\n") } if !cmd.DisableAutoGenTag { - buf.WriteString("*Auto generated by spf13/cobra on " + time.Now().Format("2-Jan-2006") + "*\n") + now := time.Now() + if epoch := os.Getenv("SOURCE_DATE_EPOCH"); epoch != "" { + unixEpoch, err := strconv.ParseInt(epoch, 10, 64) + if err == nil { + now = time.Unix(unixEpoch, 0) + } + } + buf.WriteString("*Auto generated by spf13/cobra on " + now.Format("2-Jan-2006") + "*\n") } _, err := buf.WriteTo(w) return err