I'm writing a package in go that creates a connection to Kafka.
I create the connection in the init()
function in the main file in the package. After the program that uses the package stops, I want to call a function called Close()
Is there a way to enforce it in the package level, instead of giving this responsibility to the user?
Assume that the connection should be available throughout the run of the user's program, I don't want to initialize it every time.