作者热门文章
- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
这个有效:
type T string
var t T = "hello"
http://play.golang.org/p/275jQ4ixvp
但这失败了 cannot use s (type string) as type T in assignment
type T string
s := "world"
var t T = s
http://play.golang.org/p/vm3mC5ltcE
我怎样才能使第二种情况起作用?
最佳答案
关于go - 如何在 go 中初始化具有底层字符串值的类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26891629/
我是一名优秀的程序员,十分优秀!