Description: Add support for SOURCE_DATE_EPOCH for TestMan in help_test.go
 Marina Moore added SOURCE_DATE_EPOCH to man.go for reproducible builds,
 and Jelmer Vernooĳ applied the the same change to help_test.go too; see
 https://salsa.debian.org/go-team/packages/golang-go-flags/-/merge_requests/1
 .
 This patch, borrowed from the golang-go-flags (jessevdk) package,
 fixes FTBFS #997553 in golang-github-itchyny-go-flags
Author: Marina Moore <mmoore32@calpoly.edu>, Jelmer Vernooĳ <jelmer@debian.org>
Origin: upstream
Bug: https://github.com/jessevdk/go-flags/pull/285
Bug-Debian: https://bugs.debian.org/997553
Forwarded: https://github.com/jessevdk/go-flags/pull/376
Reviewed-by: Anthony Fok <foka@debian.org>
Last-Update: 2021-11-29
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/help_test.go
+++ b/help_test.go
@@ -7,6 +7,7 @@
 	"fmt"
 	"os"
 	"runtime"
+	"strconv"
 	"strings"
 	"testing"
 	"time"
@@ -220,6 +221,14 @@
 	got := buf.String()
 
 	tt := time.Now()
+	source_date_epoch := os.Getenv("SOURCE_DATE_EPOCH")
+	if source_date_epoch != "" {
+		sde, err := strconv.ParseInt(source_date_epoch, 10, 64)
+		if err != nil {
+			panic(fmt.Sprintf("Invalid SOURCE_DATE_EPOCH: %s", err))
+		}
+		tt = time.Unix(sde, 0)
+	}
 
 	var envDefaultName string
 
