From 7acd2fac7a16c59e82cc651a99535dc8b525b3b9 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Mon, 24 Jul 2023 16:21:34 +1000 Subject: [PATCH] add version info in output --- main.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main.go b/main.go index 5638882..be10d0d 100644 --- a/main.go +++ b/main.go @@ -21,8 +21,13 @@ type Output struct { CertLoaded bool Results string Groups string + Version string } +// For build numbers, from https://blog.kowalczyk.info/article/vEja/embedding-build-number-in-go-executable.html +var sha1ver string // sha1 revision used to build the program +var buildTime string // when the executable was built + func GetFilePath(path string) string { // Check for empty filename if len(path) == 0 { @@ -121,6 +126,8 @@ func GetGroupsOfUser(username string, baseDN string, conn *ldap.Conn) ([]string, return groups, nil } +// Some good ideas at https://gist.github.com/tboerger/4840e1b5464fc26fbb165b168be23345 + func main() { var output Output @@ -133,6 +140,7 @@ func main() { flag.Parse() output.Server = *server + output.Version = fmt.Sprintf("Built on %s from sha1 %s\n", buildTime, sha1ver) // Get a copy of the system defined CA's system, err := x509.SystemCertPool()