How to highlight the message at the end of the program?

Let's say eating such a simple code.

func main() {

 defer func() {



Zapuskaetsa he contenere. If happen error in Run both messages are highlighted and the start and stop, and if I stanovova container, the messages will not stop.

How to make so that stanovka of kontenera correctly completing the program? Well, or the message is loirevalley still.
April 19th 20 at 12:06
1 answer
April 19th 20 at 12:08
For this you need to catch signals

At the foot of the container, the program is sent SIGINT. You need to catch and properly close the program.
defer is not used to this, and to guarantee to execute some code upon return from the function or the panic.

Find more questions by tags DockerGo