Skip to content

Instantly share code, notes, and snippets.

@shazadbrohi
Created February 13, 2021 02:31
Show Gist options
  • Save shazadbrohi/1a6a3881f4ff5063da9d3627dc945ffb to your computer and use it in GitHub Desktop.
Save shazadbrohi/1a6a3881f4ff5063da9d3627dc945ffb to your computer and use it in GitHub Desktop.
func worker(pid int, wg *sync.WaitGroup, file *os.File){
defer wg.Done()
fmt.Printf("Worker Process %d writing to file...\n", pid)
content := fmt.Sprintf("Worker %d wrote to the file\n", pid)
file.WriteString(content)
file.Sync()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment