/explore

Click through on any links that interest you or select the planets on the right to continue exploring the Outer Web.
You are here

blog.carlana.net
| | devopsian.net
3.2 parsecs away

Travel
| | Practical web client unit-testing in Go by mocking the server side, with examples from my first open-source project
| | hjr265.me
4.4 parsecs away

Travel
| | 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
4.3 parsecs away

Travel
| | 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:
| | lukasrotermund.de
21.5 parsecs away

Travel
| I/O operations are among the most commonly used tasks in Go. Let's take a look together at the implementation in the Go standard library.