crawler_go/crawler_map_convert_test.go
jackdaw@loafle.com 8ecf62ec30 .
2017-04-10 18:03:31 +09:00

20 lines
264 B
Go

package crawler
import (
"fmt"
"testing"
)
func TestInterfaceValueToTypeCast(t *testing.T) {
m := make(map[string]interface{})
m["a"] = "1"
m["b"] = 2
m["c"] = false
fmt.Println(m["a"].(string))
fmt.Println(m["b"].(int))
fmt.Println(m["c"].(bool))
}