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()