how to if-else in golang
if
if-elseif-else
check a string is empty
if condition {
//do something
}
if-elseif condition {
//do something
} else {
//do something
}
if-elseif-else
if condition {
//do something
} else if condition2 {
//do something
} else {
//do something
}
check a string is empty
if str == "" { ... }
if len(str) == 0 {...}
check system
if runtime.GOOS == "windows" {
// do something
} else { //unix-like
// do something
}