Golang语法探索-声明结构体
1 匿名声明。 tests := []struct { key, val string ok bool }{ {"имя", "v", false}, // key must be ascii {"name", "валю", true}, // value may be non-ascii {"", "v", false}, // key must be non-empty {"k", "", true}, // value may be empty } 这种模式常用。定义一张常量表,表的格式就这个地方用一下就可以。 2 集体声明: type ( // Echo is the top-level framework instance. Echo struct { server engine...阅读全文