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 here

default:
   // 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 
<https://golang.org/pkg/runtime/internal/sys/>.GOOS 
<https://golang.org/pkg/runtime/internal/sys/#GOOS>)...
I'd rather be safe than sorry.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to