cmd/tools/gen-accessors.go
func (t *templateData) addMapType(x *ast.MapType, receiverType, fieldName string) {
	// TODO: should we make this dynamic? Could handle more cases than string only
	var keyType string
	switch key := x.Key.(type) {
	case *ast.Ident:
		keyType = key.String()
	default:
		logf("addMapType: type %q, field %q: unknown key type: %T %+v; skipping.", receiverType, fieldName, key, key)
		return
	}

	var valueType string
	switch value := x.Value.(type) {
	case *ast.Ident:
		valueType = value.String()
	default:
		logf("addMapType: type %q, field %q: unknown value type: %T %+v; skipping.", receiverType, fieldName, value, value)
		return
	}

	fieldType := fmt.Sprintf("map[%v]%v", keyType, valueType)
	zeroValue := fmt.Sprintf("map[%v]%v{}", keyType, valueType)
	t.Accessors = append(t.Accessors, newAccessor(receiverType, fieldName, fieldType, zeroValue))
}
func (t *templateData) addMapType(x *ast.MapType, receiverType, fieldName string) {
	// TODO: should we make this dynamic? Could handle more cases than string only
	var keyType string
	switch key := x.Key.(type) {
	case *ast.Ident:
		keyType = key.String()
	default:
		logf("addMapType: type %q, field %q: unknown key type: %T %+v; skipping.", receiverType, fieldName, key, key)
		return
	}

	var valueType string
	switch value := x.Value.(type) {
	case *ast.Ident:
		valueType = value.String()
	default:
		logf("addMapType: type %q, field %q: unknown value type: %T %+v; skipping.", receiverType, fieldName, value, value)
		return
	}

	fieldType := fmt.Sprintf("map[%v]%v", keyType, valueType)
	zeroValue := fmt.Sprintf("map[%v]%v{}", keyType, valueType)
	t.Accessors = append(t.Accessors, newAccessor(receiverType, fieldName, fieldType, zeroValue))
}
// addMypType adds an accessor for a map type, for a given receiver and field