func main() {
//var s string ="tess"
//var ss *string = &s
var i interface{} = &ssss{"test"}
fmt.Println((i))
i=100
fmt.Println((i))
fmt.Println((*i))
# command-line-arguments
.\test17.go:23:14: invalid indirect of i (type interface {})
func Itest(out interface{}) string {
var res string
newValue, _ := json.Marshal(out)
res = string(newValue)
return res
}
func main() {
var ss string ="fdsfsdfsd"
fmt.Println(Itest(&ss))
}
"fdsfsdfsd"
进程 已完成,退出代码为 0
func main() {
var ss string ="fdsfsdfsd"
fmt.Println(Itest(&ss))
}
var iii interface{}
fmt.Printf("%T\n",iii)
//<nil>
interface {} 默认类型<nil>
使用 https://github.com/duke-git/lancet/blob/main/README_zh-CN.md