Your syntax is wrong. I think you mean this:
var someInterfaceValue interface{}
// do something that puts a value in above variable
switch someInterfaceValue {
case true:
// do something
default:
// do something else
}
On Saturday, 21 April 2018 16:30:22 UTC+3, [email protected] wrote:
>
> var someInterfaceValue interface{}
> switch {
> case someInterfaceValue: // proposal: compile error: non-bool used as
> condition
> case someInterfaceValue == true: // OK
> }
>
> Sometimes carefulness is just not enough.
> One may type a wrong variable as the case condition, or a incomplete
> condition.
> Why is this special? Because it's commonly used.
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.