I am trying to write a Shadowsocks GUI app with go, and this package is added as the dependency. But for now, public API to start and stop an instance is not supported yet. It simply starts some goroutines and terminates the program on receiving interrupt signal. I try to refactor them to support cancellation, so that I can start and stop and restart Shadowsocks instance in my app. For example, refactor from:
I am trying to write a Shadowsocks GUI app with go, and this package is added as the dependency. But for now, public API to start and stop an instance is not supported yet. It simply starts some goroutines and terminates the program on receiving interrupt signal. I try to refactor them to support cancellation, so that I can start and stop and restart Shadowsocks instance in my app. For example, refactor from:
to:
But I am not familiar with go, and is not sure whether this is the proper solution. Could you give me some advice?