Skip to content

Instantly share code, notes, and snippets.

@bradhe
Created May 10, 2013 05:52
Show Gist options
  • Select an option

  • Save bradhe/5552633 to your computer and use it in GitHub Desktop.

Select an option

Save bradhe/5552633 to your computer and use it in GitHub Desktop.
$ go build
./test.go:10: cannot type switch on non-interface value slice (type []string)
package main
import (
"fmt"
)
func main() {
slice := make([]string, 0)
switch slice.(type) {
case []string: {
fmt.Println("It's a slice!")
}
case map[string] interface{}: {
fmt.Println("It's a map!")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment