go type string的用法
package main
import "fmt"
type DD string
const (
C DD = "dd"
D DD = "cc"
)
func (DD) JoinString() DD {
return C + D
}
func main() {
C.JoinString()
D.JoinString()
var c DD
c.JoinString()
var m = make(map[DD]interface{})
m[C] = `netstat -r`
m[D] = `ifconfig`
if t, ok := m[C]; !ok {
panic(t)
} else {
fmt.Println(t)
}
}