Go入门笔记-16 type func自定义函数
作者:互联网
1、测试代码
package main import "fmt" type Get func(serviceName string) interface{} func get1(serviceName string) interface{} { return serviceName } var a = func(get Get, serviceName string) interface{} { return get(serviceName) } func main() { fmt.Println(a(get1, "aaa")) }
2、输出结果
aaa
标签:string,自定义,16,fmt,Get,serviceName,func,interface 来源: https://www.cnblogs.com/zhaogaojian/p/15136834.html