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: kafka.go
    path of file: ./repos/easegress/pkg/filters/kafkabackend
    
    the code of the file until where you have to start completion: /*
 * Copyright (c) 2017, The Easegress Authors
 * All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in c
    
func (k *Kafka) Init() {
	spec := k.spec
	k.done = make(chan struct{})
	k.setHeader()

	config := sarama.NewConfig()
	config.ClientID = spec.Name()
	config.Version = sarama.V1_0_0_0
	if spec.Sync {
		config.Producer.Return.Successes = true
		producer, err := sarama.NewSyncProducer(k.spec.Backend, config)
		if err != nil {
			panic(fmt.Errorf("start sarama sync producer with address %v failed: %v", spec.Backend, err))
		}
		k.syncProcuder = producer
	} else {
		producer, err := sarama.NewAsyncProducer(k.spec.Backend, config)
		if err != nil {
			panic(fmt.Errorf("start sarama async producer with address %v failed: %v", k.spec.Backend, err))
		}

		k.asyncProducer = producer
		go k.checkProduceError()
	}
}