You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: mqtt.go
    path of file: ./repos/baetyl/plugin/mqttlink
    
    the code of the file until where you have to start completion: // Package mqttlink 端云链接 mqtt 实现
package mqttlink

imp
    
func (mt *mqttLink) Send(msg *specV1.Message) error {
	if msg.Metadata == nil {
		msg.Metadata = make(map[string]string)
	}
	msg.Metadata["namespace"] = mt.ns
	msg.Metadata["name"] = mt.name
	pld, err := json.Marshal(msg)
	if err != nil {
		return errors.Trace(err)
	}
	var topic string
	switch msg.Kind {
	case specV1.MessageReport, specV1.MessageCMD, specV1.MessageData, specV1.MessageDeviceReport, specV1.MessageDeviceLifecycleReport:
		topic = mt.cfg.MqttLink.Report.Topic
	case specV1.MessageDesire, specV1.MessageDeviceDesire, specV1.MessageMultipleDeviceDesire:
		topic = mt.cfg.MqttLink.Desire.Topic
	default:
		return errors.New("invalid msg kind")
	}
	return mt.cli.Publish(mqtt.QOS(mt.cfg.MqttLink.Report.QOS), topic, pld, 0, false, false)
}