|
You are here |
blog.carlana.net | ||
| | | | |
blog.gopheracademy.com
|
|
| | | | | Advanced Encoding and Decoding Techniques Go's standard library comes packed with some great encoding and decoding packages covering a wide array of encoding schemes. Everything from CSV, XML, JSON, and even gob - a Go specific encoding format - is covered, and all of these packages are incredibly easy to get started with. | |
| | | | |
hjr265.me
|
|
| | | | | Go provides sync.Mutex as its implementation of a mutual exclusion lock. However, it is not the only synchronization construct that is a part of the standard library. This blog post will look at four synchronization constructs that we can use instead of a sync.Mutex. Counter You may often see code using a sync.Mutex to synchronize access to a counter variable from multiple goroutines. Like this: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 var ( n int m sync. | |
| | | | |
konradreiche.com
|
|
| | | | | Writing a generic protobuf writer in Go is straightforward. We simply use proto.Marshal with the protobuf message because proto.Marshal expects the proto.Message interface, which all generated protobuf messages implement. However, when it comes to reading serialized protobuf data into a specific Go type, historically, we had to specify the type explicitly: var post pb.Post if err := proto.Unmarshal(b, &post); err != nil { return nil, err } This approach is clear and explicit: what you see is what you get. But what if you need a more generic solution? You might encounter a scenario similar to mine: a cache abstraction designed to handle different kinds of protobuf messages generically. My initial attempt looked like this: | |
| | | | |
brockallen.com
|
|
| | | I've been doing a bit of research into how ASP.NET Identity v2 is implementing its new features, specifically two factor authentication. I was curious, of course, because I've had the opportunity to implement the same feature in MembershipReboot. It's interesting to see the differences, and as you might have realized (due to this blog post)... | ||