This may be a completely stupid or trivial question; however...
I currently use this on some old code I'm working on and trying to clean things up:
switch os := strings.ToLower(runtime.GOOS); os {
case "windows":
// do windows stuff here
case "linux":
// do linux stuff heredefault:
// do default stuff here
}
I hate to import the entire strings package just to ensure that switch will work. Does anybody know if runtime.GOOS will always return a lowercase value so I don't have to import the strings package just for this single check? All I can find is that GOOS returns (
sys.GOOS)...
I'd rather be safe than sorry.