20 lines
264 B
Go
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))
|
|
}
|