map_test.go 288 B

123456789101112131415161718
  1. package test
  2. func init() {
  3. marshalCases = append(marshalCases,
  4. map[string]interface{}{"abc": 1},
  5. map[string]MyInterface{"hello": MyString("world")},
  6. )
  7. }
  8. type MyInterface interface {
  9. Hello() string
  10. }
  11. type MyString string
  12. func (ms MyString) Hello() string {
  13. return string(ms)
  14. }