I declare a string flag with a default value like this:
animalFlag := flag.String("typeOfAnimal", "Cat", "Type of animal")
I want to force that user could only give a specific string (like "Dog"
, "Lion"
) and not some random string like "Rose"
.
How do I enforce this in Go?