<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>programming on ramblings of 1lann</title><link>https://blog.chuie.io/tags/programming/</link><description>Recent content in programming on ramblings of 1lann</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><copyright>blog.chuie.io</copyright><lastBuildDate>Sat, 14 Aug 2021 00:00:00 +0000</lastBuildDate><atom:link href="https://blog.chuie.io/tags/programming/index.xml" rel="self" type="application/rss+xml"/><item><title>The underutilized usefulness of sync.Once</title><link>https://blog.chuie.io/posts/synconce/</link><pubDate>Sat, 14 Aug 2021 00:00:00 +0000</pubDate><guid>https://blog.chuie.io/posts/synconce/</guid><description>If you've ever used goroutines in Go, you've probably come across a couple of concurrency primitives. Probably sync.Mutex, sync.WaitGroup and maybe sync.Map, but have you heard of sync.Once?
Maybe you have, but what does the godoc say about it?
Once is an object that will perform exactly one action.
Sounds simple enough, what's so useful about it then?
Well for some reason this isn't particularly well documented, but a sync.</description></item></channel></rss>