I'm making a program in Golang using the flag package, and I'm trying to check if more than one flag in a specific list is true. Right now, this is my solution:
List := 0
if *md5flag {
List++
}
if *sha1flag {
List++
}
if *sha256flag {
List++
}
if *sha512flag {
List++
}
if List > 1 {
// Do stuff
os.Exit(1)
}
Would there be an easier way to do this, and by using a single if statement?