Created
November 24, 2023 11:53
-
-
Save yumed15/5f5ad3459d3903d1cb97fe024ee19321 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var once sync.Once | |
var cleanupDone bool | |
func cleanupResources() { | |
// Perform resource cleanup here. | |
cleanupDone = true | |
} | |
func teardown() { | |
once.Do(cleanupResources) | |
// Other teardown logic here. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment